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

login
register
mail settings
Submitter Denis Laxalde
Date Oct. 10, 2016, 12:33 p.m.
Message ID <1ec84349bfa3db4e753f.1476102799@sh77.tls.logilab.fr>
Download mbox | patch
Permalink /patch/17022/
State Deferred
Delegated to: Yuya Nishihara
Headers show

Comments

Denis Laxalde - Oct. 10, 2016, 12:33 p.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@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.
Yuya Nishihara - Oct. 15, 2016, 12:45 p.m.
On Mon, 10 Oct 2016 14:33:19 +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde@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(')')

Why do we need it in addition to the existing unstable/divergent/bumped
fields?
Denis Laxalde - Nov. 8, 2016, 2:18 p.m.
Yuya Nishihara a écrit :
> On Mon, 10 Oct 2016 14:33:19 +0200, Denis Laxalde wrote:
>> # HG changeset patch
>> # User Denis Laxalde <denis.laxalde@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(')')
>
> Why do we need it in addition to the existing unstable/divergent/bumped
> fields?
>

The intent here is to display "troubles" information of the parents. If
I understand correctly, the unstable/divergent/bumped fields you are
referring to display statistics on the whole repository.

(Sorry for the late reply, I missed this one.)
Yuya Nishihara - Nov. 9, 2016, 1:28 p.m.
On Tue, 8 Nov 2016 15:18:52 +0100, Denis Laxalde wrote:
> Yuya Nishihara a écrit :
> > On Mon, 10 Oct 2016 14:33:19 +0200, Denis Laxalde wrote:
> >> # HG changeset patch
> >> # User Denis Laxalde <denis.laxalde@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(')')
> >
> > Why do we need it in addition to the existing unstable/divergent/bumped
> > fields?
> 
> The intent here is to display "troubles" information of the parents. If
> I understand correctly, the unstable/divergent/bumped fields you are
> referring to display statistics on the whole repository.

You're right, thanks.

Patch

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)