Mercurial > hg
comparison mercurial/hgweb.py @ 1369:b6d4ebebc35c
Allows abbreviated hashes in hgweb
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 01 Oct 2005 12:50:56 -0700 |
parents | b8c82bf3da21 |
children | cf9a1233738a |
comparison
equal
deleted
inserted
replaced
1368:d1d605d1e839 | 1369:b6d4ebebc35c |
---|---|
384 query=query, | 384 query=query, |
385 manifest=hex(mf), | 385 manifest=hex(mf), |
386 entries=changelist) | 386 entries=changelist) |
387 | 387 |
388 def changeset(self, nodeid): | 388 def changeset(self, nodeid): |
389 n = bin(nodeid) | |
390 cl = self.repo.changelog | 389 cl = self.repo.changelog |
390 n = self.repo.lookup(nodeid) | |
391 nodeid = hex(n) | |
391 changes = cl.read(n) | 392 changes = cl.read(n) |
392 p1 = cl.parents(n)[0] | 393 p1 = cl.parents(n)[0] |
393 | 394 |
394 files = [] | 395 files = [] |
395 mf = self.repo.manifest.read(changes[0]) | 396 mf = self.repo.manifest.read(changes[0]) |
420 archives=archivelist()) | 421 archives=archivelist()) |
421 | 422 |
422 def filelog(self, f, filenode): | 423 def filelog(self, f, filenode): |
423 cl = self.repo.changelog | 424 cl = self.repo.changelog |
424 fl = self.repo.file(f) | 425 fl = self.repo.file(f) |
426 filenode = hex(fl.lookup(filenode)) | |
425 count = fl.count() | 427 count = fl.count() |
426 | 428 |
427 def entries(**map): | 429 def entries(**map): |
428 l = [] | 430 l = [] |
429 parity = (count - 1) & 1 | 431 parity = (count - 1) & 1 |
452 | 454 |
453 yield self.t("filelog", file=f, filenode=filenode, entries=entries) | 455 yield self.t("filelog", file=f, filenode=filenode, entries=entries) |
454 | 456 |
455 def filerevision(self, f, node): | 457 def filerevision(self, f, node): |
456 fl = self.repo.file(f) | 458 fl = self.repo.file(f) |
457 n = bin(node) | 459 n = fl.lookup(node) |
460 node = hex(n) | |
458 text = fl.read(n) | 461 text = fl.read(n) |
459 changerev = fl.linkrev(n) | 462 changerev = fl.linkrev(n) |
460 cl = self.repo.changelog | 463 cl = self.repo.changelog |
461 cn = cl.node(changerev) | 464 cn = cl.node(changerev) |
462 cs = cl.read(cn) | 465 cs = cl.read(cn) |
484 | 487 |
485 def fileannotate(self, f, node): | 488 def fileannotate(self, f, node): |
486 bcache = {} | 489 bcache = {} |
487 ncache = {} | 490 ncache = {} |
488 fl = self.repo.file(f) | 491 fl = self.repo.file(f) |
489 n = bin(node) | 492 n = fl.lookup(node) |
493 node = hex(n) | |
490 changerev = fl.linkrev(n) | 494 changerev = fl.linkrev(n) |
491 | 495 |
492 cl = self.repo.changelog | 496 cl = self.repo.changelog |
493 cn = cl.node(changerev) | 497 cn = cl.node(changerev) |
494 cs = cl.read(cn) | 498 cs = cl.read(cn) |
533 parent=self.parents("fileannotateparent", | 537 parent=self.parents("fileannotateparent", |
534 fl.parents(n), fl.rev, file=f), | 538 fl.parents(n), fl.rev, file=f), |
535 permissions=self.repo.manifest.readflags(mfn)[f]) | 539 permissions=self.repo.manifest.readflags(mfn)[f]) |
536 | 540 |
537 def manifest(self, mnode, path): | 541 def manifest(self, mnode, path): |
538 mf = self.repo.manifest.read(bin(mnode)) | 542 man = self.repo.manifest |
539 rev = self.repo.manifest.rev(bin(mnode)) | 543 mn = man.lookup(mnode) |
544 mnode = hex(mn) | |
545 mf = man.read(mn) | |
546 rev = man.rev(mn) | |
540 node = self.repo.changelog.node(rev) | 547 node = self.repo.changelog.node(rev) |
541 mff=self.repo.manifest.readflags(bin(mnode)) | 548 mff = man.readflags(mn) |
542 | 549 |
543 files = {} | 550 files = {} |
544 | 551 |
545 p = path[1:] | 552 p = path[1:] |
546 l = len(p) | 553 l = len(p) |
615 yield self.t("tags", | 622 yield self.t("tags", |
616 manifest=hex(mf), | 623 manifest=hex(mf), |
617 entries=entries) | 624 entries=entries) |
618 | 625 |
619 def filediff(self, file, changeset): | 626 def filediff(self, file, changeset): |
620 n = bin(changeset) | |
621 cl = self.repo.changelog | 627 cl = self.repo.changelog |
628 n = self.repo.lookup(changeset) | |
629 changeset = hex(n) | |
622 p1 = cl.parents(n)[0] | 630 p1 = cl.parents(n)[0] |
623 cs = cl.read(n) | 631 cs = cl.read(n) |
624 mf = self.repo.manifest.read(cs[0]) | 632 mf = self.repo.manifest.read(cs[0]) |
625 | 633 |
626 def diff(**map): | 634 def diff(**map): |
803 req.write(z.compress(chunk)) | 811 req.write(z.compress(chunk)) |
804 | 812 |
805 req.write(z.flush()) | 813 req.write(z.flush()) |
806 | 814 |
807 elif req.form['cmd'][0] == 'archive': | 815 elif req.form['cmd'][0] == 'archive': |
808 changeset = bin(req.form['node'][0]) | 816 changeset = self.repo.lookup(req.form['node'][0]) |
809 type = req.form['type'][0] | 817 type = req.form['type'][0] |
810 if (type in self.archives and | 818 if (type in self.archives and |
811 self.repo.ui.configbool("web", "allow" + type, False)): | 819 self.repo.ui.configbool("web", "allow" + type, False)): |
812 self.archive(req, changeset, type) | 820 self.archive(req, changeset, type) |
813 return | 821 return |