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

login
register
mail settings
Submitter Denis Laxalde
Date March 25, 2017, 1:09 p.m.
Message ID <130358da2eb894aa04e3.1490447356@marimba>
Download mbox | patch
Permalink /patch/19667/
State Superseded
Delegated to: Yuya Nishihara
Headers show

Comments

Denis Laxalde - March 25, 2017, 1:09 p.m.
# HG changeset patch
# User Denis Laxalde <denis@laxalde.org>
# Date 1490431147 -3600
#      Sat Mar 25 09:39:07 2017 +0100
# Node ID 130358da2eb894aa04e3bb731d0ccae84205c2ba
# Parent  91ddb33deea5b4813d4897f6860b00078afd3f19
# Available At https://bitbucket.org/dlax/hg-work
#              hg pull https://bitbucket.org/dlax/hg-work -r 130358da2eb8
# 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.

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