changeset 853:b82b49189328

exchange: add progress bar when pulling using wire protocol command progress bar on pull was only available for pushkey based pull before this changeset.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 03 Mar 2014 22:18:05 -0800
parents aa722de36179
children 86b826399dfd
files hgext/evolve.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2249,7 +2249,18 @@
     f = self._callstream("evoext_pullobsmarkers_0", **opts)
     f = self._decompress(f)
     length= int(f.read(20))
-    return StringIO(f.read(length))
+    chunk = 4096
+    current = 0
+    data = StringIO()
+    ui = self.ui
+    ui.progress('OBSEXC', current, unit="bytes", total=length)
+    while current < length:
+        readsize = min(length-current, chunk)
+        data.write(f.read(readsize))
+        current += readsize
+        ui.progress('OBSEXC', current, unit="bytes", total=length)
+    ui.progress('OBSEXC', None)
+    return data
 
 @eh.addattr(localrepo.localpeer, 'evoext_pullobsmarkers_0')
 def local_pullobsmarkers(self, heads=None, common=None):