Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/webcommands.py @ 31667:e540846c67e0
hgweb: filter diff hunks when 'linerange' and 'patch' are specified in filelog
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Mon, 13 Mar 2017 15:17:20 +0100 |
parents | 5e6d44511317 |
children | 6be6e4becaaf |
comparison
equal
deleted
inserted
replaced
31666:aaebc80c9f1d | 31667:e540846c67e0 |
---|---|
991 | 991 |
992 diffstyle = web.config('web', 'style', 'paper') | 992 diffstyle = web.config('web', 'style', 'paper') |
993 if 'style' in req.form: | 993 if 'style' in req.form: |
994 diffstyle = req.form['style'][0] | 994 diffstyle = req.form['style'][0] |
995 | 995 |
996 def diff(fctx): | 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 | 1002 |
1002 linerange = None | 1003 linerange = None |
1003 if lrange is not None: | 1004 if lrange is not None: |
1004 linerange = webutil.formatlinerange(*lrange) | 1005 linerange = webutil.formatlinerange(*lrange) |
1005 # deactivate numeric nav links when linerange is specified as this | 1006 # deactivate numeric nav links when linerange is specified as this |
1007 nav = None | 1008 nav = None |
1008 ancestors = context.blockancestors(fctx, *lrange) | 1009 ancestors = context.blockancestors(fctx, *lrange) |
1009 for i, (c, lr) in enumerate(ancestors, 1): | 1010 for i, (c, lr) in enumerate(ancestors, 1): |
1010 diffs = None | 1011 diffs = None |
1011 if patch: | 1012 if patch: |
1012 diffs = diff(c) | 1013 diffs = diff(c, linerange=lr) |
1013 # follow renames accross filtered (not in range) revisions | 1014 # follow renames accross filtered (not in range) revisions |
1014 path = c.path() | 1015 path = c.path() |
1015 entries.append(dict( | 1016 entries.append(dict( |
1016 parity=next(parity), | 1017 parity=next(parity), |
1017 filerev=c.rev(), | 1018 filerev=c.rev(), |