Patchwork [5,of,5] log: use namespace logname and colorname

login
register
mail settings
Submitter Sean Farley
Date Jan. 15, 2015, 6:58 a.m.
Message ID <dc1f57f272ce8f266226.1421305101@laptop.local>
Download mbox | patch
Permalink /patch/7472/
State Accepted
Headers show

Comments

Sean Farley - Jan. 15, 2015, 6:58 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1421296187 28800
#      Wed Jan 14 20:29:47 2015 -0800
# Node ID dc1f57f272ce8f2662261368cbe0ce24a12b4463
# Parent  3f25179d696ba392ade8b1c83024e14bcb1dd534
log: use namespace logname and colorname

Now that we have the machinary to change the log name and the color label used,
let's use that. Tests have been updated accordingly.
Ryan McElroy - Jan. 15, 2015, 9:48 p.m.
On 1/14/2015 10:58 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1421296187 28800
> #      Wed Jan 14 20:29:47 2015 -0800
> # Node ID dc1f57f272ce8f2662261368cbe0ce24a12b4463
> # Parent  3f25179d696ba392ade8b1c83024e14bcb1dd534
> log: use namespace logname and colorname
>
> Now that we have the machinary to change the log name and the color label used,
> let's use that. Tests have been updated accordingly.
This series looks good to me. The suggestions I had (around enforcing 
that required parameters are not None) can be implemented later since 
they don't change behavior, only the safety of implementing future 
namespace users. I'd suggest getting this in before the cutoff and 
worrying about my suggestion later if at all.
Pierre-Yves David - Jan. 15, 2015, 11:37 p.m.
On 01/15/2015 01:48 PM, Ryan McElroy wrote:
> On 1/14/2015 10:58 PM, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean.michael.farley@gmail.com>
>> # Date 1421296187 28800
>> #      Wed Jan 14 20:29:47 2015 -0800
>> # Node ID dc1f57f272ce8f2662261368cbe0ce24a12b4463
>> # Parent  3f25179d696ba392ade8b1c83024e14bcb1dd534
>> log: use namespace logname and colorname
>>
>> Now that we have the machinary to change the log name and the color
>> label used,
>> let's use that. Tests have been updated accordingly.
> This series looks good to me. The suggestions I had (around enforcing
> that required parameters are not None) can be implemented later since
> they don't change behavior, only the safety of implementing future
> namespace users. I'd suggest getting this in before the cutoff and
> worrying about my suggestion later if at all.

Series overall looks good to me.

However, I would like the documentation and init value documentaiton 
fixed before queuing it.
Pierre-Yves David - Jan. 16, 2015, 2:46 a.m.
On 01/14/2015 10:58 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1421296187 28800
> #      Wed Jan 14 20:29:47 2015 -0800
> # Node ID dc1f57f272ce8f2662261368cbe0ce24a12b4463
> # Parent  3f25179d696ba392ade8b1c83024e14bcb1dd534
> log: use namespace logname and colorname

A updated version of them is pusheds tot he clowncopter.

Thanks

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -918,12 +918,12 @@  class changeset_printer(object):
                 continue
             # we will use the templatename as the color name since those two
             # should be the same
             for name in ns.names(self.repo, changenode):
                 # i18n: column positioning for "hg log"
-                tname = _(("%s:" % ns.templatename).ljust(13) + "%s\n") % name
-                self.ui.write("%s" % tname, label='log.%s' % ns.templatename)
+                name = _(("%s:" % ns.logname).ljust(13) + "%s\n") % name
+                self.ui.write("%s" % name, label='log.%s' % ns.colorname)
         if self.ui.debugflag:
             # i18n: column positioning for "hg log"
             self.ui.write(_("phase:       %s\n") % _(ctx.phasestr()),
                           label='log.phase')
         for parent in parents:
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1569,24 +1569,38 @@  Check that adding an arbitrary name show
   >     foo = {'foo': repo[0].node()}
   >     names = lambda r: foo.keys()
   >     namemap = lambda r, name: foo.get(name)
   >     nodemap = lambda r, node: [name for name, n in foo.iteritems()
   >                                if n == node]
-  >     ns = namespace("bars", templatename="bar", listnames=names,
-  >                    namemap=namemap, nodemap=nodemap)
+  >     ns = namespace("bars", templatename="bar", logname="barlog",
+  >                    colorname="barcolor", listnames=names, namemap=namemap,
+  >                    nodemap=nodemap)
   > 
   >     repo.names.addnamespace(ns)
   > EOF
 
   $ hg --config extensions.names=../names.py log -r 0
   changeset:   0:65624cd9070a
   tag:         tip
-  bar:         foo
+  barlog:      foo
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     a bunch of weird directories
   
+  $ hg --config extensions.names=../names.py \
+  >  --config extensions.color= --config color.log.barcolor=red \
+  >  --color=always log -r 0
+  \x1b[0;33mchangeset:   0:65624cd9070a\x1b[0m (esc)
+  tag:         tip
+  \x1b[0;31mbarlog:      foo\x1b[0m (esc)
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     a bunch of weird directories
+  
+  $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n'
+  foo
+
   $ cd ..
 
 hg log -f dir across branches
 
   $ hg init acrossbranches