Patchwork [1,of,4] templatekw: add troubles state

login
register
mail settings
Submitter Romain DEP.
Date Jan. 6, 2015, 9:48 a.m.
Message ID <e42d7e651a8f68ff55ce.1420537712@ultas>
Download mbox | patch
Permalink /patch/7336/
State Changes Requested
Headers show

Comments

Romain DEP. - Jan. 6, 2015, 9:48 a.m.
# HG changeset patch
# User Romain DEP. <rom1dep@gmail.com>
# Date 1420456028 -3600
#      Mon Jan 05 12:07:08 2015 +0100
# Node ID e42d7e651a8f68ff55cea9f67f8247ebe82a6142
# Parent  090d3c5b76939f9b224324ede795397bbd2a3b58
templatekw: add troubles state
Pierre-Yves David - Jan. 9, 2015, 4:46 a.m.
On 01/06/2015 01:48 AM, Romain DEP. wrote:
> # HG changeset patch
> # User Romain DEP. <rom1dep@gmail.com>
> # Date 1420456028 -3600
> #      Mon Jan 05 12:07:08 2015 +0100
> # Node ID e42d7e651a8f68ff55cea9f67f8247ebe82a6142
> # Parent  090d3c5b76939f9b224324ede795397bbd2a3b58
> templatekw: add troubles state

 From what I get, the template keyword is not translated. This makes 
sense if it aimed at producing label, but it would also be very useful 
for real output.

Moreover, for labeling purpose, I think that introducing a 'troubled' 
flag first would be more valuable.

Also, I think that "state" is probably a bad choice of world in the 
description.
Romain DEP. - Jan. 9, 2015, 2:36 p.m.
Le 09/01/2015 05:46, Pierre-Yves David a écrit :
> On 01/06/2015 01:48 AM, Romain DEP. wrote:
>> # HG changeset patch
>> # User Romain DEP. <rom1dep@gmail.com>
>> # Date 1420456028 -3600
>> #      Mon Jan 05 12:07:08 2015 +0100
>> # Node ID e42d7e651a8f68ff55cea9f67f8247ebe82a6142
>> # Parent  090d3c5b76939f9b224324ede795397bbd2a3b58
>> templatekw: add troubles state
>
> From what I get, the template keyword is not translated. This makes 
> sense if it aimed at producing label, but it would also be very useful 
> for real output.
This is indeed aimed at producing labels and is purposely not translated 
(neither is showphase for instance)

> Moreover, for labeling purpose, I think that introducing a 'troubled' 
> flag first would be more valuable.
I think that it should either output "troubled"/"untroubled" or list the 
different kind of troubles encountered, this was discussed briefly on 
IRC, and I think that being specific here is a good thing.
Pierre-Yves David - Jan. 9, 2015, 7:33 p.m.
On 01/09/2015 06:36 AM, Romain DEP. wrote:
> Le 09/01/2015 05:46, Pierre-Yves David a écrit :
>> On 01/06/2015 01:48 AM, Romain DEP. wrote:
>>> # HG changeset patch
>>> # User Romain DEP. <rom1dep@gmail.com>
>>> # Date 1420456028 -3600
>>> #      Mon Jan 05 12:07:08 2015 +0100
>>> # Node ID e42d7e651a8f68ff55cea9f67f8247ebe82a6142
>>> # Parent  090d3c5b76939f9b224324ede795397bbd2a3b58
>>> templatekw: add troubles state
>>
>> From what I get, the template keyword is not translated. This makes
>> sense if it aimed at producing label, but it would also be very useful
>> for real output.
> This is indeed aimed at producing labels and is purposely not translated
> (neither is showphase for instance)

Should we also have one for textual purpose? how would this cohabit with 
the one or label purpose?

>> Moreover, for labeling purpose, I think that introducing a 'troubled'
>> flag first would be more valuable.
> I think that it should either output "troubled"/"untroubled" or list the
> different kind of troubles encountered, this was discussed briefly on
> IRC, and I think that being specific here is a good thing.

As someone who already implemented styling for troubled changesets in 
hgview, tortoisehg and smartlog, I think have a 'troubled' binary flag 
is a better solution as a start. What can I do to convinces you so ?

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -362,6 +362,10 @@ 
     """:obsolete: String. Return the changeset obsolete state."""
     return ctx.obsoletestr()
 
+def listtroubles(repo, ctx, templ, **args):
+    """:troubles: List of strings. Return the changeset list of troubles if any."""
+    return ctx.troubles()
+
 def showrev(repo, ctx, templ, **args):
     """:rev: Integer. The repository-local changeset revision number."""
     return ctx.rev()
@@ -390,6 +394,7 @@ 
     return showlist(repo.names.templatename(namespace), names,
                     plural=namespace, **args)
 
+
 # keywords are callables like:
 # fn(repo, ctx, templ, cache, revcache, **args)
 # with:
@@ -428,6 +433,7 @@ 
     'phaseidx': showphaseidx,
     'hidden': showhidden,
     'obsolete': showobsolete,
+    'troubles': listtroubles,
     'rev': showrev,
     'subrepos': showsubrepos,
 }