# HG changeset patch # User Brendan Cully # Date 1181585202 25200 # Node ID e6c69a2491ed97d94b1d666e23f64ecf2f917fe4 # Parent 4272ae760bb183ab0a44371b6650cf3af1d75af4 Small cleanups for the new tag code diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -133,15 +133,15 @@ class hgweb(object): return [dict(file=r[0], node=hex(r[1]))] return [] - def taglistdict(self,node): - return [{"name":i} for i in self.repo.nodetags(node)] + def nodetagsdict(self, node): + return [{"name": i} for i in self.repo.nodetags(node)] - def branchlistdict(self,node): - l=[] - for t, tn in self.repo.branchtags().items(): - if tn == node: - l.append({"name":t}) - return l + def nodebranchdict(self, ctx): + branches = [] + branch = ctx.branch() + if self.repo.branchtags()[branch] == ctx.node(): + branches.append({"name": branch}) + return branches def showtag(self, t1, node=nullid, **args): for t in self.repo.nodetags(node): @@ -222,8 +222,8 @@ class hgweb(object): "files": self.listfilediffs(ctx.files(), n), "rev": i, "node": hex(n), - "tags": self.taglistdict(n), - "branches": self.branchlistdict(n)}) + "tags": self.nodetagsdict(n), + "branches": self.nodebranchdict(ctx)}) for e in l: yield e @@ -287,8 +287,8 @@ class hgweb(object): files=self.listfilediffs(ctx.files(), n), rev=ctx.rev(), node=hex(n), - tags=self.taglistdict(n), - branches=self.branchlistdict(n)) + tags=self.nodetagsdict(n), + branches=self.nodebranchdict(ctx)) if count >= self.maxchanges: break @@ -329,8 +329,8 @@ class hgweb(object): date=ctx.date(), files=files, archives=self.archivelist(hex(n)), - tags=self.taglistdict(n), - branches=self.branchlistdict(n)) + tags=self.nodetagsdict(n), + branches=self.nodebranchdict(ctx)) def filelog(self, fctx): f = fctx.path() @@ -499,8 +499,8 @@ class hgweb(object): fentries=filelist, dentries=dirlist, archives=self.archivelist(hex(node)), - tags=self.taglistdict(node), - branches=self.branchlistdict(node)) + tags=self.nodetagsdict(node), + branches=self.nodebranchdict(ctx)) def tags(self): i = self.repo.tagslist() @@ -574,8 +574,8 @@ class hgweb(object): date=ctx.date(), rev=i, node=hn, - tags=self.taglistdict(n), - branches=self.branchlistdict(n))) + tags=self.nodetagsdict(n), + branches=self.nodebranchdict(ctx))) yield l