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.
--- a/mercurial/cmdutil.py Wed Jan 14 20:11:02 2015 -0800
+++ b/mercurial/cmdutil.py Wed Jan 14 20:29:47 2015 -0800
@@ -920,8 +920,8 @@
# 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()),
--- a/tests/test-log.t Wed Jan 14 20:11:02 2015 -0800
+++ b/tests/test-log.t Wed Jan 14 20:29:47 2015 -0800
@@ -1571,8 +1571,9 @@
> 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
@@ -1580,11 +1581,24 @@
$ 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