changeset 92:e6fc7ff52246

Add debugindexdot to generate graphviz dot files from indexes
author mpm@selenic.com
date Wed, 18 May 2005 15:23:10 -0800
parents 1c212bbb38d5
children 0b0efe409d79
files hg
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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])