[PATCH] commands: modify debugindex to display revlog revision flags
Benoit Boissinot
bboissin at gmail.com
Fri Aug 27 04:41:09 CDT 2010
On Fri, Aug 27, 2010 at 08:10:51AM +0530, Pradeepkumar Gayam wrote:
> # 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"]
we usually do:
flags = opts.get('flags')
because then it doesn't break for people who used the command from
python outside of our codebase.
> + 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"
since we already have the if/else, we might has well duplicate the
definition of header directly there, no?
regards,
Benoit
--
:wq
More information about the Mercurial-devel
mailing list