Add debugindexdot to generate graphviz dot files from indexes
authormpm@selenic.com
Wed, 18 May 2005 15:23:10 -0800
changeset 92 e6fc7ff52246
parent 91 1c212bbb38d5
child 93 0b0efe409d79
Add debugindexdot to generate graphviz dot files from indexes
hg
--- a/hg	Wed May 18 15:21:53 2005 -0800
+++ b/hg	Wed May 18 15:23:10 2005 -0800
@@ -349,6 +349,19 @@
             i, e[0], e[1], e[2], e[3],
             hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5]))
 
+elif cmd == "debugindexdot":
+    if ".hg" not in args[0]:
+        args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i"
+
+    r = hg.revlog(open, args[0], "")
+    print "digraph G {"
+    for i in range(r.count()):
+        e = r.index[i]
+        print "\t%d -> %d" % (r.rev(e[4]), i)
+        if e[5] != hg.nullid:
+            print "\t%d -> %d" % (r.rev(e[5]), i)
+    print "}"
+
 elif cmd == "merge":
     if args:
         other = hg.repository(ui, args[0])