Mercurial > hg-stable
comparison mercurial/exchange.py @ 21658:0696ca0a685b
pull: when remote supports it, pull phase data alongside changesets
We use bundle2 to retrieve the remote phase data at the same time as
changesets. This reduces the amount of requestis and should improve consistency
as the server can ensure nothing changed between the retrieval of those parts.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 27 May 2014 15:44:46 -0700 |
parents | 0ff44e06275d |
children | 09f19e09f1b4 |
comparison
equal
deleted
inserted
replaced
21657:0ff44e06275d | 21658:0696ca0a685b |
---|---|
530 | 530 |
531 def _pullbundle2(pullop): | 531 def _pullbundle2(pullop): |
532 """pull data using bundle2 | 532 """pull data using bundle2 |
533 | 533 |
534 For now, the only supported data are changegroup.""" | 534 For now, the only supported data are changegroup.""" |
535 remotecaps = bundle2.bundle2caps(pullop.remote) | |
535 kwargs = {'bundlecaps': caps20to10(pullop.repo)} | 536 kwargs = {'bundlecaps': caps20to10(pullop.repo)} |
536 # pulling changegroup | 537 # pulling changegroup |
537 pullop.todosteps.remove('changegroup') | 538 pullop.todosteps.remove('changegroup') |
538 | 539 |
539 kwargs['common'] = pullop.common | 540 kwargs['common'] = pullop.common |
540 kwargs['heads'] = pullop.heads or pullop.rheads | 541 kwargs['heads'] = pullop.heads or pullop.rheads |
542 if 'b2x:listkeys' in remotecaps: | |
543 kwargs['listkeys'] = ['phase'] | |
541 if not pullop.fetch: | 544 if not pullop.fetch: |
542 pullop.repo.ui.status(_("no changes found\n")) | 545 pullop.repo.ui.status(_("no changes found\n")) |
543 pullop.cgresult = 0 | 546 pullop.cgresult = 0 |
544 else: | 547 else: |
545 if pullop.heads is None and list(pullop.common) == [nullid]: | 548 if pullop.heads is None and list(pullop.common) == [nullid]: |
554 raise util.Abort('missing support for %s' % exc) | 557 raise util.Abort('missing support for %s' % exc) |
555 | 558 |
556 if pullop.fetch: | 559 if pullop.fetch: |
557 assert len(op.records['changegroup']) == 1 | 560 assert len(op.records['changegroup']) == 1 |
558 pullop.cgresult = op.records['changegroup'][0]['return'] | 561 pullop.cgresult = op.records['changegroup'][0]['return'] |
562 | |
563 # processing phases change | |
564 for namespace, value in op.records['listkeys']: | |
565 if namespace == 'phases': | |
566 _pullapplyphases(pullop, value) | |
559 | 567 |
560 def _pullbundle2extraprepare(pullop, kwargs): | 568 def _pullbundle2extraprepare(pullop, kwargs): |
561 """hook function so that extensions can extend the getbundle call""" | 569 """hook function so that extensions can extend the getbundle call""" |
562 pass | 570 pass |
563 | 571 |