changeset 37908:8808d5d401ee

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.
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 08 May 2018 17:54:57 +0800
parents 3b3d818bde8b
children 7fae76c2c564
files mercurial/templatekw.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatekw.py	Mon Apr 02 00:06:39 2018 +0900
+++ b/mercurial/templatekw.py	Tue May 08 17:54:57 2018 +0800
@@ -392,12 +392,19 @@
     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 '*'