hgext/evolve.py
changeset 962 d04a52f40f41
parent 961 8de88b323fb6
child 973 6d691fefdbd1
child 976 bed842762447
--- a/hgext/evolve.py	Tue May 20 17:21:36 2014 -0700
+++ b/hgext/evolve.py	Tue May 20 22:36:47 2014 -0700
@@ -2382,7 +2382,22 @@
 def handleobsmarkerv1(op, inpart):
     """add a stream of obsmarker to the repo"""
     tr = op.gettransaction()
-    obsdata = inpart.read()
+    advparams = dict(inpart.advisoryparams)
+    length = advparams.get('totalbytes')
+    if length is None:
+        obsdata = inpart.read()
+    else:
+        length = int(length)
+        data = StringIO()
+        current = 0
+        op.ui.progress('OBSEXC', current, unit="bytes", total=length)
+        while current < length:
+            readsize = min(length-current, 4096)
+            data.write(inpart.read(readsize))
+            current += readsize
+            op.ui.progress('OBSEXC', current, unit="bytes", total=length)
+        op.ui.progress('OBSEXC', None)
+        obsdata = data.getvalue()
     totalsize = len(obsdata)
     old = len(op.repo.obsstore._all)
     op.repo.obsstore.mergemarkers(tr, obsdata)
@@ -2429,7 +2444,10 @@
         heads = wireproto.decodelist(heads)
         obsdata = _getobsmarkersstream(repo, common=common, heads=heads)
         if len(obsdata.getvalue()) > 5:
-            obspart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1', data=obsdata)
+            advparams = [('totalbytes', str(len(obsdata.getvalue())))]
+            obspart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1',
+                                         advisoryparams=advparams,
+                                         data=obsdata)
             bundler.addpart(obspart)
     orig(bundler, repo, source)