hgext/color.py
author Matt Harbison <matt_harbison@yahoo.com>
Sun, 07 May 2017 23:29:03 -0400
changeset 32647 331dcf199039
parent 31628 e86eb75e74ce
child 33521 de1cb83728f8
permissions -rw-r--r--
setup: prevent setuptools from laying an egg Previously, test-hghave.t was failing on Windows (and on Linux if $FORCE_SETUPTOOLS was set) with the following: --- c:/Users/Matt/Projects/hg/tests/test-hghave.t +++ c:/Users/Matt/Projects/hg/tests/test-hghave.t.err @@ -19,7 +19,11 @@ > foo > EOF $ run-tests.py $HGTEST_RUN_TESTS_PURE test-hghaveaddon.t + warning: Testing with unexpected mercurial lib: c:\Users\Matt\Projects\hg\mercurial + (expected ...\hgtests.mu9rou\install\lib\python\mercurial) . + warning: Tested with unexpected mercurial lib: c:\Users\Matt\Projects\hg\mercurial + (expected ...\hgtests.mu9rou\install\lib\python\mercurial) Augie relayed concerns[1] about the first attempt at this, which also excluded 'install_egg_info'. All that needs to be excluded to avoid the egg and make the test work is to filter out 'bdist_egg'. (Actually, the body of this class could simply be 'pass', and 'bdist_egg' still isn't run. But that seems to magical.) Also note that prior to this (and still now), `make clean` doesn't delete the 'mercurial.egg-info' that is generated by `make install`. [1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-May/097668.html # no-check-commit
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