comparison mercurial/hgweb/webcommands.py @ 16722:7bf48bc7de23 stable

hgweb: fix filediff base calculation Previously, we were finding the most recent version of a file in a changeset and comparing it against its first file parent. This was wrong on three counts: - it would show a diff in revisions where there was no change to a file - it would show a diff when only the exec bit changed - it would potentially compare against a much older changeset, which could be very expensive if git-style rename detection was enabled This compares the file in the current context with that context's parent, which may result in an empty diff when looking at a file not touched by the current changeset.
author Matt Mackall <mpm@selenic.com>
date Mon, 14 May 2012 12:56:43 +0200
parents dd68c972d089
children 3e24ce3de5f1
comparison
equal deleted inserted replaced
16717:1eede2ea2041 16722:7bf48bc7de23
556 raise 556 raise
557 557
558 if fctx is not None: 558 if fctx is not None:
559 n = fctx.node() 559 n = fctx.node()
560 path = fctx.path() 560 path = fctx.path()
561 ctx = fctx.changectx()
561 else: 562 else:
562 n = ctx.node() 563 n = ctx.node()
563 # path already defined in except clause 564 # path already defined in except clause
564 565
565 parity = paritygen(web.stripecount) 566 parity = paritygen(web.stripecount)
566 style = web.config('web', 'style', 'paper') 567 style = web.config('web', 'style', 'paper')
567 if 'style' in req.form: 568 if 'style' in req.form:
568 style = req.form['style'][0] 569 style = req.form['style'][0]
569 570
570 diffs = webutil.diffs(web.repo, tmpl, fctx or ctx, [path], parity, style) 571 diffs = webutil.diffs(web.repo, tmpl, ctx, [path], parity, style)
571 rename = fctx and webutil.renamelink(fctx) or [] 572 rename = fctx and webutil.renamelink(fctx) or []
572 ctx = fctx and fctx or ctx 573 ctx = fctx and fctx or ctx
573 return tmpl("filediff", 574 return tmpl("filediff",
574 file=path, 575 file=path,
575 node=hex(n), 576 node=hex(n),