Mercurial > public > mercurial-scm > hg
comparison mercurial/debugcommands.py @ 37282:009d0283de5f
debugcommands: drop base revision from debugindex
Revlog index data consists of generic index metadata that will
likely be implemented across all storage engines and revlog-specifc
metadata.
Most tests printing index data only care about the generic fields.
This commit drops the printing of the base revision from
`hg debugindex`. This value is an implementation detail of
revlogs / delta chains. If tests are interested in verifying this
implementation detail, `hg debugdeltachain` is a better command.
Most tests were skipping over this field anyway. Tests that weren't
looked like they were newer. So my guess is we forgot to make them
skip the field to match the style of the older tests. This reinforces
my belief that the base revision is not worth having in
`hg debugindex`.
Differential Revision: https://phab.mercurial-scm.org/D3027
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 02 Apr 2018 16:28:20 -0700 |
parents | 8bac14ce5778 |
children | d4e62df1c73d |
comparison
equal
deleted
inserted
replaced
37281:806b07d7c7d6 | 37282:009d0283de5f |
---|---|
1057 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) | 1057 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) |
1058 format = opts.get('format', 0) | 1058 format = opts.get('format', 0) |
1059 if format not in (0, 1): | 1059 if format not in (0, 1): |
1060 raise error.Abort(_("unknown format %d") % format) | 1060 raise error.Abort(_("unknown format %d") % format) |
1061 | 1061 |
1062 generaldelta = r.version & revlog.FLAG_GENERALDELTA | |
1063 if generaldelta: | |
1064 basehdr = ' delta' | |
1065 else: | |
1066 basehdr = ' base' | |
1067 | |
1068 if ui.debugflag: | 1062 if ui.debugflag: |
1069 shortfn = hex | 1063 shortfn = hex |
1070 else: | 1064 else: |
1071 shortfn = short | 1065 shortfn = short |
1072 | 1066 |
1075 for i in r: | 1069 for i in r: |
1076 idlen = len(shortfn(r.node(i))) | 1070 idlen = len(shortfn(r.node(i))) |
1077 break | 1071 break |
1078 | 1072 |
1079 if format == 0: | 1073 if format == 0: |
1080 ui.write((" rev offset length " + basehdr + " linkrev" | 1074 ui.write((" rev offset length linkrev" |
1081 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen))) | 1075 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen))) |
1082 elif format == 1: | 1076 elif format == 1: |
1083 ui.write((" rev flag offset length" | 1077 ui.write((" rev flag offset length size link p1 p2" |
1084 " size " + basehdr + " link p1 p2" | |
1085 " %s\n") % "nodeid".rjust(idlen)) | 1078 " %s\n") % "nodeid".rjust(idlen)) |
1086 | 1079 |
1087 for i in r: | 1080 for i in r: |
1088 node = r.node(i) | 1081 node = r.node(i) |
1089 if generaldelta: | |
1090 base = r.deltaparent(i) | |
1091 else: | |
1092 base = r.chainbase(i) | |
1093 if format == 0: | 1082 if format == 0: |
1094 try: | 1083 try: |
1095 pp = r.parents(node) | 1084 pp = r.parents(node) |
1096 except Exception: | 1085 except Exception: |
1097 pp = [nullid, nullid] | 1086 pp = [nullid, nullid] |
1098 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( | 1087 ui.write("% 6d % 9d % 7d % 7d %s %s %s\n" % ( |
1099 i, r.start(i), r.length(i), base, r.linkrev(i), | 1088 i, r.start(i), r.length(i), r.linkrev(i), |
1100 shortfn(node), shortfn(pp[0]), shortfn(pp[1]))) | 1089 shortfn(node), shortfn(pp[0]), shortfn(pp[1]))) |
1101 elif format == 1: | 1090 elif format == 1: |
1102 pr = r.parentrevs(i) | 1091 pr = r.parentrevs(i) |
1103 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % ( | 1092 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s\n" % ( |
1104 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), | 1093 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), |
1105 base, r.linkrev(i), pr[0], pr[1], shortfn(node))) | 1094 r.linkrev(i), pr[0], pr[1], shortfn(node))) |
1106 | 1095 |
1107 @command('debugindexdot', cmdutil.debugrevlogopts, | 1096 @command('debugindexdot', cmdutil.debugrevlogopts, |
1108 _('-c|-m|FILE'), optionalrepo=True) | 1097 _('-c|-m|FILE'), optionalrepo=True) |
1109 def debugindexdot(ui, repo, file_=None, **opts): | 1098 def debugindexdot(ui, repo, file_=None, **opts): |
1110 """dump an index DAG as a graphviz dot file""" | 1099 """dump an index DAG as a graphviz dot file""" |