mercurial/commands.py
changeset 1835 bdfb524d728a
parent 1833 fc959d6ffb13
child 1837 6f67a4c93493
child 1839 876e4e6ad82b
equal deleted inserted replaced
1834:24881eaebee3 1835:bdfb524d728a
  1012         errs = 1
  1012         errs = 1
  1013     return errs
  1013     return errs
  1014 
  1014 
  1015 def debugancestor(ui, index, rev1, rev2):
  1015 def debugancestor(ui, index, rev1, rev2):
  1016     """find the ancestor revision of two revisions in a given index"""
  1016     """find the ancestor revision of two revisions in a given index"""
  1017     r = revlog.revlog(util.opener(os.getcwd()), index, "")
  1017     r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "")
  1018     a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
  1018     a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
  1019     ui.write("%d:%s\n" % (r.rev(a), hex(a)))
  1019     ui.write("%d:%s\n" % (r.rev(a), hex(a)))
  1020 
  1020 
  1021 def debugrebuildstate(ui, repo, rev=None):
  1021 def debugrebuildstate(ui, repo, rev=None):
  1022     """rebuild the dirstate as it would look like for the given revision"""
  1022     """rebuild the dirstate as it would look like for the given revision"""
  1098     for f in repo.dirstate.copies:
  1098     for f in repo.dirstate.copies:
  1099         ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copies[f], f))
  1099         ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copies[f], f))
  1100 
  1100 
  1101 def debugdata(ui, file_, rev):
  1101 def debugdata(ui, file_, rev):
  1102     """dump the contents of an data file revision"""
  1102     """dump the contents of an data file revision"""
  1103     r = revlog.revlog(util.opener(os.getcwd()), file_[:-2] + ".i", file_)
  1103     r = revlog.revlog(util.opener(os.getcwd(), audit=False),
       
  1104                       file_[:-2] + ".i", file_)
  1104     try:
  1105     try:
  1105         ui.write(r.revision(r.lookup(rev)))
  1106         ui.write(r.revision(r.lookup(rev)))
  1106     except KeyError:
  1107     except KeyError:
  1107         raise util.Abort(_('invalid revision identifier %s'), rev)
  1108         raise util.Abort(_('invalid revision identifier %s'), rev)
  1108 
  1109 
  1109 def debugindex(ui, file_):
  1110 def debugindex(ui, file_):
  1110     """dump the contents of an index file"""
  1111     """dump the contents of an index file"""
  1111     r = revlog.revlog(util.opener(os.getcwd()), file_, "")
  1112     r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "")
  1112     ui.write("   rev    offset  length   base linkrev" +
  1113     ui.write("   rev    offset  length   base linkrev" +
  1113              " nodeid       p1           p2\n")
  1114              " nodeid       p1           p2\n")
  1114     for i in range(r.count()):
  1115     for i in range(r.count()):
  1115         e = r.index[i]
  1116         e = r.index[i]
  1116         ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
  1117         ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
  1117                 i, e[0], e[1], e[2], e[3],
  1118                 i, e[0], e[1], e[2], e[3],
  1118             short(e[6]), short(e[4]), short(e[5])))
  1119             short(e[6]), short(e[4]), short(e[5])))
  1119 
  1120 
  1120 def debugindexdot(ui, file_):
  1121 def debugindexdot(ui, file_):
  1121     """dump an index DAG as a .dot file"""
  1122     """dump an index DAG as a .dot file"""
  1122     r = revlog.revlog(util.opener(os.getcwd()), file_, "")
  1123     r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "")
  1123     ui.write("digraph G {\n")
  1124     ui.write("digraph G {\n")
  1124     for i in range(r.count()):
  1125     for i in range(r.count()):
  1125         e = r.index[i]
  1126         e = r.index[i]
  1126         ui.write("\t%d -> %d\n" % (r.rev(e[4]), i))
  1127         ui.write("\t%d -> %d\n" % (r.rev(e[4]), i))
  1127         if e[5] != nullid:
  1128         if e[5] != nullid: