make --style=compact look for map-cmdline.compact.
change name of key in map file from changelog to changeset.
rename command map files to start with map-cmdline.
rename ui.logmap to ui.style in hgrc.
now --style=foo does this:
tries to open foo as file.
tries as map-cmdline.foo in template path.
tries as foo in template path.
--- a/doc/hgrc.5.txt Sat Mar 04 12:40:10 2006 -0800
+++ b/doc/hgrc.5.txt Sat Mar 04 15:15:18 2006 -0800
@@ -240,8 +240,8 @@
Allow to prompt the user. True or False. Default is True.
logtemplate;;
Template string for commands that print changesets.
- logmap;;
- Template map file for commands that print changesets.
+ style;;
+ Name of style to use for command output.
merge;;
The conflict resolution program to use during a manual merge.
Default is "hgmerge".
--- a/mercurial/commands.py Sat Mar 04 12:40:10 2006 -0800
+++ b/mercurial/commands.py Sat Mar 04 15:15:18 2006 -0800
@@ -349,7 +349,7 @@
def use_template(self, t):
'''set template string to use'''
- self.t.cache['changelog'] = t
+ self.t.cache['changeset'] = t
def write(self, thing):
'''write expanded template.
@@ -489,10 +489,10 @@
}
try:
- if self.ui.verbose and 'changelog_verbose' in self.t:
- key = 'changelog_verbose'
+ if self.ui.verbose and 'changeset_verbose' in self.t:
+ key = 'changeset_verbose'
else:
- key = 'changelog'
+ key = 'changeset'
self.write(self.t(key, **props))
except KeyError, inst:
raise util.Abort(_("%s: no key named '%s'") % (self.t.mapfile,
@@ -578,11 +578,12 @@
else:
tmpl = ui.config('ui', 'logtemplate')
if tmpl: tmpl = templater.parsestring(tmpl)
- mapfile = opts.get('style') or ui.config('ui', 'logmap')
+ mapfile = opts.get('style') or ui.config('ui', 'style')
if tmpl or mapfile:
if mapfile:
if not os.path.isfile(mapfile):
- mapname = templater.templatepath(mapfile)
+ mapname = templater.templatepath('map-cmdline.' + mapfile)
+ if not mapname: mapname = templater.templatepath(mapfile)
if mapname: mapfile = mapname
try:
t = changeset_templater(ui, repo, mapfile)
--- a/mercurial/templater.py Sat Mar 04 12:40:10 2006 -0800
+++ b/mercurial/templater.py Sat Mar 04 15:15:18 2006 -0800
@@ -76,9 +76,9 @@
return
i = 0
for l in file(mapfile):
- l = l.rstrip('\r\n')
+ l = l.strip()
i += 1
- if l.startswith('#') or not l.strip(): continue
+ if not l or l[0] in '#;': continue
m = re.match(r'([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(.+)$', l)
if m:
key, val = m.groups()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/map-cmdline.compact Sat Mar 04 15:15:18 2006 -0800
@@ -0,0 +1,7 @@
+changeset = '{rev}{tags}{parents} {node|short} {date|isodate} {author|user}\n {desc|firstline|strip}\n\n'
+start_tags = '['
+tag = '{tag},'
+last_tag = '{tag}]'
+start_parents = ':'
+parent = '{rev},'
+last_parent = '{rev}'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/map-cmdline.default Sat Mar 04 15:15:18 2006 -0800
@@ -0,0 +1,12 @@
+changeset = 'changeset: {rev}:{node|short}\n{tags}{short_parents}user: {author}\ndate: {date|date}\nsummary:\n{desc|firstline}\n\n'
+changeset_verbose = 'changeset: {rev}:{node}\n{tags}{parents}{manifest}user: {author}\ndate: {date|date}\nfiles: {files}\n{file_adds}{file_dels}description:\n{desc|strip}\n\n\n'
+start_file_adds = 'files+: '
+file_add = ' {file_add}'
+end_file_adds = '\n'
+start_file_dels = 'files-: '
+file_del = ' {file_del}'
+end_file_dels = '\n'
+short_parent = 'parent: {rev}:{node|short}\n'
+parent = 'parent: {rev}:{node}\n'
+manifest = 'manifest: {rev}:{node}\n'
+tag = 'tag: {tag}\n'
--- a/templates/map-log.compact Sat Mar 04 12:40:10 2006 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-changelog = '{rev}{tags}{parents} {node|short} {date|isodate} {author|user}\n {desc|firstline|strip}\n\n'
-start_tags = '['
-tag = '{tag},'
-last_tag = '{tag}]'
-start_parents = ':'
-parent = '{rev},'
-last_parent = '{rev}'
--- a/templates/map-log.verbose Sat Mar 04 12:40:10 2006 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-changelog = 'changeset: {rev}:{node}\n{tags}{parents}{manifest}user: {author}\ndate: {date|date}\nfiles: {files}\n{file_adds}{file_dels}description:\n{desc|strip}\n\n\n'
-start_file_adds = 'files+: '
-file_add = ' {file_add}'
-end_file_adds = '\n'
-start_file_dels = 'files-: '
-file_del = ' {file_del}'
-end_file_dels = '\n'
-parent = 'parent: {rev}:{node}\n'
-manifest = 'manifest: {rev}:{node}\n'
-tag = 'tag: {tag}\n'