--- a/mercurial/cmdutil.py Sat Mar 08 16:14:08 2014 -0600
+++ b/mercurial/cmdutil.py Sat Mar 08 17:38:50 2014 -0600
@@ -1059,6 +1059,7 @@
tmpl = templater.parsestring(tmpl)
except SyntaxError:
tmpl = templater.parsestring(tmpl, quoted=False)
+ return tmpl, None
else:
style = util.expandpath(ui.config('ui', 'style', ''))
@@ -1071,6 +1072,38 @@
mapfile = mapname
return None, mapfile
+ if not tmpl:
+ return None, None
+
+ # looks like a literal template?
+ if '{' in tmpl:
+ return tmpl, None
+
+ # perhaps a stock style?
+ if not os.path.split(tmpl)[0]:
+ mapname = (templater.templatepath('map-cmdline.' + tmpl)
+ or templater.templatepath(tmpl))
+ if mapname and os.path.isfile(mapname):
+ return None, mapname
+
+ # perhaps it's a reference to [templates]
+ t = ui.config('templates', tmpl)
+ if t:
+ try:
+ tmpl = templater.parsestring(t)
+ except SyntaxError:
+ tmpl = templater.parsestring(t, quoted=False)
+ return tmpl, None
+
+ # perhaps it's a path to a map or a template
+ if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl):
+ # is it a mapfile for a style?
+ if os.path.basename(tmpl).startswith("map-"):
+ return None, os.path.realpath(tmpl)
+ tmpl = open(tmpl).read()
+ return tmpl, None
+
+ # constant string?
return tmpl, None
def show_changeset(ui, repo, opts, buffered=False):