mercurial/hgweb/webcommands.py
changeset 24177 f53b7174facf
parent 24114 fafd9a1284cf
child 24306 6ddc86eedc3b
equal deleted inserted replaced
24176:67952dc7a88f 24177:f53b7174facf
   429     The ``changeset`` template is rendered. Contents of the ``changesettag``,
   429     The ``changeset`` template is rendered. Contents of the ``changesettag``,
   430     ``changesetbookmark``, ``filenodelink``, ``filenolink``, and the many
   430     ``changesetbookmark``, ``filenodelink``, ``filenolink``, and the many
   431     templates related to diffs may all be used to produce the output.
   431     templates related to diffs may all be used to produce the output.
   432     """
   432     """
   433     ctx = webutil.changectx(web.repo, req)
   433     ctx = webutil.changectx(web.repo, req)
   434     basectx = webutil.basechangectx(web.repo, req)
   434 
   435     if basectx is None:
   435     return tmpl('changeset', **webutil.changesetentry(web, req, tmpl, ctx))
   436         basectx = ctx.p1()
       
   437     showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node())
       
   438     showbookmarks = webutil.showbookmark(web.repo, tmpl, 'changesetbookmark',
       
   439                                          ctx.node())
       
   440     showbranch = webutil.nodebranchnodefault(ctx)
       
   441 
       
   442     files = []
       
   443     parity = paritygen(web.stripecount)
       
   444     for blockno, f in enumerate(ctx.files()):
       
   445         template = f in ctx and 'filenodelink' or 'filenolink'
       
   446         files.append(tmpl(template,
       
   447                           node=ctx.hex(), file=f, blockno=blockno + 1,
       
   448                           parity=parity.next()))
       
   449 
       
   450     style = web.config('web', 'style', 'paper')
       
   451     if 'style' in req.form:
       
   452         style = req.form['style'][0]
       
   453 
       
   454     parity = paritygen(web.stripecount)
       
   455     diffs = webutil.diffs(web.repo, tmpl, ctx, basectx, None, parity, style)
       
   456 
       
   457     parity = paritygen(web.stripecount)
       
   458     diffstatgen = webutil.diffstatgen(ctx, basectx)
       
   459     diffstat = webutil.diffstat(tmpl, ctx, diffstatgen, parity)
       
   460 
       
   461     return tmpl('changeset',
       
   462                 diff=diffs,
       
   463                 rev=ctx.rev(),
       
   464                 node=ctx.hex(),
       
   465                 parent=tuple(webutil.parents(ctx)),
       
   466                 child=webutil.children(ctx),
       
   467                 basenode=basectx.hex(),
       
   468                 changesettag=showtags,
       
   469                 changesetbookmark=showbookmarks,
       
   470                 changesetbranch=showbranch,
       
   471                 author=ctx.user(),
       
   472                 desc=ctx.description(),
       
   473                 extra=ctx.extra(),
       
   474                 date=ctx.date(),
       
   475                 files=files,
       
   476                 diffsummary=lambda **x: webutil.diffsummary(diffstatgen),
       
   477                 diffstat=diffstat,
       
   478                 archives=web.archivelist(ctx.hex()),
       
   479                 tags=webutil.nodetagsdict(web.repo, ctx.node()),
       
   480                 bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()),
       
   481                 branch=webutil.nodebranchnodefault(ctx),
       
   482                 inbranch=webutil.nodeinbranch(web.repo, ctx),
       
   483                 branches=webutil.nodebranchdict(web.repo, ctx))
       
   484 
   436 
   485 rev = webcommand('rev')(changeset)
   437 rev = webcommand('rev')(changeset)
   486 
   438 
   487 def decodepath(path):
   439 def decodepath(path):
   488     """Hook for mapping a path in the repository to a path in the
   440     """Hook for mapping a path in the repository to a path in the