summary: add troubles list to the output of hg summary
authorLaurent Charignon <lcharignon@fb.com>
Mon, 14 Dec 2015 11:19:48 -0800
changeset 27385 20e7de6205e7
parent 27384 2f63ae140c93
child 27386 55ac8006880f
summary: add troubles list to the output of hg summary This patch adds troubles information to the output of hg summary. Example line displayed in hg summary: unstable: 1 changeset
mercurial/commands.py
tests/test-obsolete.t
--- a/mercurial/commands.py	Wed Dec 16 17:17:12 2015 -0600
+++ b/mercurial/commands.py	Mon Dec 14 11:19:48 2015 -0800
@@ -6493,6 +6493,18 @@
     if draft or secret:
         ui.status(_('phases: %s\n') % ', '.join(t))
 
+    if obsolete.isenabled(repo, obsolete.createmarkersopt):
+        for trouble in ("unstable", "divergent", "bumped"):
+            numtrouble = len(repo.revs(trouble + "()"))
+            # We write all the possibilities to ease translation
+            troublemsg = {
+               "unstable": _("unstable: %d changeset"),
+               "divergent": _("divergent: %d changeset"),
+               "bumped": _("bumped: %d changeset"),
+            }
+            if numtrouble > 0:
+                ui.status(troublemsg[trouble] % numtrouble + "\n")
+
     cmdutil.summaryhooks(ui, repo)
 
     if opts.get('remote'):
--- a/tests/test-obsolete.t	Wed Dec 16 17:17:12 2015 -0600
+++ b/tests/test-obsolete.t	Mon Dec 14 11:19:48 2015 -0800
@@ -238,6 +238,14 @@
 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
+   add new_3_c
+  branch: default
+  commit: (clean)
+  update: 1 new changesets, 2 branch heads (merge)
+  phases: 1 draft
+  bumped: 1 changeset
   $ hg up '5^'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg revert -ar 5
@@ -465,6 +473,14 @@
   94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   $ hg log -r 'obsolete()'
   4:94b33453f93b (draft) [ ] add original_d
+  $ hg summary
+  parent: 5:cda648ca50f5 tip
+   add original_e
+  branch: default
+  commit: (clean)
+  update: 1 new changesets, 2 branch heads (merge)
+  phases: 3 draft
+  unstable: 1 changeset
   $ hg log -G -r '::unstable()'
   @  5:cda648ca50f5 (draft) [tip ] add original_e
   |