Show More
@@ -1047,6 +1047,33 b' class changeset_templater(changeset_prin' | |||||
1047 | except SyntaxError, inst: |
|
1047 | except SyntaxError, inst: | |
1048 | raise util.Abort('%s: %s' % (self.t.mapfile, inst.args[0])) |
|
1048 | raise util.Abort('%s: %s' % (self.t.mapfile, inst.args[0])) | |
1049 |
|
1049 | |||
|
1050 | def gettemplate(ui, tmpl, style): | |||
|
1051 | """ | |||
|
1052 | Find the template matching the given template spec or style. | |||
|
1053 | """ | |||
|
1054 | ||||
|
1055 | # ui settings | |||
|
1056 | if not tmpl and not style: | |||
|
1057 | tmpl = ui.config('ui', 'logtemplate') | |||
|
1058 | if tmpl: | |||
|
1059 | try: | |||
|
1060 | tmpl = templater.parsestring(tmpl) | |||
|
1061 | except SyntaxError: | |||
|
1062 | tmpl = templater.parsestring(tmpl, quoted=False) | |||
|
1063 | else: | |||
|
1064 | style = util.expandpath(ui.config('ui', 'style', '')) | |||
|
1065 | ||||
|
1066 | if style: | |||
|
1067 | mapfile = style | |||
|
1068 | if not os.path.split(mapfile)[0]: | |||
|
1069 | mapname = (templater.templatepath('map-cmdline.' + mapfile) | |||
|
1070 | or templater.templatepath(mapfile)) | |||
|
1071 | if mapname: | |||
|
1072 | mapfile = mapname | |||
|
1073 | return None, mapfile | |||
|
1074 | ||||
|
1075 | return tmpl, None | |||
|
1076 | ||||
1050 | def show_changeset(ui, repo, opts, buffered=False): |
|
1077 | def show_changeset(ui, repo, opts, buffered=False): | |
1051 | """show one changeset using template or regular display. |
|
1078 | """show one changeset using template or regular display. | |
1052 |
|
1079 | |||
@@ -1063,34 +1090,11 b' def show_changeset(ui, repo, opts, buffe' | |||||
1063 | if opts.get('patch') or opts.get('stat'): |
|
1090 | if opts.get('patch') or opts.get('stat'): | |
1064 | patch = scmutil.matchall(repo) |
|
1091 | patch = scmutil.matchall(repo) | |
1065 |
|
1092 | |||
1066 | tmpl = opts.get('template') |
|
1093 | tmpl, mapfile = gettemplate(ui, opts.get('template'), opts.get('style')) | |
1067 | style = None |
|
|||
1068 | if not tmpl: |
|
|||
1069 | style = opts.get('style') |
|
|||
1070 |
|
1094 | |||
1071 | # ui settings |
|
1095 | if not tmpl and not mapfile: | |
1072 | if not (tmpl or style): |
|
|||
1073 | tmpl = ui.config('ui', 'logtemplate') |
|
|||
1074 | if tmpl: |
|
|||
1075 | try: |
|
|||
1076 | tmpl = templater.parsestring(tmpl) |
|
|||
1077 | except SyntaxError: |
|
|||
1078 | tmpl = templater.parsestring(tmpl, quoted=False) |
|
|||
1079 | else: |
|
|||
1080 | style = util.expandpath(ui.config('ui', 'style', '')) |
|
|||
1081 |
|
||||
1082 | if not (tmpl or style): |
|
|||
1083 | return changeset_printer(ui, repo, patch, opts, buffered) |
|
1096 | return changeset_printer(ui, repo, patch, opts, buffered) | |
1084 |
|
1097 | |||
1085 | mapfile = None |
|
|||
1086 | if style and not tmpl: |
|
|||
1087 | mapfile = style |
|
|||
1088 | if not os.path.split(mapfile)[0]: |
|
|||
1089 | mapname = (templater.templatepath('map-cmdline.' + mapfile) |
|
|||
1090 | or templater.templatepath(mapfile)) |
|
|||
1091 | if mapname: |
|
|||
1092 | mapfile = mapname |
|
|||
1093 |
|
||||
1094 | try: |
|
1098 | try: | |
1095 | t = changeset_templater(ui, repo, patch, opts, mapfile, buffered) |
|
1099 | t = changeset_templater(ui, repo, patch, opts, mapfile, buffered) | |
1096 | except SyntaxError, inst: |
|
1100 | except SyntaxError, inst: |
General Comments 0
You need to be logged in to leave comments.
Login now