comparison mercurial/hgweb/webcommands.py @ 31727:6be6e4becaaf

hgweb: prefix line id by ctx shortnode in filelog when patches are shown When "patch" query parameter is present in requests to filelog view, line ids in patches diff are no longer unique in the page since several patches are shown on the same page. We now prefix line id by changeset shortnode when several patches are displayed in the same page to have unique line ids overall.
author Denis Laxalde <denis@laxalde.org>
date Thu, 30 Mar 2017 21:40:10 +0200
parents e540846c67e0
children 604d31507f86
comparison
equal deleted inserted replaced
31726:bdb72dd3957e 31727:6be6e4becaaf
996 def diff(fctx, linerange=None): 996 def diff(fctx, linerange=None):
997 ctx = fctx.changectx() 997 ctx = fctx.changectx()
998 basectx = ctx.p1() 998 basectx = ctx.p1()
999 path = fctx.path() 999 path = fctx.path()
1000 return webutil.diffs(web, tmpl, ctx, basectx, [path], diffstyle, 1000 return webutil.diffs(web, tmpl, ctx, basectx, [path], diffstyle,
1001 linerange=linerange) 1001 linerange=linerange,
1002 lineidprefix='%s-' % ctx.hex()[:12])
1002 1003
1003 linerange = None 1004 linerange = None
1004 if lrange is not None: 1005 if lrange is not None:
1005 linerange = webutil.formatlinerange(*lrange) 1006 linerange = webutil.formatlinerange(*lrange)
1006 # deactivate numeric nav links when linerange is specified as this 1007 # deactivate numeric nav links when linerange is specified as this