comparison mercurial/hgweb/webcommands.py @ 6434:62e0bb41e682

hgweb: minor improvements for new web style - make renamelink take a context - pass current node to shortlog page rather than tip - pass user/desc/date/rename to filediff - improve template error reporting for foo%bar
author Matt Mackall <mpm@selenic.com>
date Mon, 31 Mar 2008 21:49:33 -0500
parents 644a56c7ae79
children 101526031d06
comparison
equal deleted inserted replaced
6433:ec5d77eb3431 6434:62e0bb41e682
83 date=fctx.date(), 83 date=fctx.date(),
84 desc=fctx.description(), 84 desc=fctx.description(),
85 branch=webutil.nodebranchnodefault(fctx), 85 branch=webutil.nodebranchnodefault(fctx),
86 parent=webutil.siblings(fctx.parents()), 86 parent=webutil.siblings(fctx.parents()),
87 child=webutil.siblings(fctx.children()), 87 child=webutil.siblings(fctx.children()),
88 rename=webutil.renamelink(fl, n), 88 rename=webutil.renamelink(fctx),
89 permissions=fctx.manifest().flags(f)) 89 permissions=fctx.manifest().flags(f))
90 90
91 def file(web, req, tmpl): 91 def file(web, req, tmpl):
92 path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0]) 92 path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0])
93 if path: 93 if path:
213 213
214 changenav = webutil.revnavgen(pos, maxchanges, count, web.repo.changectx) 214 changenav = webutil.revnavgen(pos, maxchanges, count, web.repo.changectx)
215 215
216 return tmpl(shortlog and 'shortlog' or 'changelog', 216 return tmpl(shortlog and 'shortlog' or 'changelog',
217 changenav=changenav, 217 changenav=changenav,
218 node=hex(cl.tip()), 218 node=hex(ctx.node()),
219 rev=pos, changesets=count, 219 rev=pos, changesets=count,
220 entries=lambda **x: changelist(limit=0,**x), 220 entries=lambda **x: changelist(limit=0,**x),
221 latestentry=lambda **x: changelist(limit=1,**x), 221 latestentry=lambda **x: changelist(limit=1,**x),
222 archives=web.archivelist("tip")) 222 archives=web.archivelist("tip"))
223 223
433 diffs = web.diff(tmpl, p1, n, [path]) 433 diffs = web.diff(tmpl, p1, n, [path])
434 return tmpl("filediff", 434 return tmpl("filediff",
435 file=path, 435 file=path,
436 node=hex(n), 436 node=hex(n),
437 rev=fctx.rev(), 437 rev=fctx.rev(),
438 date=fctx.date(),
439 desc=fctx.description(),
440 author=fctx.user(),
441 rename=self.renamelink(fctx),
438 branch=webutil.nodebranchnodefault(fctx), 442 branch=webutil.nodebranchnodefault(fctx),
439 parent=webutil.siblings(parents), 443 parent=webutil.siblings(parents),
440 child=webutil.siblings(fctx.children()), 444 child=webutil.siblings(fctx.children()),
441 diff=diffs) 445 diff=diffs)
442 446
482 rev=fctx.rev(), 486 rev=fctx.rev(),
483 node=hex(fctx.node()), 487 node=hex(fctx.node()),
484 author=fctx.user(), 488 author=fctx.user(),
485 date=fctx.date(), 489 date=fctx.date(),
486 desc=fctx.description(), 490 desc=fctx.description(),
487 rename=webutil.renamelink(fl, n), 491 rename=webutil.renamelink(fctx),
488 branch=webutil.nodebranchnodefault(fctx), 492 branch=webutil.nodebranchnodefault(fctx),
489 parent=webutil.siblings(fctx.parents()), 493 parent=webutil.siblings(fctx.parents()),
490 child=webutil.siblings(fctx.children()), 494 child=webutil.siblings(fctx.children()),
491 permissions=fctx.manifest().flags(f)) 495 permissions=fctx.manifest().flags(f))
492 496
513 "filerev": i, 517 "filerev": i,
514 "file": f, 518 "file": f,
515 "node": hex(ctx.node()), 519 "node": hex(ctx.node()),
516 "author": ctx.user(), 520 "author": ctx.user(),
517 "date": ctx.date(), 521 "date": ctx.date(),
518 "rename": webutil.renamelink(fl, n), 522 "rename": webutil.renamelink(fctx),
519 "parent": webutil.siblings(fctx.parents()), 523 "parent": webutil.siblings(fctx.parents()),
520 "child": webutil.siblings(fctx.children()), 524 "child": webutil.siblings(fctx.children()),
521 "desc": ctx.description()}) 525 "desc": ctx.description()})
522 526
523 if limit > 0: 527 if limit > 0: