Mercurial > hg
diff mercurial/hgweb/webcommands.py @ 37909:7fae76c2c564
hgweb: reuse graph node-related functions from templates
The difference between templatekw.getgraphnode() and webutil.getgraphnode() is
that the latter is not limited to 1 character.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Tue, 08 May 2018 19:00:01 +0800 |
parents | 2095331ff926 |
children | 16c7a6ac8f94 |
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py Tue May 08 17:54:57 2018 +0800 +++ b/mercurial/hgweb/webcommands.py Tue May 08 19:00:01 2018 +0800 @@ -13,7 +13,7 @@ import re from ..i18n import _ -from ..node import hex, nullid, short +from ..node import hex, short from .common import ( ErrorResponse, @@ -1314,24 +1314,6 @@ 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 = [] @@ -1344,7 +1326,7 @@ def jsdata(): return [{'node': pycompat.bytestr(ctx), - 'graphnode': nodecurrent(ctx) + nodesymbol(ctx), + 'graphnode': webutil.getgraphnode(web.repo, ctx), 'vertex': vtx, 'edges': edges} for (id, type, ctx, vtx, edges) in fulltree()]