comparison mercurial/hgweb/webcommands.py @ 17991:d605a82cf189

hgweb: display diff for a changeset against any parents (issue2810) During merge of branches, it is useful to compare merge results against the two parents. This change adds this support to hgweb. To specify which parent to compare to, use rev/12300:12345 where 12300 is a parent changeset number. Two links are added to changeset web page so that one can choose which parent to compare to.
author Weiwen <weiwen@fb.com>
date Mon, 12 Nov 2012 14:05:39 -0800
parents 8243dd66e0e3
children c8326ffdcb4f
comparison
equal deleted inserted replaced
17990:8216eb592dcd 17991:d605a82cf189
254 def shortlog(web, req, tmpl): 254 def shortlog(web, req, tmpl):
255 return changelog(web, req, tmpl, shortlog = True) 255 return changelog(web, req, tmpl, shortlog = True)
256 256
257 def changeset(web, req, tmpl): 257 def changeset(web, req, tmpl):
258 ctx = webutil.changectx(web.repo, req) 258 ctx = webutil.changectx(web.repo, req)
259 basectx = webutil.basechangectx(web.repo, req)
260 if basectx is None:
261 basectx = ctx.p1()
259 showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node()) 262 showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node())
260 showbookmarks = webutil.showbookmark(web.repo, tmpl, 'changesetbookmark', 263 showbookmarks = webutil.showbookmark(web.repo, tmpl, 'changesetbookmark',
261 ctx.node()) 264 ctx.node())
262 showbranch = webutil.nodebranchnodefault(ctx) 265 showbranch = webutil.nodebranchnodefault(ctx)
263 266
272 style = web.config('web', 'style', 'paper') 275 style = web.config('web', 'style', 'paper')
273 if 'style' in req.form: 276 if 'style' in req.form:
274 style = req.form['style'][0] 277 style = req.form['style'][0]
275 278
276 parity = paritygen(web.stripecount) 279 parity = paritygen(web.stripecount)
277 diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity, style) 280 diffs = webutil.diffs(web.repo, tmpl, ctx, basectx, None, parity, style)
278 281
279 parity = paritygen(web.stripecount) 282 parity = paritygen(web.stripecount)
280 diffstatgen = webutil.diffstatgen(ctx) 283 diffstatgen = webutil.diffstatgen(ctx, basectx)
281 diffstat = webutil.diffstat(tmpl, ctx, diffstatgen, parity) 284 diffstat = webutil.diffstat(tmpl, ctx, diffstatgen, parity)
282 285
283 return tmpl('changeset', 286 return tmpl('changeset',
284 diff=diffs, 287 diff=diffs,
285 rev=ctx.rev(), 288 rev=ctx.rev(),
286 node=ctx.hex(), 289 node=ctx.hex(),
287 parent=webutil.parents(ctx), 290 parent=webutil.parents(ctx),
288 child=webutil.children(ctx), 291 child=webutil.children(ctx),
292 currentbaseline=basectx.hex(),
289 changesettag=showtags, 293 changesettag=showtags,
290 changesetbookmark=showbookmarks, 294 changesetbookmark=showbookmarks,
291 changesetbranch=showbranch, 295 changesetbranch=showbranch,
292 author=ctx.user(), 296 author=ctx.user(),
293 desc=ctx.description(), 297 desc=ctx.description(),
565 parity = paritygen(web.stripecount) 569 parity = paritygen(web.stripecount)
566 style = web.config('web', 'style', 'paper') 570 style = web.config('web', 'style', 'paper')
567 if 'style' in req.form: 571 if 'style' in req.form:
568 style = req.form['style'][0] 572 style = req.form['style'][0]
569 573
570 diffs = webutil.diffs(web.repo, tmpl, ctx, [path], parity, style) 574 diffs = webutil.diffs(web.repo, tmpl, ctx, None, [path], parity, style)
571 rename = fctx and webutil.renamelink(fctx) or [] 575 rename = fctx and webutil.renamelink(fctx) or []
572 ctx = fctx and fctx or ctx 576 ctx = fctx and fctx or ctx
573 return tmpl("filediff", 577 return tmpl("filediff",
574 file=path, 578 file=path,
575 node=hex(n), 579 node=hex(n),