Patchwork util: fix human-readable printing of negative byte counts

login
register
mail settings
Submitter Gábor Stefanik
Date April 11, 2017, 4:41 p.m.
Message ID <c3d89ef348120ead9c22.1491928912@GSTEFANIK.NavnGo.local>
Download mbox | patch
Permalink /patch/20108/
State Accepted
Headers show

Comments

Gábor Stefanik - April 11, 2017, 4:41 p.m.
# HG changeset patch
# User Gábor Stefanik <gabor.stefanik@nng.com>
# Date 1491840990 -7200
#      Mon Apr 10 18:16:30 2017 +0200
# Node ID c3d89ef348120ead9c2280c55d05c7ce435ea589
# Parent  e0dc40530c5aa514feb6a09cf79ab6a3aa2ec331
util: fix human-readable printing of negative byte counts

Apply the same human-readable printing rules to negative byte counts as to
positive ones. Fixes output of debugupgraderepo.




--------------------------------------------------------------------------
This message, including its attachments, is confidential. For more information please read NNG's email policy here:
http://www.nng.com/emailpolicy/
By responding to this email you accept the email policy.
Yuya Nishihara - April 13, 2017, 12:55 p.m.
On Tue, 11 Apr 2017 18:41:52 +0200, Gábor Stefanik wrote:
> # HG changeset patch
> # User Gábor Stefanik <gabor.stefanik@nng.com>
> # Date 1491840990 -7200
> #      Mon Apr 10 18:16:30 2017 +0200
> # Node ID c3d89ef348120ead9c2280c55d05c7ce435ea589
> # Parent  e0dc40530c5aa514feb6a09cf79ab6a3aa2ec331
> util: fix human-readable printing of negative byte counts
> 
> Apply the same human-readable printing rules to negative byte counts as to
> positive ones. Fixes output of debugupgraderepo.

Looks good, queued, thanks.

Patch

diff -r e0dc40530c5a -r c3d89ef34812 mercurial/util.py
--- a/mercurial/util.py	Sat Apr 01 15:24:03 2017 -0700
+++ b/mercurial/util.py	Mon Apr 10 18:16:30 2017 +0200
@@ -2160,7 +2160,7 @@ 
 
     def go(count):
         for multiplier, divisor, format in unittable:
-            if count >= divisor * multiplier:
+            if abs(count) >= divisor * multiplier:
                 return format % (count / float(divisor))
         return unittable[-1][2] % count