[PATCH 3 of 3] summary: add evolution "troubles" information to parents header lines

Denis Laxalde denis.laxalde at logilab.fr
Mon Oct 10 08:33:19 EDT 2016


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1475935828 -7200
#      Sat Oct 08 16:10:28 2016 +0200
# Node ID 1ec84349bfa3db4e753f9084837c7ea2f0c3a4b9
# Parent  d9f7776c40b8c82bf438322f2442d99c4e116161
# EXP-Topic evolve-ui
summary: add evolution "troubles" information to parents header lines

Extend labels of the `parent: ` line according to what `hg log` displays when
coming from changeset_printer. This would make this line appear the same in
log and summary with custom colors in particular.

Extend that line with "troubles" information 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
@@ -6778,7 +6778,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())
@@ -6787,6 +6787,14 @@ def summary(ui, repo, **opts):
                 ui.write(_(' (empty repository)'))
             else:
                 ui.write(_(' (no revision checked out)'))
+        if p.troubled():
+            ui.write(' (')
+            ui.write(_('troubles: '),
+                     label='log.changeset changeset.troubled')
+            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 (troubles: 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 (troubles: 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 (troubles: unstable)
    bar foo
   branch: default
   commit: (clean)


More information about the Mercurial-devel mailing list