Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 14055:421d56a055fd
drop {short,hex}(ctx.node()) calls in favor of ctx methods
author | Alexander Solovyov <alexander@solovyov.net> |
---|---|
date | Sat, 30 Apr 2011 12:55:07 +0200 |
parents | 1c1e1232abdc |
children | 1d3e2349304a |
comparison
equal
deleted
inserted
replaced
14054:3c616f512a5b | 14055:421d56a055fd |
---|---|
78 return tmpl("filerevision", | 78 return tmpl("filerevision", |
79 file=f, | 79 file=f, |
80 path=webutil.up(f), | 80 path=webutil.up(f), |
81 text=lines(), | 81 text=lines(), |
82 rev=fctx.rev(), | 82 rev=fctx.rev(), |
83 node=hex(fctx.node()), | 83 node=fctx.hex(), |
84 author=fctx.user(), | 84 author=fctx.user(), |
85 date=fctx.date(), | 85 date=fctx.date(), |
86 desc=fctx.description(), | 86 desc=fctx.description(), |
87 branch=webutil.nodebranchnodefault(fctx), | 87 branch=webutil.nodebranchnodefault(fctx), |
88 parent=webutil.parents(fctx), | 88 parent=webutil.parents(fctx), |
237 parity = paritygen(web.stripecount, offset=start - end) | 237 parity = paritygen(web.stripecount, offset=start - end) |
238 | 238 |
239 changenav = webutil.revnavgen(pos, revcount, count, web.repo.changectx) | 239 changenav = webutil.revnavgen(pos, revcount, count, web.repo.changectx) |
240 | 240 |
241 return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav, | 241 return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav, |
242 node=hex(ctx.node()), rev=pos, changesets=count, | 242 node=ctx.hex(), rev=pos, changesets=count, |
243 entries=lambda **x: changelist(limit=0,**x), | 243 entries=lambda **x: changelist(limit=0,**x), |
244 latestentry=lambda **x: changelist(limit=1,**x), | 244 latestentry=lambda **x: changelist(limit=1,**x), |
245 archives=web.archivelist("tip"), revcount=revcount, | 245 archives=web.archivelist("tip"), revcount=revcount, |
246 morevars=morevars, lessvars=lessvars) | 246 morevars=morevars, lessvars=lessvars) |
247 | 247 |
580 | 580 |
581 if last != fnode: | 581 if last != fnode: |
582 last = fnode | 582 last = fnode |
583 | 583 |
584 yield {"parity": parity.next(), | 584 yield {"parity": parity.next(), |
585 "node": hex(f.node()), | 585 "node": f.hex(), |
586 "rev": f.rev(), | 586 "rev": f.rev(), |
587 "author": f.user(), | 587 "author": f.user(), |
588 "desc": f.description(), | 588 "desc": f.description(), |
589 "file": f.path(), | 589 "file": f.path(), |
590 "targetline": targetline, | 590 "targetline": targetline, |
596 return tmpl("fileannotate", | 596 return tmpl("fileannotate", |
597 file=f, | 597 file=f, |
598 annotate=annotate, | 598 annotate=annotate, |
599 path=webutil.up(f), | 599 path=webutil.up(f), |
600 rev=fctx.rev(), | 600 rev=fctx.rev(), |
601 node=hex(fctx.node()), | 601 node=fctx.hex(), |
602 author=fctx.user(), | 602 author=fctx.user(), |
603 date=fctx.date(), | 603 date=fctx.date(), |
604 desc=fctx.description(), | 604 desc=fctx.description(), |
605 rename=webutil.renamelink(fctx), | 605 rename=webutil.renamelink(fctx), |
606 branch=webutil.nodebranchnodefault(fctx), | 606 branch=webutil.nodebranchnodefault(fctx), |
653 iterfctx = fctx.filectx(i) | 653 iterfctx = fctx.filectx(i) |
654 | 654 |
655 l.insert(0, {"parity": parity.next(), | 655 l.insert(0, {"parity": parity.next(), |
656 "filerev": i, | 656 "filerev": i, |
657 "file": f, | 657 "file": f, |
658 "node": hex(iterfctx.node()), | 658 "node": iterfctx.hex(), |
659 "author": iterfctx.user(), | 659 "author": iterfctx.user(), |
660 "date": iterfctx.date(), | 660 "date": iterfctx.date(), |
661 "rename": webutil.renamelink(iterfctx), | 661 "rename": webutil.renamelink(iterfctx), |
662 "parent": webutil.parents(iterfctx), | 662 "parent": webutil.parents(iterfctx), |
663 "child": webutil.children(iterfctx), | 663 "child": webutil.children(iterfctx), |
675 for e in l: | 675 for e in l: |
676 yield e | 676 yield e |
677 | 677 |
678 nodefunc = lambda x: fctx.filectx(fileid=x) | 678 nodefunc = lambda x: fctx.filectx(fileid=x) |
679 nav = webutil.revnavgen(end - 1, revcount, count, nodefunc) | 679 nav = webutil.revnavgen(end - 1, revcount, count, nodefunc) |
680 return tmpl("filelog", file=f, node=hex(fctx.node()), nav=nav, | 680 return tmpl("filelog", file=f, node=fctx.hex(), nav=nav, |
681 entries=lambda **x: entries(limit=0, **x), | 681 entries=lambda **x: entries(limit=0, **x), |
682 latestentry=lambda **x: entries(limit=1, **x), | 682 latestentry=lambda **x: entries(limit=1, **x), |
683 revcount=revcount, morevars=morevars, lessvars=lessvars) | 683 revcount=revcount, morevars=morevars, lessvars=lessvars) |
684 | 684 |
685 def archive(web, req, tmpl): | 685 def archive(web, req, tmpl): |
760 canvasheight = (len(tree) + 1) * bg_height - 27 | 760 canvasheight = (len(tree) + 1) * bg_height - 27 |
761 data = [] | 761 data = [] |
762 for (id, type, ctx, vtx, edges) in tree: | 762 for (id, type, ctx, vtx, edges) in tree: |
763 if type != graphmod.CHANGESET: | 763 if type != graphmod.CHANGESET: |
764 continue | 764 continue |
765 node = short(ctx.node()) | 765 node = str(ctx) |
766 age = templatefilters.age(ctx.date()) | 766 age = templatefilters.age(ctx.date()) |
767 desc = templatefilters.firstline(ctx.description()) | 767 desc = templatefilters.firstline(ctx.description()) |
768 desc = cgi.escape(templatefilters.nonempty(desc)) | 768 desc = cgi.escape(templatefilters.nonempty(desc)) |
769 user = cgi.escape(templatefilters.person(ctx.user())) | 769 user = cgi.escape(templatefilters.person(ctx.user())) |
770 branch = ctx.branch() | 770 branch = ctx.branch() |
788 def help(web, req, tmpl): | 788 def help(web, req, tmpl): |
789 from mercurial import commands # avoid cycle | 789 from mercurial import commands # avoid cycle |
790 | 790 |
791 topicname = req.form.get('node', [None])[0] | 791 topicname = req.form.get('node', [None])[0] |
792 if not topicname: | 792 if not topicname: |
793 topic = [] | |
794 | |
795 def topics(**map): | 793 def topics(**map): |
796 for entries, summary, _ in helpmod.helptable: | 794 for entries, summary, _ in helpmod.helptable: |
797 entries = sorted(entries, key=len) | 795 entries = sorted(entries, key=len) |
798 yield {'topic': entries[-1], 'summary': summary} | 796 yield {'topic': entries[-1], 'summary': summary} |
799 | 797 |