##// END OF EJS Templates
hgweb: reuse graph node-related functions from templates...
av6 -
r37928:7fae76c2 @29 default
parent child Browse files
Show More
@@ -13,7 +13,7 b' import os'
13 import re
13 import re
14
14
15 from ..i18n import _
15 from ..i18n import _
16 from ..node import hex, nullid, short
16 from ..node import hex, short
17
17
18 from .common import (
18 from .common import (
19 ErrorResponse,
19 ErrorResponse,
@@ -1314,24 +1314,6 b' def graph(web):'
1314 tree = list(item for item in graphmod.colored(dag, web.repo)
1314 tree = list(item for item in graphmod.colored(dag, web.repo)
1315 if item[1] == graphmod.CHANGESET)
1315 if item[1] == graphmod.CHANGESET)
1316
1316
1317 def nodecurrent(ctx):
1318 wpnodes = web.repo.dirstate.parents()
1319 if wpnodes[1] == nullid:
1320 wpnodes = wpnodes[:1]
1321 if ctx.node() in wpnodes:
1322 return '@'
1323 return ''
1324
1325 def nodesymbol(ctx):
1326 if ctx.obsolete():
1327 return 'x'
1328 elif ctx.isunstable():
1329 return '*'
1330 elif ctx.closesbranch():
1331 return '_'
1332 else:
1333 return 'o'
1334
1335 def fulltree():
1317 def fulltree():
1336 pos = web.repo[graphtop].rev()
1318 pos = web.repo[graphtop].rev()
1337 tree = []
1319 tree = []
@@ -1344,7 +1326,7 b' def graph(web):'
1344
1326
1345 def jsdata():
1327 def jsdata():
1346 return [{'node': pycompat.bytestr(ctx),
1328 return [{'node': pycompat.bytestr(ctx),
1347 'graphnode': nodecurrent(ctx) + nodesymbol(ctx),
1329 'graphnode': webutil.getgraphnode(web.repo, ctx),
1348 'vertex': vtx,
1330 'vertex': vtx,
1349 'edges': edges}
1331 'edges': edges}
1350 for (id, type, ctx, vtx, edges) in fulltree()]
1332 for (id, type, ctx, vtx, edges) in fulltree()]
@@ -733,3 +733,7 b' def getwebsubs(repo):'
733 repo.ui.warn(_("websub: invalid regexp for %s: %s\n")
733 repo.ui.warn(_("websub: invalid regexp for %s: %s\n")
734 % (key, regexp))
734 % (key, regexp))
735 return websubtable
735 return websubtable
736
737 def getgraphnode(repo, ctx):
738 return (templatekw.getgraphnodecurrent(repo, ctx) +
739 templatekw.getgraphnodesymbol(ctx))
General Comments 0
You need to be logged in to leave comments. Login now