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

Denis Laxalde denis.laxalde at logilab.fr
Tue Nov 8 09:19:57 EST 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 35c0f05d694cb9541d60bad9a940cb93a39d615d
# Parent  b5d3d230bbc64d44968a9912e8e72aac8236522a
# 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
@@ -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,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