Mercurial > public > mercurial-scm > hg-stable
diff mercurial/templatekw.py @ 44379:14d0e89520a2
graphlog: use '%' for other context in merge conflict
This lets the user more easily find the commit that is involved in the
conflict, such as the source of `hg update -m` or the commit being
grafted by `hg graft`.
Differential Revision: https://phab.mercurial-scm.org/D8043
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 28 Jan 2020 21:49:50 -0800 |
parents | d783f945a701 |
children | fc1fa3a07af6 |
line wrap: on
line diff
--- a/mercurial/templatekw.py Wed Jan 29 14:42:54 2020 -0800 +++ b/mercurial/templatekw.py Tue Jan 28 21:49:50 2020 -0800 @@ -396,26 +396,38 @@ return templateutil.compatfileslist(context, mapping, b'file', ctx.files()) -@templatekeyword(b'graphnode', requires={b'repo', b'ctx'}) +@templatekeyword(b'graphnode', requires={b'repo', b'ctx', b'cache'}) def showgraphnode(context, mapping): """String. The character representing the changeset node in an ASCII revision graph.""" repo = context.resource(mapping, b'repo') ctx = context.resource(mapping, b'ctx') - return getgraphnode(repo, ctx) + cache = context.resource(mapping, b'cache') + return getgraphnode(repo, ctx, cache) -def getgraphnode(repo, ctx): - return getgraphnodecurrent(repo, ctx) or getgraphnodesymbol(ctx) +def getgraphnode(repo, ctx, cache): + return getgraphnodecurrent(repo, ctx, cache) or getgraphnodesymbol(ctx) -def getgraphnodecurrent(repo, ctx): +def getgraphnodecurrent(repo, ctx, cache): wpnodes = repo.dirstate.parents() if wpnodes[1] == nullid: wpnodes = wpnodes[:1] if ctx.node() in wpnodes: return b'@' else: + merge_nodes = cache.get(b'merge_nodes', ()) + if not merge_nodes: + from . import merge + + mergestate = merge.mergestate.read(repo) + if mergestate.active(): + merge_nodes = (mergestate.local, mergestate.other) + cache[b'merge_nodes'] = merge_nodes + + if ctx.node() in merge_nodes: + return b'%' return b''