mercurial/hgweb/webcommands.py
changeset 35566 baca93a47992
parent 35530 acd8a2454b47
child 36248 0ef50a5e3ae1
--- a/mercurial/hgweb/webcommands.py	Thu Dec 21 13:58:11 2017 +0100
+++ b/mercurial/hgweb/webcommands.py	Tue Dec 19 20:41:25 2017 +0800
@@ -13,7 +13,7 @@
 import re
 
 from ..i18n import _
-from ..node import hex, short
+from ..node import hex, nullid, short
 
 from .common import (
     ErrorResponse,
@@ -1248,6 +1248,24 @@
         tree = list(item for item in graphmod.colored(dag, web.repo)
                     if item[1] == graphmod.CHANGESET)
 
+    def nodecurrent(ctx):
+        wpnodes = web.repo.dirstate.parents()
+        if wpnodes[1] == nullid:
+            wpnodes = wpnodes[:1]
+        if ctx.node() in wpnodes:
+            return '@'
+        return ''
+
+    def nodesymbol(ctx):
+        if ctx.obsolete():
+            return 'x'
+        elif ctx.isunstable():
+            return '*'
+        elif ctx.closesbranch():
+            return '_'
+        else:
+            return 'o'
+
     def fulltree():
         pos = web.repo[graphtop].rev()
         tree = []
@@ -1260,6 +1278,7 @@
 
     def jsdata():
         return [{'node': pycompat.bytestr(ctx),
+                 'graphnode': nodecurrent(ctx) + nodesymbol(ctx),
                  'vertex': vtx,
                  'edges': edges}
                 for (id, type, ctx, vtx, edges) in fulltree()]