[PATCH] commands: update debugindex to display more fields
Pradeepkumar Gayam
in3xes at gmail.com
Tue Oct 26 18:52:51 CDT 2010
description is not complete and so many tests fail.
On Wed, Oct 27, 2010 at 4:52 AM, <in3xes at gmail.com> wrote:
> # HG changeset patch
> # User Pradeepkumar Gayam <in3xes at gmail.com>
> # Date 1288135189 -19800
> # Branch stable
> # Node ID 239613796263a1ec6e3d02af8b626a3d33a69b72
> # Parent b00eda50ad2b8d4ce385486e82dd72e421c7d793
> commands: update debugindex to display more fields
>
> Now debugindex command displays flags and size(revlog.rawsize)
> Currently it looks like:
>
> rev offset length size base linkrev p1 p2 nodeid
> 0 0 2307 7801 0 0 -1 -1 b6444347c629
> 1 2307 77 7841 0 5 0 -1 06763db6de79
>
> diff -r b00eda50ad2b -r 239613796263 mercurial/commands.py
> --- a/mercurial/commands.py Wed Oct 20 17:38:21 2010 -0500
> +++ b/mercurial/commands.py Wed Oct 27 04:49:49 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 % 04x % 9d % 7d % 6d % 6d % 7d % 6d % 6d %s\n"
> + ui.write(" rev flags offset length size base linkrev"
> + " p1 p2 nodeid\n")
> + else:
> + format = "% 6d % 9d % 7d % 6d % 6d % 6d % 7d %6d %s\n"
> + ui.write(" rev offset length size base linkrev"
> + " p1 p2 nodeid\n")
> for i in r:
> + values = []
> node = r.node(i)
> try:
> - pp = r.parents(node)
> + pp = r.parentrevs(i)
> 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])))
> + pp = [-1, -1]
> + values = [i, r.start(i), r.length(i), r.rawsize(i), r.base(i),
> r.linkrev(i),
> + pp[0], pp[1], short(node)]
> + if flags:
> + values.insert(1, 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]')),
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20101027/6b5798d2/attachment.htm>
More information about the Mercurial-devel
mailing list