Mercurial > evolve
comparison hgext/evolve.py @ 1097:580a2d838996
pull: use discovery to pull less obsmarkers through bundle2
This hooks in the official API for bundle2
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 29 Aug 2014 16:13:19 +0200 |
parents | 661f3a112f7a |
children | 1c227ecb744d |
comparison
equal
deleted
inserted
replaced
1096:661f3a112f7a | 1097:580a2d838996 |
---|---|
2492 common = findcommonobsmarkers(repo.ui, repo, remote, revs) | 2492 common = findcommonobsmarkers(repo.ui, repo, remote, revs) |
2493 return {'heads': pullop.pulledsubset, 'common': common} | 2493 return {'heads': pullop.pulledsubset, 'common': common} |
2494 | 2494 |
2495 @eh.uisetup | 2495 @eh.uisetup |
2496 def addgetbundleargs(self): | 2496 def addgetbundleargs(self): |
2497 gboptsmap['evo_obscommon'] = 'plain' | 2497 gboptsmap['evo_obscommon'] = 'nodes' |
2498 | |
2499 @eh.wrapfunction(exchange, '_pullbundle2extraprepare') | |
2500 def _addobscommontob2pull(orig, pullop, kwargs): | |
2501 ret = orig(pullop, kwargs) | |
2502 if 'obsmarkers' in kwargs and pullop.remote.capable('_evoext_getbundle_obscommon'): | |
2503 boundaries = _buildpullobsmarkersboundaries(pullop) | |
2504 common = boundaries['common'] | |
2505 if common != [nullid]: | |
2506 kwargs['evo_obscommon'] = common | |
2507 return ret | |
2508 | |
2509 @eh.wrapfunction(exchange, '_getbundleobsmarkerpart') | |
2510 def _getbundleobsmarkerpart(orig, bundler, repo, source, heads=None, common=None, | |
2511 bundlecaps=None, **kwargs): | |
2512 if 'evo_obscommon' not in kwargs: | |
2513 return orig(bundler, repo, source, heads, common, bundlecaps, **kwargs) | |
2514 | |
2515 if kwargs.get('obsmarkers', False): | |
2516 if heads is None: | |
2517 heads = repo.heads() | |
2518 obscommon = kwargs.get('evo_obscommon', ()) | |
2519 obsset = repo.set('::%ln - ::%ln', heads, obscommon) | |
2520 subset = [c.node() for c in obsset] | |
2521 markers = repo.obsstore.relevantmarkers(subset) | |
2522 exchange.buildobsmarkerspart(bundler, markers) | |
2523 | |
2498 | 2524 |
2499 @eh.wrapfunction(exchange, '_pullobsolete') | 2525 @eh.wrapfunction(exchange, '_pullobsolete') |
2500 def _pullobsolete(orig, pullop): | 2526 def _pullobsolete(orig, pullop): |
2501 if not obsolete._enabled: | 2527 if not obsolete._enabled: |
2502 return None | 2528 return None |