Patchwork [3,of,8] debugrevlog: display details about empty revision

login
register
mail settings
Submitter Boris Feld
Date Aug. 14, 2018, 4:39 p.m.
Message ID <d83a28de86d58327c89e.1534264753@FB-lair>
Download mbox | patch
Permalink /patch/33721/
State Accepted
Headers show

Comments

Boris Feld - Aug. 14, 2018, 4:39 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1532780099 -7200
#      Sat Jul 28 14:14:59 2018 +0200
# Node ID d83a28de86d58327c89ec3d87f22c784d6f8edcd
# Parent  1ec1b66c5db9247ce3666f2b0fcecdd6ef57315f
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d83a28de86d5
debugrevlog: display details about empty revision

We now display details about the course of emptiness (empty text or empty
delta).

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2089,6 +2089,8 @@  def debugrevlog(ui, repo, file_=None, **
     ### tracks ways the "delta" are build
     # nodelta
     numempty = 0
+    numemptytext = 0
+    numemptydelta = 0
     # full file content
     numfull = 0
     # delta against previous revision
@@ -2137,6 +2139,7 @@  def debugrevlog(ui, repo, file_=None, **
             chainspans.append(size)
             if size == 0:
                 numempty += 1
+                numemptytext += 1
             else:
                 numfull += 1
                 addsize(size, fullsize)
@@ -2148,6 +2151,7 @@  def debugrevlog(ui, repo, file_=None, **
             chainspans.append((revaddr - baseaddr) + size)
             if size == 0:
                 numempty += 1
+                numemptydelta += 1
             else:
                 addsize(size, deltasize)
                 if delta == rev - 1:
@@ -2224,6 +2228,10 @@  def debugrevlog(ui, repo, file_=None, **
     ui.write(('    normal    : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
     ui.write(('revisions     : ') + fmt2 % numrevs)
     ui.write(('    empty     : ') + fmt % pcfmt(numempty, numrevs))
+    ui.write(('                   text  : ')
+             + fmt % pcfmt(numemptytext, numemptytext + numemptydelta))
+    ui.write(('                   delta : ')
+             + fmt % pcfmt(numemptydelta, numemptytext + numemptydelta))
     ui.write(('    full      : ') + fmt % pcfmt(numfull, numrevs))
     ui.write(('    deltas    : ') + fmt % pcfmt(numdeltas, numrevs))
     ui.write(('revision size : ') + fmt2 % totalsize)
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -24,6 +24,8 @@ 
       normal    :  3 (100.00%)
   revisions     :  3
       empty     :  1 (33.33%)
+                     text  :  1 (100.00%)
+                     delta :  0 ( 0.00%)
       full      :  2 (66.67%)
       deltas    :  0 ( 0.00%)
   revision size : 88