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 commit is contained in:
Sean Farley 2015-01-14 20:29:47 -08:00
parent 8f432b351e
commit a6610c70d3
2 changed files with 19 additions and 5 deletions

View File

@ -920,8 +920,8 @@ class changeset_printer(object):
# 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()),

View File

@ -1571,8 +1571,9 @@ Check that adding an arbitrary name shows up in log automatically
> 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 @@ Check that adding an arbitrary name shows up in log automatically
$ 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