##// END OF EJS Templates
graphlog: make node symbol templatable by ui.graphnodetemplate option...
Yuya Nishihara -
r27216:8117e2cd default
parent child Browse files
Show More
@@ -2159,11 +2159,31 b' def getlogrevs(repo, pats, opts):'
2159
2159
2160 return revs, expr, filematcher
2160 return revs, expr, filematcher
2161
2161
2162 def _graphnodeformatter(ui, displayer):
2163 spec = ui.config('ui', 'graphnodetemplate')
2164 if not spec:
2165 return templatekw.showgraphnode # fast path for "{graphnode}"
2166
2167 templ = formatter.gettemplater(ui, 'graphnode', spec)
2168 cache = {}
2169 if isinstance(displayer, changeset_templater):
2170 cache = displayer.cache # reuse cache of slow templates
2171 props = templatekw.keywords.copy()
2172 props['templ'] = templ
2173 props['cache'] = cache
2174 def formatnode(repo, ctx):
2175 props['ctx'] = ctx
2176 props['repo'] = repo
2177 props['revcache'] = {}
2178 return templater.stringify(templ('graphnode', **props))
2179 return formatnode
2180
2162 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
2181 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
2163 filematcher=None):
2182 filematcher=None):
2183 formatnode = _graphnodeformatter(ui, displayer)
2164 seen, state = [], graphmod.asciistate()
2184 seen, state = [], graphmod.asciistate()
2165 for rev, type, ctx, parents in dag:
2185 for rev, type, ctx, parents in dag:
2166 char = templatekw.showgraphnode(repo, ctx)
2186 char = formatnode(repo, ctx)
2167 copies = None
2187 copies = None
2168 if getrenamed and ctx.rev():
2188 if getrenamed and ctx.rev():
2169 copies = []
2189 copies = []
@@ -1454,6 +1454,10 b' User interface controls.'
1454 Encoding to try if it's not possible to decode the changelog using
1454 Encoding to try if it's not possible to decode the changelog using
1455 UTF-8. (default: ISO-8859-1)
1455 UTF-8. (default: ISO-8859-1)
1456
1456
1457 ``graphnodetemplate``
1458 The template used to print changeset nodes in an ASCII revision graph.
1459 (default: ``{graphnode}``)
1460
1457 ``ignore``
1461 ``ignore``
1458 A file to read per-user ignore patterns from. This file should be
1462 A file to read per-user ignore patterns from. This file should be
1459 in the same format as a repository-wide .hgignore file. Filenames
1463 in the same format as a repository-wide .hgignore file. Filenames
@@ -2400,4 +2400,25 b' working-directory revision'
2400 @ 3:5918b8d165d1
2400 @ 3:5918b8d165d1
2401 |
2401 |
2402
2402
2403 node template with changeset_printer:
2404
2405 $ hg log -Gqr 5:7 --config ui.graphnodetemplate='{rev}'
2406 7 7:02dbb8e276b8
2407 |
2408 6 6:fc281d8ff18d
2409 |\
2410 5 | 5:99b31f1c2782
2411 | |
2412
2413 node template with changeset_templater (shared cache variable):
2414
2415 $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \
2416 > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}'
2417 o 7 foo-bar+1
2418 |
2419 # 6 foo-bar+0
2420 |\
2421 o | 5 null+5
2422 | |
2423
2403 $ cd ..
2424 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now