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) |
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""" |
792 timestr, file_)) |
792 timestr, file_)) |
793 for f in repo.dirstate.copies(): |
793 for f in repo.dirstate.copies(): |
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 a data file revision""" |
798 r = revlog.revlog(util.opener(os.getcwd(), audit=False), |
798 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i") |
799 file_[:-2] + ".i", 0) |
|
800 try: |
799 try: |
801 ui.write(r.revision(r.lookup(rev))) |
800 ui.write(r.revision(r.lookup(rev))) |
802 except KeyError: |
801 except KeyError: |
803 raise util.Abort(_('invalid revision identifier %s') % rev) |
802 raise util.Abort(_('invalid revision identifier %s') % rev) |
804 |
803 |
814 m = util.matchdate(range) |
813 m = util.matchdate(range) |
815 ui.write("match: %s\n" % m(d[0])) |
814 ui.write("match: %s\n" % m(d[0])) |
816 |
815 |
817 def debugindex(ui, file_): |
816 def debugindex(ui, file_): |
818 """dump the contents of an index file""" |
817 """dump the contents of an index file""" |
819 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, 0) |
818 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) |
820 ui.write(" rev offset length base linkrev" + |
819 ui.write(" rev offset length base linkrev" + |
821 " nodeid p1 p2\n") |
820 " nodeid p1 p2\n") |
822 for i in xrange(r.count()): |
821 for i in xrange(r.count()): |
823 node = r.node(i) |
822 node = r.node(i) |
824 pp = r.parents(node) |
823 pp = r.parents(node) |
826 i, r.start(i), r.length(i), r.base(i), r.linkrev(node), |
825 i, r.start(i), r.length(i), r.base(i), r.linkrev(node), |
827 short(node), short(pp[0]), short(pp[1]))) |
826 short(node), short(pp[0]), short(pp[1]))) |
828 |
827 |
829 def debugindexdot(ui, file_): |
828 def debugindexdot(ui, file_): |
830 """dump an index DAG as a .dot file""" |
829 """dump an index DAG as a .dot file""" |
831 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, 0) |
830 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) |
832 ui.write("digraph G {\n") |
831 ui.write("digraph G {\n") |
833 for i in xrange(r.count()): |
832 for i in xrange(r.count()): |
834 node = r.node(i) |
833 node = r.node(i) |
835 pp = r.parents(node) |
834 pp = r.parents(node) |
836 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |
835 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |