Mercurial > hg-stable
changeset 4539:e6c69a2491ed
Small cleanups for the new tag code
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Mon, 11 Jun 2007 11:06:42 -0700 |
parents | 4272ae760bb1 |
children | 133a52d70958 |
files | mercurial/hgweb/hgweb_mod.py |
diffstat | 1 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Fri Jun 01 19:56:39 2007 -0400 +++ b/mercurial/hgweb/hgweb_mod.py Mon Jun 11 11:06:42 2007 -0700 @@ -133,15 +133,15 @@ 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 @@ "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 @@ 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 @@ 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 @@ 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 @@ 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