Mercurial > hg-stable
diff mercurial/debugcommands.py @ 37285:d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
These fields are an implementation detail of revlog storage. As
such, they are not part of the generic storage "index" interface
and shouldn't be displayed by default.
Because we don't have another way to display these fields, we've
retained support for printing these fields via --verbose.
Yes, I know we should probably be doing all this formatting using
modern formatting/templater APIs. I didn't feel like scope
bloating this patch.
Differential Revision: https://phab.mercurial-scm.org/D3028
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 02 Apr 2018 16:47:53 -0700 |
parents | 009d0283de5f |
children | 9bfcbe4f4745 |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Mon Apr 02 16:28:20 2018 -0700 +++ b/mercurial/debugcommands.py Mon Apr 02 16:47:53 2018 -0700 @@ -1071,11 +1071,20 @@ break if format == 0: - ui.write((" rev offset length linkrev" - " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen))) + if ui.verbose: + ui.write((" rev offset length linkrev" + " %s %s p2\n") % ("nodeid".ljust(idlen), + "p1".ljust(idlen))) + else: + ui.write((" rev linkrev %s %s p2\n") % ( + "nodeid".ljust(idlen), "p1".ljust(idlen))) elif format == 1: - ui.write((" rev flag offset length size link p1 p2" - " %s\n") % "nodeid".rjust(idlen)) + if ui.verbose: + ui.write((" rev flag offset length size link p1" + " p2 %s\n") % "nodeid".rjust(idlen)) + else: + ui.write((" rev flag size link p1 p2 %s\n") % + "nodeid".rjust(idlen)) for i in r: node = r.node(i) @@ -1084,14 +1093,24 @@ pp = r.parents(node) except Exception: pp = [nullid, nullid] - ui.write("% 6d % 9d % 7d % 7d %s %s %s\n" % ( - i, r.start(i), r.length(i), r.linkrev(i), - shortfn(node), shortfn(pp[0]), shortfn(pp[1]))) + if ui.verbose: + ui.write("% 6d % 9d % 7d % 7d %s %s %s\n" % ( + i, r.start(i), r.length(i), r.linkrev(i), + shortfn(node), shortfn(pp[0]), shortfn(pp[1]))) + else: + ui.write("% 6d % 7d %s %s %s\n" % ( + i, r.linkrev(i), shortfn(node), shortfn(pp[0]), + shortfn(pp[1]))) elif format == 1: pr = r.parentrevs(i) - ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s\n" % ( - i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), - r.linkrev(i), pr[0], pr[1], shortfn(node))) + if ui.verbose: + ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s\n" % ( + i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), + r.linkrev(i), pr[0], pr[1], shortfn(node))) + else: + ui.write("% 6d %04x % 8d % 6d % 6d % 6d %s\n" % ( + i, r.flags(i), r.rawsize(i), r.linkrev(i), pr[0], pr[1], + shortfn(node))) @command('debugindexdot', cmdutil.debugrevlogopts, _('-c|-m|FILE'), optionalrepo=True)