comparison mercurial/hgweb/hgweb_mod.py @ 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 63b9d2deed48
comparison
equal deleted inserted replaced
4538:4272ae760bb1 4539:e6c69a2491ed
131 r = fl.renamed(node) 131 r = fl.renamed(node)
132 if r: 132 if r:
133 return [dict(file=r[0], node=hex(r[1]))] 133 return [dict(file=r[0], node=hex(r[1]))]
134 return [] 134 return []
135 135
136 def taglistdict(self,node): 136 def nodetagsdict(self, node):
137 return [{"name":i} for i in self.repo.nodetags(node)] 137 return [{"name": i} for i in self.repo.nodetags(node)]
138 138
139 def branchlistdict(self,node): 139 def nodebranchdict(self, ctx):
140 l=[] 140 branches = []
141 for t, tn in self.repo.branchtags().items(): 141 branch = ctx.branch()
142 if tn == node: 142 if self.repo.branchtags()[branch] == ctx.node():
143 l.append({"name":t}) 143 branches.append({"name": branch})
144 return l 144 return branches
145 145
146 def showtag(self, t1, node=nullid, **args): 146 def showtag(self, t1, node=nullid, **args):
147 for t in self.repo.nodetags(node): 147 for t in self.repo.nodetags(node):
148 yield self.t(t1, tag=t, **args) 148 yield self.t(t1, tag=t, **args)
149 149
220 "desc": ctx.description(), 220 "desc": ctx.description(),
221 "date": ctx.date(), 221 "date": ctx.date(),
222 "files": self.listfilediffs(ctx.files(), n), 222 "files": self.listfilediffs(ctx.files(), n),
223 "rev": i, 223 "rev": i,
224 "node": hex(n), 224 "node": hex(n),
225 "tags": self.taglistdict(n), 225 "tags": self.nodetagsdict(n),
226 "branches": self.branchlistdict(n)}) 226 "branches": self.nodebranchdict(ctx)})
227 227
228 for e in l: 228 for e in l:
229 yield e 229 yield e
230 230
231 maxchanges = shortlog and self.maxshortchanges or self.maxchanges 231 maxchanges = shortlog and self.maxshortchanges or self.maxchanges
285 desc=ctx.description(), 285 desc=ctx.description(),
286 date=ctx.date(), 286 date=ctx.date(),
287 files=self.listfilediffs(ctx.files(), n), 287 files=self.listfilediffs(ctx.files(), n),
288 rev=ctx.rev(), 288 rev=ctx.rev(),
289 node=hex(n), 289 node=hex(n),
290 tags=self.taglistdict(n), 290 tags=self.nodetagsdict(n),
291 branches=self.branchlistdict(n)) 291 branches=self.nodebranchdict(ctx))
292 292
293 if count >= self.maxchanges: 293 if count >= self.maxchanges:
294 break 294 break
295 295
296 cl = self.repo.changelog 296 cl = self.repo.changelog
327 author=ctx.user(), 327 author=ctx.user(),
328 desc=ctx.description(), 328 desc=ctx.description(),
329 date=ctx.date(), 329 date=ctx.date(),
330 files=files, 330 files=files,
331 archives=self.archivelist(hex(n)), 331 archives=self.archivelist(hex(n)),
332 tags=self.taglistdict(n), 332 tags=self.nodetagsdict(n),
333 branches=self.branchlistdict(n)) 333 branches=self.nodebranchdict(ctx))
334 334
335 def filelog(self, fctx): 335 def filelog(self, fctx):
336 f = fctx.path() 336 f = fctx.path()
337 fl = fctx.filelog() 337 fl = fctx.filelog()
338 count = fl.count() 338 count = fl.count()
497 up=_up(abspath), 497 up=_up(abspath),
498 upparity=parity.next(), 498 upparity=parity.next(),
499 fentries=filelist, 499 fentries=filelist,
500 dentries=dirlist, 500 dentries=dirlist,
501 archives=self.archivelist(hex(node)), 501 archives=self.archivelist(hex(node)),
502 tags=self.taglistdict(node), 502 tags=self.nodetagsdict(node),
503 branches=self.branchlistdict(node)) 503 branches=self.nodebranchdict(ctx))
504 504
505 def tags(self): 505 def tags(self):
506 i = self.repo.tagslist() 506 i = self.repo.tagslist()
507 i.reverse() 507 i.reverse()
508 parity = paritygen(self.stripecount) 508 parity = paritygen(self.stripecount)
572 author=ctx.user(), 572 author=ctx.user(),
573 desc=ctx.description(), 573 desc=ctx.description(),
574 date=ctx.date(), 574 date=ctx.date(),
575 rev=i, 575 rev=i,
576 node=hn, 576 node=hn,
577 tags=self.taglistdict(n), 577 tags=self.nodetagsdict(n),
578 branches=self.branchlistdict(n))) 578 branches=self.nodebranchdict(ctx)))
579 579
580 yield l 580 yield l
581 581
582 cl = self.repo.changelog 582 cl = self.repo.changelog
583 count = cl.count() 583 count = cl.count()