changeset 13656:0e200e1801f4

relink: format reclaimed byte count nicely
author Martin Geisler <mg@lazybytes.net>
date Wed, 16 Mar 2011 13:51:47 +0100
parents c0a700f400d8
children a73f38d8bbdb
files hgext/relink.py tests/test-relink.t
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/relink.py	Wed Mar 16 13:25:12 2011 +0100
+++ b/hgext/relink.py	Wed Mar 16 13:51:47 2011 +0100
@@ -168,8 +168,8 @@
 
     ui.progress(_('relinking'), None)
 
-    ui.status(_('relinked %d files (%d bytes reclaimed)\n') %
-              (relinked, savedbytes))
+    ui.status(_('relinked %d files (%s reclaimed)\n') %
+              (relinked, util.bytecount(savedbytes)))
 
 cmdtable = {
     'relink': (
--- a/tests/test-relink.t	Wed Mar 16 13:25:12 2011 +0100
+++ b/tests/test-relink.t	Wed Mar 16 13:51:47 2011 +0100
@@ -25,10 +25,17 @@
   $ hg ci -Am addfile
   adding a
   adding b
-  $ echo a >> a
-  $ echo a >> b
+  $ cat $TESTDIR/binfile.bin >> a
+  $ cat $TESTDIR/binfile.bin >> b
   $ hg ci -Am changefiles
 
+make another commit to create files larger than 1 KB to test
+formatting of final byte count
+
+  $ cat $TESTDIR/binfile.bin >> a
+  $ cat $TESTDIR/binfile.bin >> b
+  $ hg ci -m anotherchange
+
 Test files are read in binary mode
 
   $ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')"
@@ -71,7 +78,7 @@
   pruned down to 2 probably relinkable files
   relinking: data/a.i 1/2 files (50.00%)
   not linkable: data/dummy.i
-  relinked 1 files (136 bytes reclaimed)
+  relinked 1 files (1.37 KB reclaimed)
   $ cd ..