Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgweb_mod.py @ 3392:17894d1d9eea
hgweb: fix parent/child links across renames
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Sat, 14 Oct 2006 16:03:23 -0700 |
parents | defadc26e674 |
children | be628f1cd3f4 |
comparison
equal
deleted
inserted
replaced
3391:defadc26e674 | 3392:17894d1d9eea |
---|---|
68 def siblings(self, siblings=[], hiderev=None, **args): | 68 def siblings(self, siblings=[], hiderev=None, **args): |
69 siblings = [s for s in siblings if s.node() != nullid] | 69 siblings = [s for s in siblings if s.node() != nullid] |
70 if len(siblings) == 1 and siblings[0].rev() == hiderev: | 70 if len(siblings) == 1 and siblings[0].rev() == hiderev: |
71 return | 71 return |
72 for s in siblings: | 72 for s in siblings: |
73 yield dict(node=hex(s.node()), rev=s.rev(), **args) | 73 d = {'node': hex(s.node()), 'rev': s.rev()} |
74 if hasattr(s, 'file'): | |
75 d['file'] = s.file() | |
76 d.update(args) | |
77 yield d | |
74 | 78 |
75 def renamelink(self, fl, node): | 79 def renamelink(self, fl, node): |
76 r = fl.renamed(node) | 80 r = fl.renamed(node) |
77 if r: | 81 if r: |
78 return [dict(file=r[0], node=hex(r[1]))] | 82 return [dict(file=r[0], node=hex(r[1]))] |
316 "file": f, | 320 "file": f, |
317 "node": hex(ctx.node()), | 321 "node": hex(ctx.node()), |
318 "author": ctx.user(), | 322 "author": ctx.user(), |
319 "date": ctx.date(), | 323 "date": ctx.date(), |
320 "rename": self.renamelink(fl, n), | 324 "rename": self.renamelink(fl, n), |
321 "parent": self.siblings(fctx.parents(), file=f), | 325 "parent": self.siblings(fctx.parents()), |
322 "child": self.siblings(fctx.children(), file=f), | 326 "child": self.siblings(fctx.children()), |
323 "desc": ctx.description()}) | 327 "desc": ctx.description()}) |
324 parity = 1 - parity | 328 parity = 1 - parity |
325 | 329 |
326 for e in l: | 330 for e in l: |
327 yield e | 331 yield e |
355 mimetype=mt, | 359 mimetype=mt, |
356 rev=fctx.rev(), | 360 rev=fctx.rev(), |
357 node=hex(fctx.node()), | 361 node=hex(fctx.node()), |
358 author=fctx.user(), | 362 author=fctx.user(), |
359 date=fctx.date(), | 363 date=fctx.date(), |
360 parent=self.siblings(fctx.parents(), file=f), | 364 parent=self.siblings(fctx.parents()), |
361 child=self.siblings(fctx.children(), file=f), | 365 child=self.siblings(fctx.children()), |
362 rename=self.renamelink(fl, n), | 366 rename=self.renamelink(fl, n), |
363 permissions=fctx.manifest().execf(f)) | 367 permissions=fctx.manifest().execf(f)) |
364 | 368 |
365 def fileannotate(self, fctx): | 369 def fileannotate(self, fctx): |
366 f = fctx.path() | 370 f = fctx.path() |
393 node=hex(fctx.node()), | 397 node=hex(fctx.node()), |
394 author=fctx.user(), | 398 author=fctx.user(), |
395 date=fctx.date(), | 399 date=fctx.date(), |
396 desc=fctx.description(), | 400 desc=fctx.description(), |
397 rename=self.renamelink(fl, n), | 401 rename=self.renamelink(fl, n), |
398 parent=self.siblings(fctx.parents(), file=f), | 402 parent=self.siblings(fctx.parents()), |
399 child=self.siblings(fctx.children(), file=f), | 403 child=self.siblings(fctx.children()), |
400 permissions=fctx.manifest().execf(f)) | 404 permissions=fctx.manifest().execf(f)) |
401 | 405 |
402 def manifest(self, ctx, path): | 406 def manifest(self, ctx, path): |
403 mf = ctx.manifest() | 407 mf = ctx.manifest() |
404 node = ctx.node() | 408 node = ctx.node() |