Show More
@@ -1340,12 +1340,12 b' def _readmapfile(mapfile):' | |||
|
1340 | 1340 | |
|
1341 | 1341 | base = os.path.dirname(mapfile) |
|
1342 | 1342 | conf = config.config(includepaths=templatepaths()) |
|
1343 | conf.read(mapfile) | |
|
1343 | conf.read(mapfile, remap={'': 'templates'}) | |
|
1344 | 1344 | |
|
1345 | 1345 | cache = {} |
|
1346 | 1346 | tmap = {} |
|
1347 | 1347 | |
|
1348 | val = conf.get('', '__base__') | |
|
1348 | val = conf.get('templates', '__base__') | |
|
1349 | 1349 | if val and val[0] not in "'\"": |
|
1350 | 1350 | # treat as a pointer to a base class for this style |
|
1351 | 1351 | path = util.normpath(os.path.join(base, val)) |
@@ -1364,13 +1364,14 b' def _readmapfile(mapfile):' | |||
|
1364 | 1364 | |
|
1365 | 1365 | cache, tmap = _readmapfile(path) |
|
1366 | 1366 | |
|
1367 | for key, val in conf[''].items(): | |
|
1367 | for key, val in conf['templates'].items(): | |
|
1368 | 1368 | if not val: |
|
1369 |
raise error.ParseError(_('missing value'), |
|
|
1369 | raise error.ParseError(_('missing value'), | |
|
1370 | conf.source('templates', key)) | |
|
1370 | 1371 | if val[0] in "'\"": |
|
1371 | 1372 | if val[0] != val[-1]: |
|
1372 | 1373 | raise error.ParseError(_('unmatched quotes'), |
|
1373 | conf.source('', key)) | |
|
1374 | conf.source('templates', key)) | |
|
1374 | 1375 | cache[key] = unquotestring(val) |
|
1375 | 1376 | elif key != '__base__': |
|
1376 | 1377 | val = 'default', val |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | %include map-cmdline.default |
|
2 | 2 | |
|
3 | [templates] | |
|
3 | 4 | changeset = '{cset}{lbisect}{branches}{bookmarks}{tags}{parents}{user}{ldate}{summary}\n' |
|
4 | 5 | changeset_quiet = '{lshortbisect} {rev}:{node|short}\n' |
|
5 | 6 | changeset_verbose = '{cset}{lbisect}{branches}{bookmarks}{tags}{parents}{user}{ldate}{lfiles}{lfile_copies_switch}{description}\n' |
@@ -1,3 +1,4 b'' | |||
|
1 | [templates] | |
|
1 | 2 | header = '{date|shortdate} {author|person} <{author|email}>\n\n' |
|
2 | 3 | header_verbose = '' |
|
3 | 4 | changeset = '\t* {files|stringify|fill68|tabindent}{desc|fill68|tabindent|strip}\n\t[{node|short}]{tags}{branches}\n\n' |
@@ -1,5 +1,7 b'' | |||
|
1 | 1 | # Base templates. Due to name clashes with existing keywords, we have |
|
2 | 2 | # to replace some keywords with 'lkeyword', for 'labelled keyword' |
|
3 | ||
|
4 | [templates] | |
|
3 | 5 | changeset = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{summary}\n' |
|
4 | 6 | changeset_quiet = '{lnode}' |
|
5 | 7 | changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{lfiles}{lfile_copies_switch}{description}\n' |
@@ -1,3 +1,5 b'' | |||
|
1 | 1 | %include map-cmdline.default |
|
2 | ||
|
3 | [templates] | |
|
2 | 4 | changeset = '{cset}{branches}{bookmarks}{tags}{lphase}{parents}{user}{ldate}{summary}\n' |
|
3 | 5 | changeset_verbose = '{cset}{branches}{bookmarks}{tags}{lphase}{parents}{user}{ldate}{lfiles}{lfile_copies_switch}{description}\n' |
@@ -3,6 +3,8 b'' | |||
|
3 | 3 | # piggyback on existing values so color works. |
|
4 | 4 | # * Obsolescence isn't considered for node labels. See _cset_labels in |
|
5 | 5 | # map-cmdline.default. |
|
6 | ||
|
7 | [templates] | |
|
6 | 8 | showbookmarks = '{if(active, "*", " ")} {pad(bookmark, longestbookmarklen + 4)}{shortest(node, nodelen)}\n' |
|
7 | 9 | |
|
8 | 10 | showwork = '{cset_shortnode}{namespaces % cset_namespace} {cset_shortdesc}' |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | %include map-cmdline.default |
|
2 | 2 | |
|
3 | [templates] | |
|
3 | 4 | # Override base templates |
|
4 | 5 | changeset = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{summary}{lfiles}\n' |
|
5 | 6 | changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{description}{lfiles}\n' |
@@ -1,3 +1,4 b'' | |||
|
1 | [templates] | |
|
1 | 2 | docheader = '<?xml version="1.0"?>\n<log>\n' |
|
2 | 3 | docfooter = '</log>\n' |
|
3 | 4 |
@@ -259,6 +259,25 b' Test templates and style maps in files:' | |||
|
259 | 259 | $ hg log -l1 -T./map-simple |
|
260 | 260 | 8 |
|
261 | 261 | |
|
262 | a map file may have [templates] section: | |
|
263 | ||
|
264 | $ cat <<'EOF' > map-simple | |
|
265 | > [templates] | |
|
266 | > changeset = "{rev}\n" | |
|
267 | > EOF | |
|
268 | $ hg log -l1 -T./map-simple | |
|
269 | 8 | |
|
270 | ||
|
271 | so it can be included in hgrc | |
|
272 | ||
|
273 | $ cat <<'EOF' > myhgrc | |
|
274 | > %include map-simple | |
|
275 | > [templates] | |
|
276 | > foo = "{changeset}" | |
|
277 | > EOF | |
|
278 | $ HGRCPATH=./myhgrc hg log -l1 -Tfoo | |
|
279 | 8 | |
|
280 | ||
|
262 | 281 | Test template map inheritance |
|
263 | 282 | |
|
264 | 283 | $ echo "__base__ = map-cmdline.default" > map-simple |
General Comments 0
You need to be logged in to leave comments.
Login now