diff 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
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Mon Apr 02 16:24:57 2018 -0700
+++ b/mercurial/debugcommands.py	Mon Apr 02 16:28:20 2018 -0700
@@ -1059,12 +1059,6 @@
     if format not in (0, 1):
         raise error.Abort(_("unknown format %d") % format)
 
-    generaldelta = r.version & revlog.FLAG_GENERALDELTA
-    if generaldelta:
-        basehdr = ' delta'
-    else:
-        basehdr = '  base'
-
     if ui.debugflag:
         shortfn = hex
     else:
@@ -1077,32 +1071,27 @@
         break
 
     if format == 0:
-        ui.write(("   rev    offset  length " + basehdr + " linkrev"
+        ui.write(("   rev    offset  length linkrev"
                  " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
     elif format == 1:
-        ui.write(("   rev flag   offset   length"
-                 "     size " + basehdr + "   link     p1     p2"
+        ui.write(("   rev flag   offset   length     size   link     p1     p2"
                  " %s\n") % "nodeid".rjust(idlen))
 
     for i in r:
         node = r.node(i)
-        if generaldelta:
-            base = r.deltaparent(i)
-        else:
-            base = r.chainbase(i)
         if format == 0:
             try:
                 pp = r.parents(node)
             except Exception:
                 pp = [nullid, nullid]
-            ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
-                    i, r.start(i), r.length(i), base, r.linkrev(i),
+            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])))
         elif format == 1:
             pr = r.parentrevs(i)
-            ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
+            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),
-                    base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
+                    r.linkrev(i), pr[0], pr[1], shortfn(node)))
 
 @command('debugindexdot', cmdutil.debugrevlogopts,
     _('-c|-m|FILE'), optionalrepo=True)