[PATCH 5 of 5 V4] commands: add evolution "troubles" information to summary output

Denis Laxalde denis.laxalde at logilab.fr
Tue Jan 3 07:54:39 EST 2017


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1475935828 -7200
#      Sat Oct 08 16:10:28 2016 +0200
# Node ID de1a54fc4021ce2ee1ffe9b47af4752fa0ae6992
# Parent  92c6feb3e6556115847482dd82b9f40cf6696556
# EXP-Topic evolve-ui
commands: add evolution "troubles" information to summary output

Extend labels of the `parent: ` line of summary command output according to
what `hg log` displays when coming from changeset_printer (just reuse
cmdutil._changesetlabels function introduced earlier). This makes this line
appear the same in log and summary with custom colors in particular.

Extend that line with the list of evolution "troubles" in parentheses, when
the parent is troubled.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6751,7 +6751,7 @@ def summary(ui, repo, **opts):
         # shows a working directory parent *changeset*:
         # i18n: column positioning for "hg summary"
         ui.write(_('parent: %d:%s ') % (p.rev(), str(p)),
-                 label='log.changeset changeset.%s' % p.phasestr())
+                 label=cmdutil._changesetlabels(p))
         ui.write(' '.join(p.tags()), label='log.tag')
         if p.bookmarks():
             marks.extend(p.bookmarks())
@@ -6760,6 +6760,12 @@ def summary(ui, repo, **opts):
                 ui.write(_(' (empty repository)'))
             else:
                 ui.write(_(' (no revision checked out)'))
+        if p.troubled():
+            ui.write(' (')
+            for trouble in p.troubles():
+                ui.write(trouble,
+                         label='trouble.%s' % trouble)
+            ui.write(')')
         ui.write('\n')
         if p.description():
             ui.status(' ' + p.description().splitlines()[0].strip() + '\n',
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -242,7 +242,7 @@ Fixing "bumped" situation
 We need to create a clone of 5 and add a special marker with a flag
 
   $ hg summary
-  parent: 5:5601fb93a350 tip
+  parent: 5:5601fb93a350 tip (bumped)
    add new_3_c
   branch: default
   commit: (clean)
@@ -477,7 +477,7 @@ detect outgoing obsolete and unstable
   $ hg log -r 'obsolete()'
   4:94b33453f93b (draft) [ ] add original_d
   $ hg summary
-  parent: 5:cda648ca50f5 tip
+  parent: 5:cda648ca50f5 tip (unstable)
    add original_e
   branch: default
   commit: (clean)
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -761,7 +761,7 @@ If a rebase is going to create divergenc
   o  0:4a2df7238c3b A
   
   $ hg summary
-  parent: 15:73568ab6879d tip
+  parent: 15:73568ab6879d tip (unstable)
    bar foo
   branch: default
   commit: (clean)


More information about the Mercurial-devel mailing list