Mercurial > hg
changeset 6249:cf1fa60fdaf4
hgweb_mod: add branch helper functions to use in templates
author | Florent Guillaume <fg@nuxeo.com> |
---|---|
date | Thu, 13 Mar 2008 23:45:35 +0100 |
parents | b4fca699c33d |
children | bf0dd23f55fa |
files | mercurial/hgweb/hgweb_mod.py |
diffstat | 1 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Thu Mar 13 19:53:02 2008 -0700 +++ b/mercurial/hgweb/hgweb_mod.py Thu Mar 13 23:45:35 2008 +0100 @@ -367,6 +367,20 @@ branches.append({"name": branch}) return branches + def nodeinbranch(self, ctx): + branches = [] + branch = ctx.branch() + if branch != 'default' and self.repo.branchtags().get(branch) != ctx.node(): + branches.append({"name": branch}) + return branches + + def nodebranchnodefault(self, ctx): + branches = [] + branch = ctx.branch() + if branch != 'default': + branches.append({"name": branch}) + return branches + def showtag(self, tmpl, t1, node=nullid, **args): for t in self.repo.nodetags(node): yield tmpl(t1, tag=t, **args) @@ -458,6 +472,7 @@ "rev": i, "node": hex(n), "tags": self.nodetagsdict(n), + "inbranch": self.nodeinbranch(ctx), "branches": self.nodebranchdict(ctx)}) if limit > 0: @@ -529,6 +544,7 @@ rev=ctx.rev(), node=hex(n), tags=self.nodetagsdict(n), + inbranch=self.nodeinbranch(ctx), branches=self.nodebranchdict(ctx)) if count >= self.maxchanges: @@ -572,6 +588,8 @@ files=files, archives=self.archivelist(hex(n)), tags=self.nodetagsdict(n), + branch=self.nodebranchnodefault(ctx), + inbranch=self.nodeinbranch(ctx), branches=self.nodebranchdict(ctx)) def filelog(self, tmpl, fctx): @@ -642,6 +660,7 @@ author=fctx.user(), date=fctx.date(), desc=fctx.description(), + branch=self.nodebranchnodefault(fctx), parent=self.siblings(fctx.parents()), child=self.siblings(fctx.children()), rename=self.renamelink(fl, n), @@ -689,6 +708,7 @@ date=fctx.date(), desc=fctx.description(), rename=self.renamelink(fl, n), + branch=self.nodebranchnodefault(fctx), parent=self.siblings(fctx.parents()), child=self.siblings(fctx.children()), permissions=fctx.manifest().flags(f)) @@ -757,6 +777,7 @@ dentries=dirlist, archives=self.archivelist(hex(node)), tags=self.nodetagsdict(node), + inbranch=self.nodeinbranch(ctx), branches=self.nodebranchdict(ctx)) def tags(self, tmpl): @@ -837,6 +858,7 @@ rev=i, node=hn, tags=self.nodetagsdict(n), + inbranch=self.nodeinbranch(ctx), branches=self.nodebranchdict(ctx))) yield l @@ -869,6 +891,7 @@ file=path, node=hex(n), rev=fctx.rev(), + branch=self.nodebranchnodefault(fctx), parent=self.siblings(parents), child=self.siblings(fctx.children()), diff=diff)