changeset 961:8de88b323fb6

evolve: install progress support for the bundle2 push path The custom wireprotocol command had a trick to display progress while pushing. We reinstall such logic for the new path using bundle2.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 20 May 2014 17:21:36 -0700
parents 0c1142059a82
children d04a52f40f41
files hgext/evolve.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Tue May 20 14:39:13 2014 -0700
+++ b/hgext/evolve.py	Tue May 20 17:21:36 2014 -0700
@@ -2247,6 +2247,12 @@
                          total=self.length)
         return StringIO.read(self, size)
 
+    def __iter__(self):
+        d = self.read(4096)
+        while d:
+            yield d
+            d = self.read(4096)
+
 
 
 @eh.wrapfunction(exchange, '_pushobsolete')
@@ -2278,15 +2284,16 @@
         if not markers:
             repo.ui.status("OBSEXC: no marker to push\n")
         elif remote.capable('_evoext_b2x_obsmarkers_0'):
-            obsdata = StringIO()
+            obsdata = pushobsmarkerStringIO()
             _encodemarkersstream(obsdata, markers)
             obsdata.seek(0)
+            obsdata.ui = repo.ui
             repo.ui.status("OBSEXC: pushing %i markers (%i bytes)\n"
                            % (len(markers), len(obsdata.getvalue())))
             bundler = bundle2.bundle20(pushop.ui, {})
             capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
             bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsblob))
-            cgpart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1', data=obsdata.getvalue())
+            cgpart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1', data=obsdata)
             bundler.addpart(cgpart)
             stream = util.chunkbuffer(bundler.getchunks())
             try:
@@ -2297,6 +2304,7 @@
                 op = bundle2.processbundle(pushop.repo, reply)
             except bundle2.UnknownPartError, exc:
                 raise util.Abort('missing support for %s' % exc)
+            repo.ui.progress('OBSEXC', None)
         elif remote.capable('_evoext_pushobsmarkers_0'):
             obsdata = pushobsmarkerStringIO()
             _encodemarkersstream(obsdata, markers)