hgext/color.py
author Pulkit Goyal <7895pulkit@gmail.com>
Fri, 05 May 2017 01:41:54 +0530
changeset 32155 055cca8e167b
parent 31628 e86eb75e74ce
child 33521 de1cb83728f8
permissions -rw-r--r--
py3: use %d to format integers into bytestrings
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22771
d6274291fac1 color: update description of the extension
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 22763
diff changeset
     1
# color.py color output for Mercurial commands
5787
b7b22a2ade2e Add colored output to status and qseries commands
Kevin Christen <kevin.christen@gmail.com>
parents:
diff changeset
     2
#
b7b22a2ade2e Add colored output to status and qseries commands
Kevin Christen <kevin.christen@gmail.com>
parents:
diff changeset
     3
# Copyright (C) 2007 Kevin Christen <kevin.christen@gmail.com>
b7b22a2ade2e Add colored output to status and qseries commands
Kevin Christen <kevin.christen@gmail.com>
parents:
diff changeset
     4
#
15771
425c1309718f color: Use the same GPL boilerplate as most hg files
Augie Fackler <durin42@gmail.com>
parents: 15048
diff changeset
     5
# This software may be used and distributed according to the terms of the
425c1309718f color: Use the same GPL boilerplate as most hg files
Augie Fackler <durin42@gmail.com>
parents: 15048
diff changeset
     6
# GNU General Public License version 2 or any later version.
5787
b7b22a2ade2e Add colored output to status and qseries commands
Kevin Christen <kevin.christen@gmail.com>
parents:
diff changeset
     7
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31120
diff changeset
     8
'''enable Mercurial color mode (DEPRECATED)
30176
9f41b66cffc0 color: add some documentation for custom terminfo codes
Danek Duvall <danek.duvall@oracle.com>
parents: 30175
diff changeset
     9
31628
e86eb75e74ce color: fix grammar in help text
Matt Harbison <matt_harbison@yahoo.com>
parents: 31123
diff changeset
    10
This extension enables Mercurial color mode. The feature is now directly
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31120
diff changeset
    11
available in Mercurial core. You can access it using::
7456
79eb16db5e4a color: diff colorization
Brodie Rao <me+hg@dackz.net>
parents: 7455
diff changeset
    12
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31120
diff changeset
    13
  [ui]
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31120
diff changeset
    14
  color = auto
14769
9adce4b38ed1 color: for the sake of "less -R", default to ansi in auto mode (issue2792)
Brodie Rao <brodie@bitheap.org>
parents: 14768
diff changeset
    15
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31120
diff changeset
    16
See :hg:`help color` for details.
5787
b7b22a2ade2e Add colored output to status and qseries commands
Kevin Christen <kevin.christen@gmail.com>
parents:
diff changeset
    17
'''
b7b22a2ade2e Add colored output to status and qseries commands
Kevin Christen <kevin.christen@gmail.com>
parents:
diff changeset
    18
28968
a5d449a7bc8f py3: make color use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28633
diff changeset
    19
from __future__ import absolute_import
5787
b7b22a2ade2e Add colored output to status and qseries commands
Kevin Christen <kevin.christen@gmail.com>
parents:
diff changeset
    20
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31120
diff changeset
    21
from mercurial import color
5787
b7b22a2ade2e Add colored output to status and qseries commands
Kevin Christen <kevin.christen@gmail.com>
parents:
diff changeset
    22
29841
d5883fd055c6 extensions: change magic "shipped with hg" string
Augie Fackler <augie@google.com>
parents: 29205
diff changeset
    23
# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
25186
80c5b2666a96 extensions: document that `testedwith = 'internal'` is special
Augie Fackler <augie@google.com>
parents: 24848
diff changeset
    24
# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
80c5b2666a96 extensions: document that `testedwith = 'internal'` is special
Augie Fackler <augie@google.com>
parents: 24848
diff changeset
    25
# be specifying the version(s) of Mercurial they are tested with, or
80c5b2666a96 extensions: document that `testedwith = 'internal'` is special
Augie Fackler <augie@google.com>
parents: 24848
diff changeset
    26
# leave the attribute unspecified.
29841
d5883fd055c6 extensions: change magic "shipped with hg" string
Augie Fackler <augie@google.com>
parents: 29205
diff changeset
    27
testedwith = 'ships-with-hg-core'
16743
38caf405d010 hgext: mark all first-party extensions as such
Augie Fackler <raf@durin42.com>
parents: 15771
diff changeset
    28
12693
33f0682ba8b1 color: add global option in extsetup() instead of globally
Brodie Rao <brodie@bitheap.org>
parents: 12278
diff changeset
    29
def extsetup(ui):
31104
8346b2f09e79 color: add the definition of '--color' in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31103
diff changeset
    30
    # change default color config
31110
7fec37746417 color: add a 'ui.color' option to control color behavior
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31105
diff changeset
    31
    color._enabledbydefault = True