[PATCH] commands: modify debugindex to display revlog revision flags
in3xes at gmail.com
in3xes at gmail.com
Tue Oct 26 09:30:36 CDT 2010
# HG changeset patch
# User Pradeepkumar Gayam <in3xes at gmail.com>
# Date 1288103422 -19800
# Branch stable
# Node ID e49a8996c7816e78512fc2e05a0881ed718f8ec5
# Parent b00eda50ad2b8d4ce385486e82dd72e421c7d793
commands: modify debugindex to display revlog revision flags
diff -r b00eda50ad2b -r e49a8996c781 mercurial/commands.py
--- a/mercurial/commands.py Wed Oct 20 17:38:21 2010 -0500
+++ b/mercurial/commands.py Tue Oct 26 20:00:22 2010 +0530
@@ -1260,26 +1260,36 @@
m = util.matchdate(range)
ui.write("match: %s\n" % m(d[0]))
-def debugindex(ui, repo, file_):
+def debugindex(ui, repo, file_, **opts):
"""dump the contents of an index file"""
r = None
if repo:
filelog = repo.file(file_)
if len(filelog):
r = filelog
+ flags = opts.get('flags')
if not r:
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
- ui.write(" rev offset length base linkrev"
- " nodeid p1 p2\n")
+ if flags:
+ format = "% 6d % 9d % 7d % 6d % 5x % 7d %s %s %s\n"
+ ui.write(" rev offset length base flags linkrev"
+ " nodeid p1 p2\n")
+ else:
+ format = "% 6d % 9d % 7d % 6d % 7d %s %s %s\n"
+ ui.write(" rev offset length base linkrev"
+ " nodeid p1 p2\n")
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, repo, file_):
"""dump an index DAG as a graphviz dot file"""
@@ -4131,7 +4141,8 @@
_('[-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