mercurial/hgweb/webcommands.py
changeset 17202 1ae119269ddc
parent 17146 6b40cc67ceb4
child 17261 c0068b058fcd
equal deleted inserted replaced
17201:afd75476939e 17202:1ae119269ddc
    20 # you're adding a new command, or the new command won't work.
    20 # you're adding a new command, or the new command won't work.
    21 
    21 
    22 __all__ = [
    22 __all__ = [
    23    'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev',
    23    'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev',
    24    'manifest', 'tags', 'bookmarks', 'branches', 'summary', 'filediff', 'diff',
    24    'manifest', 'tags', 'bookmarks', 'branches', 'summary', 'filediff', 'diff',
    25    'annotate', 'filelog', 'archive', 'static', 'graph', 'help',
    25    'comparison', 'annotate', 'filelog', 'archive', 'static', 'graph', 'help',
    26 ]
    26 ]
    27 
    27 
    28 def log(web, req, tmpl):
    28 def log(web, req, tmpl):
    29     if 'file' in req.form and req.form['file'][0]:
    29     if 'file' in req.form and req.form['file'][0]:
    30         return filelog(web, req, tmpl)
    30         return filelog(web, req, tmpl)
   584                 child=webutil.children(ctx),
   584                 child=webutil.children(ctx),
   585                 diff=diffs)
   585                 diff=diffs)
   586 
   586 
   587 diff = filediff
   587 diff = filediff
   588 
   588 
       
   589 def comparison(web, req, tmpl):
       
   590     ctx = webutil.changectx(web.repo, req)
       
   591     path = webutil.cleanpath(web.repo, req.form['file'][0])
       
   592     rename = path in ctx and webutil.renamelink(ctx[path]) or []
       
   593 
       
   594     parsecontext = lambda v: v == 'full' and -1 or int(v)
       
   595     if 'context' in req.form:
       
   596         context = parsecontext(req.form['context'][0])
       
   597     else:
       
   598         context = parsecontext(web.config('web', 'comparisoncontext', '5'))
       
   599 
       
   600     comparison = webutil.compare(tmpl, ctx, path, context)
       
   601     return tmpl('filecomparison',
       
   602                 file=path,
       
   603                 node=hex(ctx.node()),
       
   604                 rev=ctx.rev(),
       
   605                 date=ctx.date(),
       
   606                 desc=ctx.description(),
       
   607                 author=ctx.user(),
       
   608                 rename=rename,
       
   609                 branch=webutil.nodebranchnodefault(ctx),
       
   610                 parent=webutil.parents(ctx),
       
   611                 child=webutil.children(ctx),
       
   612                 comparison=comparison)
       
   613 
   589 def annotate(web, req, tmpl):
   614 def annotate(web, req, tmpl):
   590     fctx = webutil.filectx(web.repo, req)
   615     fctx = webutil.filectx(web.repo, req)
   591     f = fctx.path()
   616     f = fctx.path()
   592     parity = paritygen(web.stripecount)
   617     parity = paritygen(web.stripecount)
   593     diffopts = patch.diffopts(web.repo.ui, untrusted=True, section='annotate')
   618     diffopts = patch.diffopts(web.repo.ui, untrusted=True, section='annotate')