2223 |
2223 |
2224 ##################################################################### |
2224 ##################################################################### |
2225 ### Obsolescence marker exchange experimenation ### |
2225 ### Obsolescence marker exchange experimenation ### |
2226 ##################################################################### |
2226 ##################################################################### |
2227 |
2227 |
2228 def obsexcmsg(ui, message): |
2228 def obsexcmsg(ui, message, important=False): |
2229 if ui.configbool('experimental', 'verbose-obsolescence-exchange', False): |
2229 verbose = ui.configbool('experimental', 'verbose-obsolescence-exchange', |
|
2230 False) |
|
2231 if verbose: |
2230 message = 'OBSEXC: ' + message |
2232 message = 'OBSEXC: ' + message |
|
2233 if important or verbose: |
2231 ui.status(message) |
2234 ui.status(message) |
2232 |
2235 |
2233 def obsexcprg(ui, *args, **kwargs): |
2236 def obsexcprg(ui, *args, **kwargs): |
2234 if ui.configbool('experimental', 'verbose-obsolescence-exchange', False): |
2237 if ui.configbool('experimental', 'verbose-obsolescence-exchange', False): |
2235 ui.progress('OBSEXC', *args, **kwargs) |
2238 ui.progress('OBSEXC', *args, **kwargs) |
2399 obsdata = pushobsmarkerStringIO() |
2402 obsdata = pushobsmarkerStringIO() |
2400 _encodemarkersstream(obsdata, markers) |
2403 _encodemarkersstream(obsdata, markers) |
2401 obsdata.seek(0) |
2404 obsdata.seek(0) |
2402 obsdata.ui = repo.ui |
2405 obsdata.ui = repo.ui |
2403 obsexcmsg(repo.ui, "pushing %i markers (%i bytes)\n" |
2406 obsexcmsg(repo.ui, "pushing %i markers (%i bytes)\n" |
2404 % (len(markers), len(obsdata.getvalue()))) |
2407 % (len(markers), len(obsdata.getvalue())), |
|
2408 True) |
2405 bundler.newpart('EVOLVE:B2X:OBSMARKERV1', data=obsdata) |
2409 bundler.newpart('EVOLVE:B2X:OBSMARKERV1', data=obsdata) |
2406 def callback(op): |
2410 def callback(op): |
2407 obsexcprg(repo.ui, None) |
2411 obsexcprg(repo.ui, None) |
2408 obsexcmsg(repo.ui, "DONE\n") |
2412 obsexcmsg(repo.ui, "DONE\n") |
2409 return callback |
2413 return callback |
2473 obsdata = pushobsmarkerStringIO() |
2477 obsdata = pushobsmarkerStringIO() |
2474 _encodemarkersstream(obsdata, markers) |
2478 _encodemarkersstream(obsdata, markers) |
2475 obsdata.seek(0) |
2479 obsdata.seek(0) |
2476 obsdata.ui = repo.ui |
2480 obsdata.ui = repo.ui |
2477 obsexcmsg(repo.ui, "pushing %i markers (%i bytes)\n" |
2481 obsexcmsg(repo.ui, "pushing %i markers (%i bytes)\n" |
2478 % (len(markers), len(obsdata.getvalue()))) |
2482 % (len(markers), len(obsdata.getvalue())), |
|
2483 True) |
2479 bundler = bundle2.bundle20(pushop.ui, {}) |
2484 bundler = bundle2.bundle20(pushop.ui, {}) |
2480 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) |
2485 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) |
2481 bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsblob)) |
2486 bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsblob)) |
2482 cgpart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1', data=obsdata) |
2487 cgpart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1', data=obsdata) |
2483 bundler.addpart(cgpart) |
2488 bundler.addpart(cgpart) |
2495 obsdata = pushobsmarkerStringIO() |
2500 obsdata = pushobsmarkerStringIO() |
2496 _encodemarkersstream(obsdata, markers) |
2501 _encodemarkersstream(obsdata, markers) |
2497 obsdata.seek(0) |
2502 obsdata.seek(0) |
2498 obsdata.ui = repo.ui |
2503 obsdata.ui = repo.ui |
2499 obsexcmsg(repo.ui, "pushing %i markers (%i bytes)\n" |
2504 obsexcmsg(repo.ui, "pushing %i markers (%i bytes)\n" |
2500 % (len(markers), len(obsdata.getvalue()))) |
2505 % (len(markers), len(obsdata.getvalue())), |
|
2506 True) |
2501 remote.evoext_pushobsmarkers_0(obsdata) |
2507 remote.evoext_pushobsmarkers_0(obsdata) |
2502 obsexcprg(repo.ui, None) |
2508 obsexcprg(repo.ui, None) |
2503 else: |
2509 else: |
2504 rslts = [] |
2510 rslts = [] |
2505 remotedata = _pushkeyescape(markers).items() |
2511 remotedata = _pushkeyescape(markers).items() |
2506 totalbytes = sum(len(d) for k,d in remotedata) |
2512 totalbytes = sum(len(d) for k,d in remotedata) |
2507 sentbytes = 0 |
2513 sentbytes = 0 |
2508 obsexcmsg(repo.ui, "pushing %i markers in %i pushkey payload (%i bytes)\n" |
2514 obsexcmsg(repo.ui, "pushing %i markers in %i pushkey payload (%i bytes)\n" |
2509 % (len(markers), len(remotedata), totalbytes)) |
2515 % (len(markers), len(remotedata), totalbytes), |
|
2516 True) |
2510 for key, data in remotedata: |
2517 for key, data in remotedata: |
2511 obsexcprg(repo.ui, sentbytes, item=key, unit="bytes", |
2518 obsexcprg(repo.ui, sentbytes, item=key, unit="bytes", |
2512 total=totalbytes) |
2519 total=totalbytes) |
2513 rslts.append(remote.pushkey('obsolete', key, '', data)) |
2520 rslts.append(remote.pushkey('obsolete', key, '', data)) |
2514 sentbytes += len(data) |
2521 sentbytes += len(data) |