[PATCH] summary: add troubles list to the output of hg summary
Laurent Charignon
lcharignon at fb.com
Fri Dec 4 20:38:20 UTC 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1449261301 28800
# Fri Dec 04 12:35:01 2015 -0800
# Node ID 851cce4e60ea8e3a9d48638d6aec5b0e604157b2
# Parent 71aa5a26162d6e4a165b68f07b331e3e2eedc117
summary: add troubles list to the output of hg summary
This patch adds troubles information for the output of hg summary.
Example line displayed in hg summary:
troubles: 1 unstable changeset
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6335,6 +6335,22 @@
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": (_("troubles: %d unstable changeset"),
+ _("troubles: %d unstable changesets")),
+ "divergent": (_("troubles: %d divergent changeset"),
+ _("troubles: %d divergent changesets")),
+ "bumped": (_("troubles: %d bumped changeset"),
+ _("troubles: %d bumped changesets")),
+ }
+ if numtrouble > 0:
+ plural = 0 if numtrouble == 1 else 1
+ ui.status(troublemsg[trouble][plural] % numtrouble + "\n")
+
cmdutil.summaryhooks(ui, repo)
if opts.get('remote'):
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -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
+ troubles: 1 bumped 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
+ troubles: 1 unstable changeset
$ hg log -G -r '::unstable()'
@ 5:cda648ca50f5 (draft) [tip ] add original_e
|
More information about the Mercurial-devel
mailing list