Patchwork [V3] summary: add troubles list to the output of hg summary

login
register
mail settings
Submitter Laurent Charignon
Date Dec. 11, 2015, 1:05 a.m.
Message ID <565dc5add568bd2947af.1449795933@lcharignon-mbp.local>
Download mbox | patch
Permalink /patch/11966/
State Superseded
Commit 20e7de6205e7ef421fd4f23f00aed394afb7365e
Headers show

Comments

Laurent Charignon - Dec. 11, 2015, 1:05 a.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1449795920 28800
#      Thu Dec 10 17:05:20 2015 -0800
# Node ID 565dc5add568bd2947afe1c2c693389f1468515e
# Parent  71aa5a26162d6e4a165b68f07b331e3e2eedc117
summary: add troubles list to the output of hg summary

This patch adds troubles information for the output of hg summary.
Example lines displayed in hg summary:
unstable: 1 changeset
bumped: 2 changesets
Pierre-Yves David - Dec. 11, 2015, 11:46 a.m.
On 12/11/2015 01:05 AM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1449795920 28800
> #      Thu Dec 10 17:05:20 2015 -0800
> # Node ID 565dc5add568bd2947afe1c2c693389f1468515e
> # Parent  71aa5a26162d6e4a165b68f07b331e3e2eedc117
> summary: add troubles list to the output of hg summary
>
> This patch adds troubles information for the output of hg summary.
> Example lines displayed in hg summary:
> unstable: 1 changeset
> bumped: 2 changesets
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -6335,6 +6335,18 @@ def summary(ui, repo, **opts):
>       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": _("%d unstable changeset"),
> +               "divergent": _("%d divergent changeset"),
> +               "bumped": _("%d bumped changeset"),
> +            }
> +            if numtrouble > 0:
> +                ui.status(troublemsg[trouble] % 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 @@ And that we can't push bumped changeset
>   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
> +  1 bumped changeset

Why did we changed from "unstable: 1 changesets"
to "1 unstable changesets" between V3 and V3?

I think we should stick with the "<category>: <data>" structure used in 
the rest of `hg summary` output.

Did I missed something?
Augie Fackler - Dec. 11, 2015, 4:21 p.m.
On Fri, Dec 11, 2015 at 11:46:13AM +0000, Pierre-Yves David wrote:
>
>
> On 12/11/2015 01:05 AM, Laurent Charignon wrote:
> ># HG changeset patch
> ># User Laurent Charignon <lcharignon@fb.com>
> ># Date 1449795920 28800
> >#      Thu Dec 10 17:05:20 2015 -0800
> ># Node ID 565dc5add568bd2947afe1c2c693389f1468515e
> ># Parent  71aa5a26162d6e4a165b68f07b331e3e2eedc117
> >summary: add troubles list to the output of hg summary
> >
> >This patch adds troubles information for the output of hg summary.
> >Example lines displayed in hg summary:
> >unstable: 1 changeset
> >bumped: 2 changesets
> >
> >diff --git a/mercurial/commands.py b/mercurial/commands.py
> >--- a/mercurial/commands.py
> >+++ b/mercurial/commands.py
> >@@ -6335,6 +6335,18 @@ def summary(ui, repo, **opts):
> >      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": _("%d unstable changeset"),
> >+               "divergent": _("%d divergent changeset"),
> >+               "bumped": _("%d bumped changeset"),
> >+            }
> >+            if numtrouble > 0:
> >+                ui.status(troublemsg[trouble] % 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 @@ And that we can't push bumped changeset
> >  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
> >+  1 bumped changeset
>
> Why did we changed from "unstable: 1 changesets"
> to "1 unstable changesets" between V3 and V3?
>
> I think we should stick with the "<category>: <data>" structure used in the
> rest of `hg summary` output.
>
> Did I missed something?

+1, I liked v2's output slightly better I think.

>
> --
> Pierre-Yves David
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Laurent Charignon - Dec. 14, 2015, 5 p.m.
On 12/11/15, 3:46 AM, "Pierre-Yves David" <pierre-yves.david@ens-lyon.org>
wrote:

>
>
>On 12/11/2015 01:05 AM, Laurent Charignon wrote:
>> # HG changeset patch
>> # User Laurent Charignon <lcharignon@fb.com>
>> # Date 1449795920 28800
>> #      Thu Dec 10 17:05:20 2015 -0800
>> # Node ID 565dc5add568bd2947afe1c2c693389f1468515e
>> # Parent  71aa5a26162d6e4a165b68f07b331e3e2eedc117
>> summary: add troubles list to the output of hg summary
>>
>> This patch adds troubles information for the output of hg summary.
>> Example lines displayed in hg summary:
>> unstable: 1 changeset
>> bumped: 2 changesets
>>
>> diff --git a/mercurial/commands.py b/mercurial/commands.py
>> --- a/mercurial/commands.py
>> +++ b/mercurial/commands.py
>> @@ -6335,6 +6335,18 @@ def summary(ui, repo, **opts):
>>       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": _("%d unstable changeset"),
>> +               "divergent": _("%d divergent changeset"),
>> +               "bumped": _("%d bumped changeset"),
>> +            }
>> +            if numtrouble > 0:
>> +                ui.status(troublemsg[trouble] % 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 @@ And that we can't push bumped changeset
>>   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
>> +  1 bumped changeset
>
>Why did we changed from "unstable: 1 changesets"
>to "1 unstable changesets" between V3 and V3?


>
>I think we should stick with the "<category>: <data>" structure used in
>the rest of `hg summary` output.

Yes my bad, I changed it based on something smf said on IRC, it seems like
it was just to illustrate a point on plurals vs singular not meant to be
the format we want.


I will send a V4 :)

Laurent


>
>Did I missed something?
>
>-- 
>Pierre-Yves David

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6335,6 +6335,18 @@  def summary(ui, repo, **opts):
     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": _("%d unstable changeset"),
+               "divergent": _("%d divergent changeset"),
+               "bumped": _("%d bumped changeset"),
+            }
+            if numtrouble > 0:
+                ui.status(troublemsg[trouble] % 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 @@  And that we can't push bumped changeset
 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
+  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 @@  detect outgoing obsolete and unstable
   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
+  1 unstable changeset
   $ hg log -G -r '::unstable()'
   @  5:cda648ca50f5 (draft) [tip ] add original_e
   |