1069 or templater.templatepath(mapfile)) |
1070 or templater.templatepath(mapfile)) |
1070 if mapname: |
1071 if mapname: |
1071 mapfile = mapname |
1072 mapfile = mapname |
1072 return None, mapfile |
1073 return None, mapfile |
1073 |
1074 |
|
1075 if not tmpl: |
|
1076 return None, None |
|
1077 |
|
1078 # looks like a literal template? |
|
1079 if '{' in tmpl: |
|
1080 return tmpl, None |
|
1081 |
|
1082 # perhaps a stock style? |
|
1083 if not os.path.split(tmpl)[0]: |
|
1084 mapname = (templater.templatepath('map-cmdline.' + tmpl) |
|
1085 or templater.templatepath(tmpl)) |
|
1086 if mapname and os.path.isfile(mapname): |
|
1087 return None, mapname |
|
1088 |
|
1089 # perhaps it's a reference to [templates] |
|
1090 t = ui.config('templates', tmpl) |
|
1091 if t: |
|
1092 try: |
|
1093 tmpl = templater.parsestring(t) |
|
1094 except SyntaxError: |
|
1095 tmpl = templater.parsestring(t, quoted=False) |
|
1096 return tmpl, None |
|
1097 |
|
1098 # perhaps it's a path to a map or a template |
|
1099 if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl): |
|
1100 # is it a mapfile for a style? |
|
1101 if os.path.basename(tmpl).startswith("map-"): |
|
1102 return None, os.path.realpath(tmpl) |
|
1103 tmpl = open(tmpl).read() |
|
1104 return tmpl, None |
|
1105 |
|
1106 # constant string? |
1074 return tmpl, None |
1107 return tmpl, None |
1075 |
1108 |
1076 def show_changeset(ui, repo, opts, buffered=False): |
1109 def show_changeset(ui, repo, opts, buffered=False): |
1077 """show one changeset using template or regular display. |
1110 """show one changeset using template or regular display. |
1078 |
1111 |