comparison mercurial/exchange.py @ 35761:1908d360f977

pull: reorganize bundle2 argument bundling We are about to add the ability to use stream bundle with bundle2. Before doing so, we need to gather some code that will not be used in the bundle2 case. There is no behavior change within this changeset.
author Boris Feld <boris.feld@octobus.net>
date Wed, 17 Jan 2018 16:32:05 +0100
parents c24dad55ac19
children 40df727b6f4f
comparison
equal deleted inserted replaced
35760:133a678673cb 35761:1908d360f977
1448 """pull data using bundle2 1448 """pull data using bundle2
1449 1449
1450 For now, the only supported data are changegroup.""" 1450 For now, the only supported data are changegroup."""
1451 kwargs = {'bundlecaps': caps20to10(pullop.repo)} 1451 kwargs = {'bundlecaps': caps20to10(pullop.repo)}
1452 1452
1453 # make ui easier to access
1454 ui = pullop.repo.ui
1455
1453 # At the moment we don't do stream clones over bundle2. If that is 1456 # At the moment we don't do stream clones over bundle2. If that is
1454 # implemented then here's where the check for that will go. 1457 # implemented then here's where the check for that will go.
1455 streaming = False 1458 streaming = False
1456 1459
1460 # declare pull perimeters
1461 kwargs['common'] = pullop.common
1462 kwargs['heads'] = pullop.heads or pullop.rheads
1463
1457 # pulling changegroup 1464 # pulling changegroup
1458 pullop.stepsdone.add('changegroup') 1465 pullop.stepsdone.add('changegroup')
1459 1466
1460 kwargs['common'] = pullop.common
1461 kwargs['heads'] = pullop.heads or pullop.rheads
1462 kwargs['cg'] = pullop.fetch 1467 kwargs['cg'] = pullop.fetch
1463 1468
1464 ui = pullop.repo.ui
1465 legacyphase = 'phases' in ui.configlist('devel', 'legacy.exchange') 1469 legacyphase = 'phases' in ui.configlist('devel', 'legacy.exchange')
1466 hasbinaryphase = 'heads' in pullop.remotebundle2caps.get('phases', ()) 1470 hasbinaryphase = 'heads' in pullop.remotebundle2caps.get('phases', ())
1467 if (not legacyphase and hasbinaryphase): 1471 if (not legacyphase and hasbinaryphase):
1468 kwargs['phases'] = True 1472 kwargs['phases'] = True
1469 pullop.stepsdone.add('phases') 1473 pullop.stepsdone.add('phases')
1470 1474
1475 if 'listkeys' in pullop.remotebundle2caps:
1476 if 'phases' not in pullop.stepsdone:
1477 kwargs['listkeys'] = ['phases']
1478
1471 bookmarksrequested = False 1479 bookmarksrequested = False
1472 legacybookmark = 'bookmarks' in ui.configlist('devel', 'legacy.exchange') 1480 legacybookmark = 'bookmarks' in ui.configlist('devel', 'legacy.exchange')
1473 hasbinarybook = 'bookmarks' in pullop.remotebundle2caps 1481 hasbinarybook = 'bookmarks' in pullop.remotebundle2caps
1474 1482
1475 if pullop.remotebookmarks is not None: 1483 if pullop.remotebookmarks is not None:
1480 and not legacybookmark and hasbinarybook): 1488 and not legacybookmark and hasbinarybook):
1481 kwargs['bookmarks'] = True 1489 kwargs['bookmarks'] = True
1482 bookmarksrequested = True 1490 bookmarksrequested = True
1483 1491
1484 if 'listkeys' in pullop.remotebundle2caps: 1492 if 'listkeys' in pullop.remotebundle2caps:
1485 if 'phases' not in pullop.stepsdone:
1486 kwargs['listkeys'] = ['phases']
1487 if 'request-bookmarks' not in pullop.stepsdone: 1493 if 'request-bookmarks' not in pullop.stepsdone:
1488 # make sure to always includes bookmark data when migrating 1494 # make sure to always includes bookmark data when migrating
1489 # `hg incoming --bundle` to using this function. 1495 # `hg incoming --bundle` to using this function.
1490 pullop.stepsdone.add('request-bookmarks') 1496 pullop.stepsdone.add('request-bookmarks')
1491 kwargs.setdefault('listkeys', []).append('bookmarks') 1497 kwargs.setdefault('listkeys', []).append('bookmarks')