# HG changeset patch # User Anton Shestakov # Date 2018-05-08 09:54:57 # Node ID 8808d5d401ee6ba544a962f6245a9f97f162b207 # Parent 3b3d818bde8b8bb5a765909685347a871120b90c templates: split getgraphnode() body into two functions getgraphnodecurrent() is checking if the node is currently checked out and getgraphnodesymbol() is checking properties that have more to do with the stored data and the DAG. diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -392,12 +392,19 @@ def showgraphnode(context, mapping): return getgraphnode(repo, ctx) def getgraphnode(repo, ctx): + return getgraphnodecurrent(repo, ctx) or getgraphnodesymbol(ctx) + +def getgraphnodecurrent(repo, ctx): wpnodes = repo.dirstate.parents() if wpnodes[1] == nullid: wpnodes = wpnodes[:1] if ctx.node() in wpnodes: return '@' - elif ctx.obsolete(): + else: + return '' + +def getgraphnodesymbol(ctx): + if ctx.obsolete(): return 'x' elif ctx.isunstable(): return '*'