##// END OF EJS Templates
cmdutil: refactor handling of templating in show_changeset()
Dirkjan Ochtman -
r7967:c03f4215 default
parent child Browse files
Show More
@@ -912,32 +912,37 b' def show_changeset(ui, repo, opts, buffe'
912 patch = matchfn or matchall(repo)
912 patch = matchfn or matchall(repo)
913
913
914 tmpl = opts.get('template')
914 tmpl = opts.get('template')
915 mapfile = None
915 style = None
916 if tmpl:
916 if tmpl:
917 tmpl = templater.parsestring(tmpl, quoted=False)
917 tmpl = templater.parsestring(tmpl, quoted=False)
918 else:
918 else:
919 mapfile = opts.get('style')
919 style = opts.get('style')
920 # ui settings
920
921 if not mapfile:
921 # ui settings
922 tmpl = ui.config('ui', 'logtemplate')
922 if not (tmpl or style):
923 if tmpl:
923 tmpl = ui.config('ui', 'logtemplate')
924 tmpl = templater.parsestring(tmpl)
924 if tmpl:
925 else:
925 tmpl = templater.parsestring(tmpl)
926 mapfile = ui.config('ui', 'style')
926 else:
927 style = ui.config('ui', 'style')
928
929 if not (tmpl or style):
930 return changeset_printer(ui, repo, patch, opts, buffered)
927
931
928 if tmpl or mapfile:
932 mapfile = None
929 if mapfile:
933 if style and not tmpl:
930 if not os.path.split(mapfile)[0]:
934 mapfile = style
931 mapname = (templater.templatepath('map-cmdline.' + mapfile)
935 if not os.path.split(mapfile)[0]:
932 or templater.templatepath(mapfile))
936 mapname = (templater.templatepath('map-cmdline.' + mapfile)
933 if mapname: mapfile = mapname
937 or templater.templatepath(mapfile))
934 try:
938 if mapname: mapfile = mapname
935 t = changeset_templater(ui, repo, patch, opts, mapfile, buffered)
939
936 except SyntaxError, inst:
940 try:
937 raise util.Abort(inst.args[0])
941 t = changeset_templater(ui, repo, patch, opts, mapfile, buffered)
938 if tmpl: t.use_template(tmpl)
942 except SyntaxError, inst:
939 return t
943 raise util.Abort(inst.args[0])
940 return changeset_printer(ui, repo, patch, opts, buffered)
944 if tmpl: t.use_template(tmpl)
945 return t
941
946
942 def finddate(ui, repo, date):
947 def finddate(ui, repo, date):
943 """Find the tipmost changeset that matches the given date spec"""
948 """Find the tipmost changeset that matches the given date spec"""
General Comments 0
You need to be logged in to leave comments. Login now