2316 d = self.read(4096) |
2316 d = self.read(4096) |
2317 while d: |
2317 while d: |
2318 yield d |
2318 yield d |
2319 d = self.read(4096) |
2319 d = self.read(4096) |
2320 |
2320 |
2321 |
2321 bundle2partsgenerators = getattr(exchange, 'bundle2partsgenerators', None) |
|
2322 |
|
2323 if bundle2partsgenerators is not None: |
|
2324 def _pushb2obsmarker(pushop, bundler): |
|
2325 """adds obsmarker to the main bundle2 push""" |
|
2326 repo = pushop.repo |
|
2327 remote = pushop.remote |
|
2328 if ('obsmarkers' not in pushop.stepsdone |
|
2329 and (obsolete._enabled and repo.obsstore and |
|
2330 'obsolete' in remote.listkeys('namespaces')) |
|
2331 and remote.capable('_evoext_b2x_obsmarkers_0')): |
|
2332 # |
|
2333 pushop.stepsdone.add('obsmarkers') |
|
2334 markers = _obsmarkersdiscovery(pushop) |
|
2335 if not markers: |
|
2336 repo.ui.status("OBSEXC: no marker to push\n") |
|
2337 repo.ui.status("OBSEXC: DONE\n") |
|
2338 return |
|
2339 obsdata = pushobsmarkerStringIO() |
|
2340 _encodemarkersstream(obsdata, markers) |
|
2341 obsdata.seek(0) |
|
2342 obsdata.ui = repo.ui |
|
2343 repo.ui.status("OBSEXC: pushing %i markers (%i bytes)\n" |
|
2344 % (len(markers), len(obsdata.getvalue()))) |
|
2345 bundler.newpart('EVOLVE:B2X:OBSMARKERV1', data=obsdata) |
|
2346 def callback(op): |
|
2347 repo.ui.progress('OBSEXC', None) |
|
2348 repo.ui.status("OBSEXC: DONE\n") |
|
2349 return callback |
|
2350 bundle2partsgenerators.append(_pushb2obsmarker) |
2322 |
2351 |
2323 |
2352 |
2324 def _obsmarkersdiscovery(pushop): |
2353 def _obsmarkersdiscovery(pushop): |
2325 """return the list of marker that needs to be pushed to the server |
2354 """return the list of marker that needs to be pushed to the server |
2326 |
2355 |
2332 remote = pushop.remote |
2361 remote = pushop.remote |
2333 unfi = repo.unfiltered() |
2362 unfi = repo.unfiltered() |
2334 cl = unfi.changelog |
2363 cl = unfi.changelog |
2335 commonheads = pushop.commonheads |
2364 commonheads = pushop.commonheads |
2336 if commonheads is None: |
2365 if commonheads is None: |
2337 # ctx not pushed yet, we try to be in the same bundle2 |
2366 if pushop.revs is None: |
2338 commonheads = pushop.outgoing.missingheads |
2367 commonheads = pushop.outgoing.commonheads |
|
2368 sch = set(commonheads) |
|
2369 commonheads.extend(h for h in pushop.outgoing.missingheads |
|
2370 if h not in sch) |
|
2371 else: |
|
2372 commonheads = pushop.outgoing.missingheads |
2339 if (obsolete._enabled and repo.obsstore and |
2373 if (obsolete._enabled and repo.obsstore and |
2340 'obsolete' in remote.listkeys('namespaces')): |
2374 'obsolete' in remote.listkeys('namespaces')): |
2341 repo.ui.status("OBSEXC: computing relevant nodes\n") |
2375 repo.ui.status("OBSEXC: computing relevant nodes\n") |
2342 revs = unfi.revs('::%ln', commonheads) |
2376 revs = unfi.revs('::%ln', commonheads) |
2343 common = [] |
2377 common = [] |
2344 if remote.capable('_evoext_obshash_0'): |
2378 if remote.capable('_evoext_obshash_0'): |
2345 repo.ui.status("OBSEXC: looking for common markers in %i nodes\n" |
2379 repo.ui.status("OBSEXC: looking for common markers in %i nodes\n" |
2346 % len(revs)) |
2380 % len(revs)) |
2347 common = findcommonobsmarkers(pushop.ui, repo, remote, revs) |
2381 common = findcommonobsmarkers(pushop.ui, unfi, remote, revs) |
2348 revs = list(unfi.revs('%ld - (::%ln)', revs, common)) |
2382 revs = list(unfi.revs('%ld - (::%ln)', revs, common)) |
2349 nodes = [cl.node(r) for r in revs] |
2383 nodes = [cl.node(r) for r in revs] |
2350 if nodes: |
2384 if nodes: |
2351 repo.ui.status("OBSEXC: computing markers relevant to %i nodes\n" |
2385 repo.ui.status("OBSEXC: computing markers relevant to %i nodes\n" |
2352 % len(nodes)) |
2386 % len(nodes)) |