[PATCH 1 of 6 V2] cmdutil: add a "changeset.obsolete" label in changeset_printer

Denis Laxalde denis at laxalde.org
Tue Mar 28 21:08:59 UTC 2017


# HG changeset patch
# User Denis Laxalde <denis at laxalde.org>
# Date 1490431147 -3600
#      Sat Mar 25 09:39:07 2017 +0100
# Node ID 432a32f1941181e0fce98eda306601cbbf5c122a
# Parent  91ddb33deea5b4813d4897f6860b00078afd3f19
# Available At https://bitbucket.org/dlax/hg-work
#              hg pull https://bitbucket.org/dlax/hg-work -r 432a32f19411
# EXP-Topic obsolete-ui
cmdutil: add a "changeset.obsolete" label in changeset_printer

Until now there were no label to highlight obsolete changesets in log output,
only evolution troubles (unstable, bumped, divergent) are supported. We add a
"changeset.obsolete" label on changeset entries produced by changeset_printer
so that obsolete changesets can be highlighted in log output. This is useful
because, unless using a graph log where obsolete changesets have a 'x' marker,
there's no way to identify obsolete changesets. And even in graph mode, when
working directory's parent is obsolete, we get a '@' marker and we do not see
it as obsolete.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1155,6 +1155,8 @@ def diffordiffstat(ui, repo, diffopts, n
 
 def _changesetlabels(ctx):
     labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
+    if ctx.obsolete():
+        labels.append('changeset.obsolete')
     if ctx.troubled():
         labels.append('changeset.troubled')
         for trouble in ctx.troubles():


More information about the Mercurial-devel mailing list