[PATCH 10 of 11] streamclone: specify unit for ui.progress when handling data

Anton Shestakov av6 at dwimlabs.net
Fri Mar 11 09:57:42 EST 2016


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1457706507 -28800
#      Fri Mar 11 22:28:27 2016 +0800
# Node ID 31d10bad475e0fccaf0198be7b989cd8728c7857
# Parent  121bf926133b31daad362653c50082068e730f04
streamclone: specify unit for ui.progress when handling data

diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -270,11 +270,12 @@ def generatebundlev1(repo, compression='
         assert compression == 'UN'
 
         seen = 0
-        repo.ui.progress(_('bundle'), 0, total=bytecount)
+        repo.ui.progress(_('bundle'), 0, total=bytecount, unit=_('bytes'))
 
         for chunk in it:
             seen += len(chunk)
-            repo.ui.progress(_('bundle'), seen, total=bytecount)
+            repo.ui.progress(_('bundle'), seen, total=bytecount,
+                             unit=_('bytes'))
             yield chunk
 
         repo.ui.progress(_('bundle'), None)
@@ -294,7 +295,7 @@ def consumev1(repo, fp, filecount, bytec
         repo.ui.status(_('%d files to transfer, %s of data\n') %
                        (filecount, util.bytecount(bytecount)))
         handled_bytes = 0
-        repo.ui.progress(_('clone'), 0, total=bytecount)
+        repo.ui.progress(_('clone'), 0, total=bytecount, unit=_('bytes'))
         start = time.time()
 
         with repo.transaction('clone'):
@@ -317,7 +318,7 @@ def consumev1(repo, fp, filecount, bytec
                         for chunk in util.filechunkiter(fp, limit=size):
                             handled_bytes += len(chunk)
                             repo.ui.progress(_('clone'), handled_bytes,
-                                             total=bytecount)
+                                             total=bytecount, unit=_('bytes'))
                             ofp.write(chunk)
 
         # Writing straight to files circumvented the inmemory caches


More information about the Mercurial-devel mailing list