[PATCH] commands: modify debugindex to display revlog revision flags
Pradeepkumar Gayam
in3xes at gmail.com
Thu Aug 26 21:40:51 CDT 2010
# HG changeset patch
# User Pradeepkumar Gayam <in3xes at gmail.com>
# Date 1282876790 -19800
# Node ID d0698a63cde0e7ef5451d6cf42343c3072d64ac3
# Parent e1a3d7ed478e3eb0301cad386ea998dc138e3fb1
commands: modify debugindex to display revlog revision flags
diff -r e1a3d7ed478e -r d0698a63cde0 mercurial/commands.py
--- a/mercurial/commands.py Mon Aug 23 22:22:05 2010 +0200
+++ b/mercurial/commands.py Fri Aug 27 08:09:50 2010 +0530
@@ -1234,20 +1234,34 @@
m = util.matchdate(range)
ui.write("match: %s\n" % m(d[0]))
-def debugindex(ui, file_):
+def debugindex(ui, file_, **opts):
"""dump the contents of an index file"""
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
- ui.write(" rev offset length base linkrev"
- " nodeid p1 p2\n")
+ flags = opts["flags"]
+ h = [' rev', ' offset', ' length', ' base', ' linkrev',
+ ' nodeid', ' p1', ' p2\n']
+ if flags:
+ format = "% 6d % 9d % 7d % 6d % 5x % 7d %s %s %s\n"
+ h.insert(4, ' flags')
+ else:
+ format = "% 6d % 9d % 7d % 6d % 7d %s %s %s\n"
+
+ header = ''.join(h)
+ ui.write(header)
+
for i in r:
+ values = []
node = r.node(i)
try:
pp = r.parents(node)
except:
pp = [nullid, nullid]
- ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
- i, r.start(i), r.length(i), r.base(i), r.linkrev(i),
- short(node), short(pp[0]), short(pp[1])))
+
+ values = [i, r.start(i), r.length(i), r.base(i), r.linkrev(i),
+ short(node), short(pp[0]), short(pp[1])]
+ if flags:
+ values.insert(4, r.flags(i))
+ ui.write(format % tuple(values))
def debugindexdot(ui, file_):
"""dump an index DAG as a graphviz dot file"""
@@ -4118,7 +4132,7 @@
_('[-e] DATE [RANGE]')),
"debugdata": (debugdata, [], _('FILE REV')),
"debugfsinfo": (debugfsinfo, [], _('[PATH]')),
- "debugindex": (debugindex, [], _('FILE')),
+ "debugindex": (debugindex, [('f', 'flags', None, _('display revision flags'))], _('FILE')),
"debugindexdot": (debugindexdot, [], _('FILE')),
"debuginstall": (debuginstall, [], ''),
"debugpushkey": (debugpushkey, [], _('REPO NAMESPACE [KEY OLD NEW]')),
More information about the Mercurial-devel
mailing list