Mercurial > public > mercurial-scm > hg-stable
diff mercurial/templatekw.py @ 27214:60af96494a76
graphlog: extract "graphnode" template keyword that represents node symbol
This provides a default node symbol. Tests will be added later.
"showparents" variable is renamed to "wpnodes" to avoid confusion with the
existing showparents() function.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 14 Nov 2015 16:58:18 +0900 |
parents | 8a732c322ca7 |
children | 5b8da5643a8a |
line wrap: on
line diff
--- a/mercurial/templatekw.py Sat Nov 14 16:45:15 2015 +0900 +++ b/mercurial/templatekw.py Sat Nov 14 16:58:18 2015 +0900 @@ -340,6 +340,19 @@ """ return showlist('file', args['ctx'].files(), **args) +def showgraphnode(repo, ctx, **args): + """:graphnode: String. The character representing the changeset node in + an ASCII revision graph""" + wpnodes = [pctx.node() for pctx in repo[None].parents()] + if ctx.node() in wpnodes: + return '@' + elif ctx.obsolete(): + return 'x' + elif ctx.closesbranch(): + return '_' + else: + return 'o' + def showlatesttag(**args): """:latesttag: List of strings. The global tags on the most recent globally tagged ancestor of this changeset. @@ -518,6 +531,7 @@ 'file_dels': showfiledels, 'file_mods': showfilemods, 'files': showfiles, + 'graphnode': showgraphnode, 'latesttag': showlatesttag, 'latesttagdistance': showlatesttagdistance, 'manifest': showmanifest,