Patchwork [7,of,8,STABLE] debugrevlog: handle no totalrawsize

login
register
mail settings
Submitter timeless@mozdev.org
Date Feb. 1, 2016, 7:29 a.m.
Message ID <f45868741d783847ab04.1454311758@waste.org>
Download mbox | patch
Permalink /patch/12920/
State Changes Requested
Headers show

Comments

timeless@mozdev.org - Feb. 1, 2016, 7:29 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1454273832 0
#      Sun Jan 31 20:57:12 2016 +0000
# Branch stable
# Node ID f45868741d783847ab04531df73eff5d6c4b2304
# Parent  28f17ee0e20d30d547729532164c77f1a29f9e64
debugrevlog: handle no totalrawsize
Pierre-Yves David - Feb. 1, 2016, 12:20 p.m.
On 02/01/2016 07:29 AM, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1454273832 0
> #      Sun Jan 31 20:57:12 2016 +0000
> # Branch stable
> # Node ID f45868741d783847ab04531df73eff5d6c4b2304
> # Parent  28f17ee0e20d30d547729532164c77f1a29f9e64
> debugrevlog: handle no totalrawsize

Why don't we get a test change with this fix?

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3314,17 +3314,22 @@ 
     ui.write(('flags  : %s\n') % ', '.join(flags))
 
     ui.write('\n')
-    fmt = pcfmtstr(totalsize)
-    fmt2 = dfmtstr(totalsize)
+    if totalrawsize:
+            fmt = pcfmtstr(totalsize)
+            fmt2 = dfmtstr(totalsize)
+    else:
+            fmt = pcfmtstr(numrevs)
+            fmt2 = dfmtstr(numrevs)
     ui.write(('revisions     : ') + fmt2 % numrevs)
     ui.write(('    merges    : ') + fmt % pcfmt(nummerges, numrevs))
     ui.write(('    normal    : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
     ui.write(('revisions     : ') + fmt2 % numrevs)
     ui.write(('    full      : ') + fmt % pcfmt(numfull, numrevs))
     ui.write(('    deltas    : ') + fmt % pcfmt(numdeltas, numrevs))
-    ui.write(('revision size : ') + fmt2 % totalsize)
-    ui.write(('    full      : ') + fmt % pcfmt(fulltotal, totalsize))
-    ui.write(('    deltas    : ') + fmt % pcfmt(deltatotal, totalsize))
+    if totalrawsize:
+        ui.write(('revision size : ') + fmt2 % totalsize)
+        ui.write(('    full      : ') + fmt % pcfmt(fulltotal, totalsize))
+        ui.write(('    deltas    : ') + fmt % pcfmt(deltatotal, totalsize))
 
     if chainlengths:
         ui.write('\n')
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -44,9 +44,6 @@ 
   revisions     : 1
       full      : 1 (100.00%)
       deltas    : 0 ( 0.00%)
-  revision size : 0
-      full      : 0 (100.00%)
-      deltas    : 0 (100.00%)
   
   avg chain length  : 0
   max chain length  : 0