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

login
register
mail settings
Submitter Denis Laxalde
Date March 28, 2017, 9:08 p.m.
Message ID <432a32f1941181e0fce9.1490735339@marimba>
Download mbox | patch
Permalink /patch/19794/
State Accepted
Headers show

Comments

Denis Laxalde - March 28, 2017, 9:08 p.m.
# HG changeset patch
# User Denis Laxalde <denis@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.
Yuya Nishihara - March 29, 2017, 2:31 p.m.
On Tue, 28 Mar 2017 23:08:59 +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis@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

These look good. Queued, thanks.

Patch

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():