##// END OF EJS Templates
hgweb_mod: add branch helper functions to use in templates
Florent Guillaume -
r6249:cf1fa60f default
parent child Browse files
Show More
@@ -367,6 +367,20 b' class hgweb(object):'
367 branches.append({"name": branch})
367 branches.append({"name": branch})
368 return branches
368 return branches
369
369
370 def nodeinbranch(self, ctx):
371 branches = []
372 branch = ctx.branch()
373 if branch != 'default' and self.repo.branchtags().get(branch) != ctx.node():
374 branches.append({"name": branch})
375 return branches
376
377 def nodebranchnodefault(self, ctx):
378 branches = []
379 branch = ctx.branch()
380 if branch != 'default':
381 branches.append({"name": branch})
382 return branches
383
370 def showtag(self, tmpl, t1, node=nullid, **args):
384 def showtag(self, tmpl, t1, node=nullid, **args):
371 for t in self.repo.nodetags(node):
385 for t in self.repo.nodetags(node):
372 yield tmpl(t1, tag=t, **args)
386 yield tmpl(t1, tag=t, **args)
@@ -458,6 +472,7 b' class hgweb(object):'
458 "rev": i,
472 "rev": i,
459 "node": hex(n),
473 "node": hex(n),
460 "tags": self.nodetagsdict(n),
474 "tags": self.nodetagsdict(n),
475 "inbranch": self.nodeinbranch(ctx),
461 "branches": self.nodebranchdict(ctx)})
476 "branches": self.nodebranchdict(ctx)})
462
477
463 if limit > 0:
478 if limit > 0:
@@ -529,6 +544,7 b' class hgweb(object):'
529 rev=ctx.rev(),
544 rev=ctx.rev(),
530 node=hex(n),
545 node=hex(n),
531 tags=self.nodetagsdict(n),
546 tags=self.nodetagsdict(n),
547 inbranch=self.nodeinbranch(ctx),
532 branches=self.nodebranchdict(ctx))
548 branches=self.nodebranchdict(ctx))
533
549
534 if count >= self.maxchanges:
550 if count >= self.maxchanges:
@@ -572,6 +588,8 b' class hgweb(object):'
572 files=files,
588 files=files,
573 archives=self.archivelist(hex(n)),
589 archives=self.archivelist(hex(n)),
574 tags=self.nodetagsdict(n),
590 tags=self.nodetagsdict(n),
591 branch=self.nodebranchnodefault(ctx),
592 inbranch=self.nodeinbranch(ctx),
575 branches=self.nodebranchdict(ctx))
593 branches=self.nodebranchdict(ctx))
576
594
577 def filelog(self, tmpl, fctx):
595 def filelog(self, tmpl, fctx):
@@ -642,6 +660,7 b' class hgweb(object):'
642 author=fctx.user(),
660 author=fctx.user(),
643 date=fctx.date(),
661 date=fctx.date(),
644 desc=fctx.description(),
662 desc=fctx.description(),
663 branch=self.nodebranchnodefault(fctx),
645 parent=self.siblings(fctx.parents()),
664 parent=self.siblings(fctx.parents()),
646 child=self.siblings(fctx.children()),
665 child=self.siblings(fctx.children()),
647 rename=self.renamelink(fl, n),
666 rename=self.renamelink(fl, n),
@@ -689,6 +708,7 b' class hgweb(object):'
689 date=fctx.date(),
708 date=fctx.date(),
690 desc=fctx.description(),
709 desc=fctx.description(),
691 rename=self.renamelink(fl, n),
710 rename=self.renamelink(fl, n),
711 branch=self.nodebranchnodefault(fctx),
692 parent=self.siblings(fctx.parents()),
712 parent=self.siblings(fctx.parents()),
693 child=self.siblings(fctx.children()),
713 child=self.siblings(fctx.children()),
694 permissions=fctx.manifest().flags(f))
714 permissions=fctx.manifest().flags(f))
@@ -757,6 +777,7 b' class hgweb(object):'
757 dentries=dirlist,
777 dentries=dirlist,
758 archives=self.archivelist(hex(node)),
778 archives=self.archivelist(hex(node)),
759 tags=self.nodetagsdict(node),
779 tags=self.nodetagsdict(node),
780 inbranch=self.nodeinbranch(ctx),
760 branches=self.nodebranchdict(ctx))
781 branches=self.nodebranchdict(ctx))
761
782
762 def tags(self, tmpl):
783 def tags(self, tmpl):
@@ -837,6 +858,7 b' class hgweb(object):'
837 rev=i,
858 rev=i,
838 node=hn,
859 node=hn,
839 tags=self.nodetagsdict(n),
860 tags=self.nodetagsdict(n),
861 inbranch=self.nodeinbranch(ctx),
840 branches=self.nodebranchdict(ctx)))
862 branches=self.nodebranchdict(ctx)))
841
863
842 yield l
864 yield l
@@ -869,6 +891,7 b' class hgweb(object):'
869 file=path,
891 file=path,
870 node=hex(n),
892 node=hex(n),
871 rev=fctx.rev(),
893 rev=fctx.rev(),
894 branch=self.nodebranchnodefault(fctx),
872 parent=self.siblings(parents),
895 parent=self.siblings(parents),
873 child=self.siblings(fctx.children()),
896 child=self.siblings(fctx.children()),
874 diff=diff)
897 diff=diff)
General Comments 0
You need to be logged in to leave comments. Login now