##// END OF EJS Templates
hgweb: just return iterables instead of yielding them
Dirkjan Ochtman -
r5889:20957709 default
parent child Browse files
Show More
@@ -446,13 +446,13 b' class hgweb(object):'
446
446
447 changenav = revnavgen(pos, maxchanges, count, self.repo.changectx)
447 changenav = revnavgen(pos, maxchanges, count, self.repo.changectx)
448
448
449 yield tmpl(shortlog and 'shortlog' or 'changelog',
449 return tmpl(shortlog and 'shortlog' or 'changelog',
450 changenav=changenav,
450 changenav=changenav,
451 node=hex(cl.tip()),
451 node=hex(cl.tip()),
452 rev=pos, changesets=count,
452 rev=pos, changesets=count,
453 entries=lambda **x: changelist(limit=0,**x),
453 entries=lambda **x: changelist(limit=0,**x),
454 latestentry=lambda **x: changelist(limit=1,**x),
454 latestentry=lambda **x: changelist(limit=1,**x),
455 archives=self.archivelist("tip"))
455 archives=self.archivelist("tip"))
456
456
457 def search(self, tmpl, query):
457 def search(self, tmpl, query):
458
458
@@ -505,11 +505,11 b' class hgweb(object):'
505 cl = self.repo.changelog
505 cl = self.repo.changelog
506 parity = paritygen(self.stripecount)
506 parity = paritygen(self.stripecount)
507
507
508 yield tmpl('search',
508 return tmpl('search',
509 query=query,
509 query=query,
510 node=hex(cl.tip()),
510 node=hex(cl.tip()),
511 entries=changelist,
511 entries=changelist,
512 archives=self.archivelist("tip"))
512 archives=self.archivelist("tip"))
513
513
514 def changeset(self, tmpl, ctx):
514 def changeset(self, tmpl, ctx):
515 n = ctx.node()
515 n = ctx.node()
@@ -526,20 +526,20 b' class hgweb(object):'
526 def diff(**map):
526 def diff(**map):
527 yield self.diff(tmpl, p1, n, None)
527 yield self.diff(tmpl, p1, n, None)
528
528
529 yield tmpl('changeset',
529 return tmpl('changeset',
530 diff=diff,
530 diff=diff,
531 rev=ctx.rev(),
531 rev=ctx.rev(),
532 node=hex(n),
532 node=hex(n),
533 parent=self.siblings(parents),
533 parent=self.siblings(parents),
534 child=self.siblings(ctx.children()),
534 child=self.siblings(ctx.children()),
535 changesettag=self.showtag("changesettag",n),
535 changesettag=self.showtag("changesettag",n),
536 author=ctx.user(),
536 author=ctx.user(),
537 desc=ctx.description(),
537 desc=ctx.description(),
538 date=ctx.date(),
538 date=ctx.date(),
539 files=files,
539 files=files,
540 archives=self.archivelist(hex(n)),
540 archives=self.archivelist(hex(n)),
541 tags=self.nodetagsdict(n),
541 tags=self.nodetagsdict(n),
542 branches=self.nodebranchdict(ctx))
542 branches=self.nodebranchdict(ctx))
543
543
544 def filelog(self, tmpl, fctx):
544 def filelog(self, tmpl, fctx):
545 f = fctx.path()
545 f = fctx.path()
@@ -578,9 +578,9 b' class hgweb(object):'
578
578
579 nodefunc = lambda x: fctx.filectx(fileid=x)
579 nodefunc = lambda x: fctx.filectx(fileid=x)
580 nav = revnavgen(pos, pagelen, count, nodefunc)
580 nav = revnavgen(pos, pagelen, count, nodefunc)
581 yield tmpl("filelog", file=f, node=hex(fctx.node()), nav=nav,
581 return tmpl("filelog", file=f, node=hex(fctx.node()), nav=nav,
582 entries=lambda **x: entries(limit=0, **x),
582 entries=lambda **x: entries(limit=0, **x),
583 latestentry=lambda **x: entries(limit=1, **x))
583 latestentry=lambda **x: entries(limit=1, **x))
584
584
585 def filerevision(self, tmpl, fctx):
585 def filerevision(self, tmpl, fctx):
586 f = fctx.path()
586 f = fctx.path()
@@ -602,21 +602,21 b' class hgweb(object):'
602 "linenumber": "% 6d" % (l + 1),
602 "linenumber": "% 6d" % (l + 1),
603 "parity": parity.next()}
603 "parity": parity.next()}
604
604
605 yield tmpl("filerevision",
605 return tmpl("filerevision",
606 file=f,
606 file=f,
607 path=_up(f),
607 path=_up(f),
608 text=lines(),
608 text=lines(),
609 raw=rawtext,
609 raw=rawtext,
610 mimetype=mt,
610 mimetype=mt,
611 rev=fctx.rev(),
611 rev=fctx.rev(),
612 node=hex(fctx.node()),
612 node=hex(fctx.node()),
613 author=fctx.user(),
613 author=fctx.user(),
614 date=fctx.date(),
614 date=fctx.date(),
615 desc=fctx.description(),
615 desc=fctx.description(),
616 parent=self.siblings(fctx.parents()),
616 parent=self.siblings(fctx.parents()),
617 child=self.siblings(fctx.children()),
617 child=self.siblings(fctx.children()),
618 rename=self.renamelink(fl, n),
618 rename=self.renamelink(fl, n),
619 permissions=fctx.manifest().flags(f))
619 permissions=fctx.manifest().flags(f))
620
620
621 def fileannotate(self, tmpl, fctx):
621 def fileannotate(self, tmpl, fctx):
622 f = fctx.path()
622 f = fctx.path()
@@ -640,19 +640,19 b' class hgweb(object):'
640 "file": f.path(),
640 "file": f.path(),
641 "line": l}
641 "line": l}
642
642
643 yield tmpl("fileannotate",
643 return tmpl("fileannotate",
644 file=f,
644 file=f,
645 annotate=annotate,
645 annotate=annotate,
646 path=_up(f),
646 path=_up(f),
647 rev=fctx.rev(),
647 rev=fctx.rev(),
648 node=hex(fctx.node()),
648 node=hex(fctx.node()),
649 author=fctx.user(),
649 author=fctx.user(),
650 date=fctx.date(),
650 date=fctx.date(),
651 desc=fctx.description(),
651 desc=fctx.description(),
652 rename=self.renamelink(fl, n),
652 rename=self.renamelink(fl, n),
653 parent=self.siblings(fctx.parents()),
653 parent=self.siblings(fctx.parents()),
654 child=self.siblings(fctx.children()),
654 child=self.siblings(fctx.children()),
655 permissions=fctx.manifest().flags(f))
655 permissions=fctx.manifest().flags(f))
656
656
657 def manifest(self, tmpl, ctx, path):
657 def manifest(self, tmpl, ctx, path):
658 mf = ctx.manifest()
658 mf = ctx.manifest()
@@ -708,17 +708,17 b' class hgweb(object):'
708 "path": "%s%s" % (abspath, f),
708 "path": "%s%s" % (abspath, f),
709 "basename": f[:-1]}
709 "basename": f[:-1]}
710
710
711 yield tmpl("manifest",
711 return tmpl("manifest",
712 rev=ctx.rev(),
712 rev=ctx.rev(),
713 node=hex(node),
713 node=hex(node),
714 path=abspath,
714 path=abspath,
715 up=_up(abspath),
715 up=_up(abspath),
716 upparity=parity.next(),
716 upparity=parity.next(),
717 fentries=filelist,
717 fentries=filelist,
718 dentries=dirlist,
718 dentries=dirlist,
719 archives=self.archivelist(hex(node)),
719 archives=self.archivelist(hex(node)),
720 tags=self.nodetagsdict(node),
720 tags=self.nodetagsdict(node),
721 branches=self.nodebranchdict(ctx))
721 branches=self.nodebranchdict(ctx))
722
722
723 def tags(self, tmpl):
723 def tags(self, tmpl):
724 i = self.repo.tagslist()
724 i = self.repo.tagslist()
@@ -738,11 +738,11 b' class hgweb(object):'
738 "date": self.repo.changectx(n).date(),
738 "date": self.repo.changectx(n).date(),
739 "node": hex(n)}
739 "node": hex(n)}
740
740
741 yield tmpl("tags",
741 return tmpl("tags",
742 node=hex(self.repo.changelog.tip()),
742 node=hex(self.repo.changelog.tip()),
743 entries=lambda **x: entries(False,0, **x),
743 entries=lambda **x: entries(False,0, **x),
744 entriesnotip=lambda **x: entries(True,0, **x),
744 entriesnotip=lambda **x: entries(True,0, **x),
745 latestentry=lambda **x: entries(True,1, **x))
745 latestentry=lambda **x: entries(True,1, **x))
746
746
747 def summary(self, tmpl):
747 def summary(self, tmpl):
748 i = self.repo.tagslist()
748 i = self.repo.tagslist()
@@ -807,15 +807,15 b' class hgweb(object):'
807 start = max(0, count - self.maxchanges)
807 start = max(0, count - self.maxchanges)
808 end = min(count, start + self.maxchanges)
808 end = min(count, start + self.maxchanges)
809
809
810 yield tmpl("summary",
810 return tmpl("summary",
811 desc=self.config("web", "description", "unknown"),
811 desc=self.config("web", "description", "unknown"),
812 owner=get_contact(self.config) or "unknown",
812 owner=get_contact(self.config) or "unknown",
813 lastchange=cl.read(cl.tip())[2],
813 lastchange=cl.read(cl.tip())[2],
814 tags=tagentries,
814 tags=tagentries,
815 branches=branches,
815 branches=branches,
816 shortlog=changelist,
816 shortlog=changelist,
817 node=hex(cl.tip()),
817 node=hex(cl.tip()),
818 archives=self.archivelist("tip"))
818 archives=self.archivelist("tip"))
819
819
820 def filediff(self, tmpl, fctx):
820 def filediff(self, tmpl, fctx):
821 n = fctx.node()
821 n = fctx.node()
@@ -826,13 +826,13 b' class hgweb(object):'
826 def diff(**map):
826 def diff(**map):
827 yield self.diff(tmpl, p1, n, [path])
827 yield self.diff(tmpl, p1, n, [path])
828
828
829 yield tmpl("filediff",
829 return tmpl("filediff",
830 file=path,
830 file=path,
831 node=hex(n),
831 node=hex(n),
832 rev=fctx.rev(),
832 rev=fctx.rev(),
833 parent=self.siblings(parents),
833 parent=self.siblings(parents),
834 child=self.siblings(fctx.children()),
834 child=self.siblings(fctx.children()),
835 diff=diff)
835 diff=diff)
836
836
837 archive_specs = {
837 archive_specs = {
838 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None),
838 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None),
General Comments 0
You need to be logged in to leave comments. Login now