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