Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 4257:1b5c38e9d7aa
revlog: don't pass datafile as an argument
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 22 Mar 2007 19:12:03 -0500 |
parents | fe0fe0b4d73b |
children | b11a2fb59cf5 |
comparison
equal
deleted
inserted
replaced
4256:fe0fe0b4d73b | 4257:1b5c38e9d7aa |
---|---|
664 errs, copied = docopy(ui, repo, pats, opts, wlock) | 664 errs, copied = docopy(ui, repo, pats, opts, wlock) |
665 return errs | 665 return errs |
666 | 666 |
667 def debugancestor(ui, index, rev1, rev2): | 667 def debugancestor(ui, index, rev1, rev2): |
668 """find the ancestor revision of two revisions in a given index""" | 668 """find the ancestor revision of two revisions in a given index""" |
669 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "", 0) | 669 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, 0) |
670 a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) | 670 a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) |
671 ui.write("%d:%s\n" % (r.rev(a), hex(a))) | 671 ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
672 | 672 |
673 def debugcomplete(ui, cmd='', **opts): | 673 def debugcomplete(ui, cmd='', **opts): |
674 """returns the completion list associated with the given command""" | 674 """returns the completion list associated with the given command""" |
794 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) | 794 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
795 | 795 |
796 def debugdata(ui, file_, rev): | 796 def debugdata(ui, file_, rev): |
797 """dump the contents of an data file revision""" | 797 """dump the contents of an data file revision""" |
798 r = revlog.revlog(util.opener(os.getcwd(), audit=False), | 798 r = revlog.revlog(util.opener(os.getcwd(), audit=False), |
799 file_[:-2] + ".i", file_, 0) | 799 file_[:-2] + ".i", 0) |
800 try: | 800 try: |
801 ui.write(r.revision(r.lookup(rev))) | 801 ui.write(r.revision(r.lookup(rev))) |
802 except KeyError: | 802 except KeyError: |
803 raise util.Abort(_('invalid revision identifier %s') % rev) | 803 raise util.Abort(_('invalid revision identifier %s') % rev) |
804 | 804 |
814 m = util.matchdate(range) | 814 m = util.matchdate(range) |
815 ui.write("match: %s\n" % m(d[0])) | 815 ui.write("match: %s\n" % m(d[0])) |
816 | 816 |
817 def debugindex(ui, file_): | 817 def debugindex(ui, file_): |
818 """dump the contents of an index file""" | 818 """dump the contents of an index file""" |
819 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0) | 819 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, 0) |
820 ui.write(" rev offset length base linkrev" + | 820 ui.write(" rev offset length base linkrev" + |
821 " nodeid p1 p2\n") | 821 " nodeid p1 p2\n") |
822 for i in xrange(r.count()): | 822 for i in xrange(r.count()): |
823 node = r.node(i) | 823 node = r.node(i) |
824 pp = r.parents(node) | 824 pp = r.parents(node) |
826 i, r.start(i), r.length(i), r.base(i), r.linkrev(node), | 826 i, r.start(i), r.length(i), r.base(i), r.linkrev(node), |
827 short(node), short(pp[0]), short(pp[1]))) | 827 short(node), short(pp[0]), short(pp[1]))) |
828 | 828 |
829 def debugindexdot(ui, file_): | 829 def debugindexdot(ui, file_): |
830 """dump an index DAG as a .dot file""" | 830 """dump an index DAG as a .dot file""" |
831 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0) | 831 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, 0) |
832 ui.write("digraph G {\n") | 832 ui.write("digraph G {\n") |
833 for i in xrange(r.count()): | 833 for i in xrange(r.count()): |
834 node = r.node(i) | 834 node = r.node(i) |
835 pp = r.parents(node) | 835 pp = r.parents(node) |
836 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) | 836 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |