2245 def read(self, size): |
2245 def read(self, size): |
2246 self.ui.progress('OBSEXC', self.tell(), unit="bytes", |
2246 self.ui.progress('OBSEXC', self.tell(), unit="bytes", |
2247 total=self.length) |
2247 total=self.length) |
2248 return StringIO.read(self, size) |
2248 return StringIO.read(self, size) |
2249 |
2249 |
|
2250 def __iter__(self): |
|
2251 d = self.read(4096) |
|
2252 while d: |
|
2253 yield d |
|
2254 d = self.read(4096) |
|
2255 |
2250 |
2256 |
2251 |
2257 |
2252 @eh.wrapfunction(exchange, '_pushobsolete') |
2258 @eh.wrapfunction(exchange, '_pushobsolete') |
2253 def _pushobsolete(orig, pushop): |
2259 def _pushobsolete(orig, pushop): |
2254 """utility function to push obsolete markers to a remote""" |
2260 """utility function to push obsolete markers to a remote""" |
2276 repo.ui.status("OBSEXC: markers already in sync\n") |
2282 repo.ui.status("OBSEXC: markers already in sync\n") |
2277 markers = [] |
2283 markers = [] |
2278 if not markers: |
2284 if not markers: |
2279 repo.ui.status("OBSEXC: no marker to push\n") |
2285 repo.ui.status("OBSEXC: no marker to push\n") |
2280 elif remote.capable('_evoext_b2x_obsmarkers_0'): |
2286 elif remote.capable('_evoext_b2x_obsmarkers_0'): |
2281 obsdata = StringIO() |
2287 obsdata = pushobsmarkerStringIO() |
2282 _encodemarkersstream(obsdata, markers) |
2288 _encodemarkersstream(obsdata, markers) |
2283 obsdata.seek(0) |
2289 obsdata.seek(0) |
|
2290 obsdata.ui = repo.ui |
2284 repo.ui.status("OBSEXC: pushing %i markers (%i bytes)\n" |
2291 repo.ui.status("OBSEXC: pushing %i markers (%i bytes)\n" |
2285 % (len(markers), len(obsdata.getvalue()))) |
2292 % (len(markers), len(obsdata.getvalue()))) |
2286 bundler = bundle2.bundle20(pushop.ui, {}) |
2293 bundler = bundle2.bundle20(pushop.ui, {}) |
2287 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) |
2294 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) |
2288 bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsblob)) |
2295 bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsblob)) |
2289 cgpart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1', data=obsdata.getvalue()) |
2296 cgpart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1', data=obsdata) |
2290 bundler.addpart(cgpart) |
2297 bundler.addpart(cgpart) |
2291 stream = util.chunkbuffer(bundler.getchunks()) |
2298 stream = util.chunkbuffer(bundler.getchunks()) |
2292 try: |
2299 try: |
2293 reply = pushop.remote.unbundle(stream, ['force'], 'push') |
2300 reply = pushop.remote.unbundle(stream, ['force'], 'push') |
2294 except bundle2.UnknownPartError, exc: |
2301 except bundle2.UnknownPartError, exc: |
2295 raise util.Abort('missing support for %s' % exc) |
2302 raise util.Abort('missing support for %s' % exc) |
2296 try: |
2303 try: |
2297 op = bundle2.processbundle(pushop.repo, reply) |
2304 op = bundle2.processbundle(pushop.repo, reply) |
2298 except bundle2.UnknownPartError, exc: |
2305 except bundle2.UnknownPartError, exc: |
2299 raise util.Abort('missing support for %s' % exc) |
2306 raise util.Abort('missing support for %s' % exc) |
|
2307 repo.ui.progress('OBSEXC', None) |
2300 elif remote.capable('_evoext_pushobsmarkers_0'): |
2308 elif remote.capable('_evoext_pushobsmarkers_0'): |
2301 obsdata = pushobsmarkerStringIO() |
2309 obsdata = pushobsmarkerStringIO() |
2302 _encodemarkersstream(obsdata, markers) |
2310 _encodemarkersstream(obsdata, markers) |
2303 obsdata.seek(0) |
2311 obsdata.seek(0) |
2304 obsdata.ui = repo.ui |
2312 obsdata.ui = repo.ui |