# HG changeset patch # User Martin Geisler # Date 1300279907 -3600 # Node ID 0e200e1801f4741f52ce8525ca874369a96b6e5a # Parent c0a700f400d8229f2037f18c5afe42c293f1930b relink: format reclaimed byte count nicely diff -r c0a700f400d8 -r 0e200e1801f4 hgext/relink.py --- 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': ( diff -r c0a700f400d8 -r 0e200e1801f4 tests/test-relink.t --- 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 ..