hgext/color.py
author Jun Wu <quark@fb.com>
Fri, 07 Jul 2017 18:51:46 -0700
changeset 33332 3b7cb3d17137
parent 31628 e86eb75e74ce
child 33521 de1cb83728f8
permissions -rw-r--r--
rebase: use scmutil.cleanupnodes (issue5606) (BC) This patch migrates rebase to use scmutil.cleanupnodes API. It simplifies the code and makes rebase code reusable inside a transaction. This is a BC because the backup file is no longer strip-backup/*-backup.hg, but strip-backup/*-rebase.hg. The latter looks more reasonable since the directory name is "strip-backup" so there is no need to repeat "backup". I think the backup file name change is probably fine as a BC, since we have changed it before (aa4a1672583e) and didn't get complains. The end result of this series will be a much more consistent and unified backup names: command | old backup file suffix | new backup file suffix ------------------------------------------------------------------- amend | amend-backup.hg | amend.hg histedit | backup.hg (could be 2 files) | histedit.hg (single file) rebase | backup.hg | rebase.hg strip | backup.hg | backup.hg (note: backup files are under .hg/strip-backup) It also fixes issue5606 as a side effect because the new "delayedstrip" code path will carefully examine nodes (safestriproots) to make sure orphaned changesets won't get stripped by accident. Some warning messages are changed to the new "warning: orphaned descendants detected, not stripping HASHES", which provides more information about exactly what changesets are left behind. Another minor behavior change is when there is an obsoleted changeset with a successor in the destination branch, bookmarks pointing to that obsoleted changeset will not be moved. I have commented in test-rebase-obsolete.t explaining why that is more desirable.
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