[PATCH 10 of 12] Teach debugindex to grok overlay revlogs

Brendan Cully brendan at kublai.com
Tue Jan 2 15:42:22 CST 2007


# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Date 1167777087 18000
# Node ID c549268c803cb9b9aa0776cd5d68ccebc4d7ee2e
# Parent  5dcef12be99f123b4efc2a9e1ebde1c3dfccc179
Teach debugindex to grok overlay revlogs

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -805,9 +805,19 @@ def debugindex(ui, file_):
     r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0)
     ui.write("   rev    offset  length   base linkrev" +
              " nodeid       p1           p2\n")
+    missing = '\xff' * 20
     for i in xrange(r.count()):
         node = r.node(i)
-        pp = r.parents(node)
+        pp = list(r.parentrevs(i))
+        for x in range(len(pp)):
+            if pp[x] >= 0:
+                pp[x] -= r.startrev
+                if pp[x] < 0:
+                    pp[x] = missing
+                else:
+                    pp[x] = r.node(pp[x])
+            else:
+                pp[x] = r.node(pp[x])
         ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
                 i, r.start(i), r.length(i), r.base(i), r.linkrev(node),
             short(node), short(pp[0]), short(pp[1])))


More information about the Mercurial-devel mailing list