Patchwork [2,of,3] color: document that changeset phases have labels

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date Aug. 25, 2014, 9:07 p.m.
Message ID <e3d8c9678c12bdbba595.1409000840@Iris>
Download mbox | patch
Permalink /patch/5597/
State Superseded
Headers show

Comments

Jordi Gutiérrez Hermoso - Aug. 25, 2014, 9:07 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1408915648 14400
#      Sun Aug 24 17:27:28 2014 -0400
# Node ID e3d8c9678c12bdbba5954434d0e849d3a21f77da
# Parent  c5f6568355f263842344e08dd2b74051c869324d
color: document that changeset phases have labels

It's very useful to be able to colourise csets according to their
phases. There was no indication anywhere in the docs that this is
possible.
Jordi Gutiérrez Hermoso - Aug. 27, 2014, 5:31 p.m.
On Mon, 2014-08-25 at 17:07 -0400, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1408915648 14400
> #      Sun Aug 24 17:27:28 2014 -0400
> # Node ID e3d8c9678c12bdbba5954434d0e849d3a21f77da
> # Parent  c5f6568355f263842344e08dd2b74051c869324d
> color: document that changeset phases have labels
> 
> It's very useful to be able to colourise csets according to their
> phases. There was no indication anywhere in the docs that this is
> possible.
> 
> diff --git a/hgext/color.py b/hgext/color.py
> --- a/hgext/color.py
> +++ b/hgext/color.py
> @@ -53,6 +53,10 @@ effects may be overridden from your conf
>    diff.tab = none
>    diff.trailingwhitespace = bold red_background
>  
> +  changeset.public = none
> +  changeset.draft = none
> +  changeset.secret = none
> +
>    resolve.unresolved = red bold
>    resolve.resolved = green bold
>  
> @@ -263,6 +267,9 @@ except ImportError:
>             'diff.inserted': 'green',
>             'diff.tab': 'none',
>             'diff.trailingwhitespace': 'bold red_background',
> +           'changeset.public' : 'none',
> +           'changeset.draft' : 'none',
> +           'changeset.secret' : 'none',
>             'diffstat.deleted': 'red',
>             'diffstat.inserted': 'green',
>             'histedit.remaining': 'red bold',

I have just noticed that this is an unintended BC. :-/

It turns out that actually giving the changeset.{phase} labels 'none'
default effects will override any existing effect that the
log.changeset label may have had, since both of these labels are given
to the same fields. Since the changeset.{phase} labels happen after,
giving them a default will mask any effect given to log.changeset.

I don't know how else to document that these labels exist. I mean, I
suppose I could just erase the second hunk, but this would be a bit of
a lie in the documentation where it suggests that they default to
'none'.

I also wonder if there ought to be some sort of default "inherit"
effect in addition to "none", which would work like not giving an
effect at all does now: the effect given to the first label will be
used, and the second label will just "inherit" this effect.

- Jordi G. H.
Jordi Gutiérrez Hermoso - Sept. 3, 2014, 1:39 p.m.
On Wed, 2014-08-27 at 13:31 -0400, Jordi Gutiérrez Hermoso wrote:
> On Mon, 2014-08-25 at 17:07 -0400, Jordi Gutiérrez Hermoso wrote:
> > # HG changeset patch
> > # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> > # Date 1408915648 14400
> > #      Sun Aug 24 17:27:28 2014 -0400
> > # Node ID e3d8c9678c12bdbba5954434d0e849d3a21f77da
> > # Parent  c5f6568355f263842344e08dd2b74051c869324d
> > color: document that changeset phases have labels
> > 
> > It's very useful to be able to colourise csets according to their
> > phases. There was no indication anywhere in the docs that this is
> > possible.
> > 
> > diff --git a/hgext/color.py b/hgext/color.py
> > --- a/hgext/color.py
> > +++ b/hgext/color.py
> > @@ -53,6 +53,10 @@ effects may be overridden from your conf
> >    diff.tab = none
> >    diff.trailingwhitespace = bold red_background
> >  
> > +  changeset.public = none
> > +  changeset.draft = none
> > +  changeset.secret = none
> > +
> >    resolve.unresolved = red bold
> >    resolve.resolved = green bold
> >  
> > @@ -263,6 +267,9 @@ except ImportError:
> >             'diff.inserted': 'green',
> >             'diff.tab': 'none',
> >             'diff.trailingwhitespace': 'bold red_background',
> > +           'changeset.public' : 'none',
> > +           'changeset.draft' : 'none',
> > +           'changeset.secret' : 'none',
> >             'diffstat.deleted': 'red',
> >             'diffstat.inserted': 'green',
> >             'histedit.remaining': 'red bold',
> 
> I have just noticed that this is an unintended BC. :-/
> 
> It turns out that actually giving the changeset.{phase} labels 'none'
> default effects will override any existing effect that the
> log.changeset label may have had, since both of these labels are given
> to the same fields. Since the changeset.{phase} labels happen after,
> giving them a default will mask any effect given to log.changeset.
> 
> I don't know how else to document that these labels exist.

I have come up with a simple solution: simply do `changeset.{phase}=`
instead of `changeset.{phase}='none'`. I've made a few other changes,
so I will now resend this series.

Patch

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -53,6 +53,10 @@  effects may be overridden from your conf
   diff.tab = none
   diff.trailingwhitespace = bold red_background
 
+  changeset.public = none
+  changeset.draft = none
+  changeset.secret = none
+
   resolve.unresolved = red bold
   resolve.resolved = green bold
 
@@ -263,6 +267,9 @@  except ImportError:
            'diff.inserted': 'green',
            'diff.tab': 'none',
            'diff.trailingwhitespace': 'bold red_background',
+           'changeset.public' : 'none',
+           'changeset.draft' : 'none',
+           'changeset.secret' : 'none',
            'diffstat.deleted': 'red',
            'diffstat.inserted': 'green',
            'histedit.remaining': 'red bold',