Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb.py @ 1606:ba625c8083d8
- duplicate the parent link logic to show child links
- don't show trivial parent or children links
author | Muli Ben-Yehuda <mulix@mulix.org> |
---|---|
date | Thu, 29 Dec 2005 14:51:29 -0600 |
parents | 85803ec2daab |
children | ff339dd21976 |
comparison
equal
deleted
inserted
replaced
1605:428e0a9c9968 | 1606:ba625c8083d8 |
---|---|
210 for f in files[:self.maxfiles]: | 210 for f in files[:self.maxfiles]: |
211 yield self.t("filedifflink", node=hex(changeset), file=f) | 211 yield self.t("filedifflink", node=hex(changeset), file=f) |
212 if len(files) > self.maxfiles: | 212 if len(files) > self.maxfiles: |
213 yield self.t("fileellipses") | 213 yield self.t("fileellipses") |
214 | 214 |
215 def parents(self, node, parents=[], rev=None, hide=False, **args): | 215 def siblings(self, siblings=[], rev=None, hiderev=None, **args): |
216 if not rev: | 216 if not rev: |
217 rev = lambda x: "" | 217 rev = lambda x: "" |
218 parents = [p for p in parents if p != nullid] | 218 siblings = [s for s in siblings if s != nullid] |
219 if hide and len(parents) == 1 and rev(parents[0]) == rev(node) - 1: | 219 if len(siblings) == 1 and rev(siblings[0]) == hiderev: |
220 return | 220 return |
221 for p in parents: | 221 for s in siblings: |
222 yield dict(node=hex(p), rev=rev(p), **args) | 222 yield dict(node=hex(s), rev=rev(s), **args) |
223 | 223 |
224 def showtag(self, t1, node=nullid, **args): | 224 def showtag(self, t1, node=nullid, **args): |
225 for t in self.repo.nodetags(node): | 225 for t in self.repo.nodetags(node): |
226 yield self.t(t1, tag=t, **args) | 226 yield self.t(t1, tag=t, **args) |
227 | 227 |
319 changes = cl.read(n) | 319 changes = cl.read(n) |
320 hn = hex(n) | 320 hn = hex(n) |
321 | 321 |
322 l.insert(0, {"parity": parity, | 322 l.insert(0, {"parity": parity, |
323 "author": changes[1], | 323 "author": changes[1], |
324 "parent": self.parents(n, cl.parents(n), cl.rev, | 324 "parent": self.siblings(cl.parents(n), cl.rev, |
325 hide=True), | 325 cl.rev(n) - 1), |
326 "child": self.siblings(cl.children(n), cl.rev, | |
327 cl.rev(n) + 1), | |
326 "changelogtag": self.showtag("changelogtag",n), | 328 "changelogtag": self.showtag("changelogtag",n), |
327 "manifest": hex(changes[0]), | 329 "manifest": hex(changes[0]), |
328 "desc": changes[4], | 330 "desc": changes[4], |
329 "date": changes[2], | 331 "date": changes[2], |
330 "files": self.listfilediffs(changes[3], n), | 332 "files": self.listfilediffs(changes[3], n), |
380 hn = hex(n) | 382 hn = hex(n) |
381 | 383 |
382 yield self.t('searchentry', | 384 yield self.t('searchentry', |
383 parity=count & 1, | 385 parity=count & 1, |
384 author=changes[1], | 386 author=changes[1], |
385 parent=self.parents(n, cl.parents(n), cl.rev), | 387 parent=self.siblings(cl.parents(n), cl.rev), |
388 child=self.siblings(cl.children(n), cl.rev), | |
386 changelogtag=self.showtag("changelogtag",n), | 389 changelogtag=self.showtag("changelogtag",n), |
387 manifest=hex(changes[0]), | 390 manifest=hex(changes[0]), |
388 desc=changes[4], | 391 desc=changes[4], |
389 date=changes[2], | 392 date=changes[2], |
390 files=self.listfilediffs(changes[3], n), | 393 files=self.listfilediffs(changes[3], n), |
420 | 423 |
421 yield self.t('changeset', | 424 yield self.t('changeset', |
422 diff=diff, | 425 diff=diff, |
423 rev=cl.rev(n), | 426 rev=cl.rev(n), |
424 node=nodeid, | 427 node=nodeid, |
425 parent=self.parents(n, cl.parents(n), cl.rev), | 428 parent=self.siblings(cl.parents(n), cl.rev), |
429 child=self.siblings(cl.children(n), cl.rev), | |
426 changesettag=self.showtag("changesettag",n), | 430 changesettag=self.showtag("changesettag",n), |
427 manifest=hex(changes[0]), | 431 manifest=hex(changes[0]), |
428 author=changes[1], | 432 author=changes[1], |
429 desc=changes[4], | 433 desc=changes[4], |
430 date=changes[2], | 434 date=changes[2], |
452 "filerev": i, | 456 "filerev": i, |
453 "file": f, | 457 "file": f, |
454 "node": hex(cn), | 458 "node": hex(cn), |
455 "author": cs[1], | 459 "author": cs[1], |
456 "date": cs[2], | 460 "date": cs[2], |
457 "parent": self.parents(n, fl.parents(n), | 461 "parent": self.siblings(fl.parents(n), |
462 fl.rev, file=f), | |
463 "child": self.siblings(fl.children(n), | |
458 fl.rev, file=f), | 464 fl.rev, file=f), |
459 "desc": cs[4]}) | 465 "desc": cs[4]}) |
460 parity = 1 - parity | 466 parity = 1 - parity |
461 | 467 |
462 for e in l: | 468 for e in l: |
496 rev=changerev, | 502 rev=changerev, |
497 node=hex(cn), | 503 node=hex(cn), |
498 manifest=hex(mfn), | 504 manifest=hex(mfn), |
499 author=cs[1], | 505 author=cs[1], |
500 date=cs[2], | 506 date=cs[2], |
501 parent=self.parents(n, fl.parents(n), fl.rev, file=f), | 507 parent=self.siblings(fl.parents(n), fl.rev, file=f), |
508 child=self.siblings(fl.children(n), fl.rev, file=f), | |
502 permissions=self.repo.manifest.readflags(mfn)[f]) | 509 permissions=self.repo.manifest.readflags(mfn)[f]) |
503 | 510 |
504 def fileannotate(self, f, node): | 511 def fileannotate(self, f, node): |
505 bcache = {} | 512 bcache = {} |
506 ncache = {} | 513 ncache = {} |
548 rev=changerev, | 555 rev=changerev, |
549 node=hex(cn), | 556 node=hex(cn), |
550 manifest=hex(mfn), | 557 manifest=hex(mfn), |
551 author=cs[1], | 558 author=cs[1], |
552 date=cs[2], | 559 date=cs[2], |
553 parent=self.parents(n, fl.parents(n), fl.rev, file=f), | 560 parent=self.siblings(fl.parents(n), fl.rev, file=f), |
561 child=self.siblings(fl.children(n), fl.rev, file=f), | |
554 permissions=self.repo.manifest.readflags(mfn)[f]) | 562 permissions=self.repo.manifest.readflags(mfn)[f]) |
555 | 563 |
556 def manifest(self, mnode, path): | 564 def manifest(self, mnode, path): |
557 man = self.repo.manifest | 565 man = self.repo.manifest |
558 mn = man.lookup(mnode) | 566 mn = man.lookup(mnode) |
725 yield self.t("filediff", | 733 yield self.t("filediff", |
726 file=file, | 734 file=file, |
727 filenode=hex(mf.get(file, nullid)), | 735 filenode=hex(mf.get(file, nullid)), |
728 node=changeset, | 736 node=changeset, |
729 rev=self.repo.changelog.rev(n), | 737 rev=self.repo.changelog.rev(n), |
730 parent=self.parents(n, cl.parents(n), cl.rev), | 738 parent=self.siblings(cl.parents(n), cl.rev), |
739 child=self.siblings(cl.children(n), cl.rev), | |
731 diff=diff) | 740 diff=diff) |
732 | 741 |
733 def archive(self, req, cnode, type): | 742 def archive(self, req, cnode, type): |
734 cs = self.repo.changelog.read(cnode) | 743 cs = self.repo.changelog.read(cnode) |
735 mnode = cs[0] | 744 mnode = cs[0] |