##// END OF EJS Templates
exchange: use command executor interface for calling listkeys...
Gregory Szorc -
r37775:2a8ad00b default
parent child Browse files
Show More
@@ -591,7 +591,8 b' def _pushdiscoveryphase(pushop):'
591 (computed for both success and failure case for changesets push)"""
591 (computed for both success and failure case for changesets push)"""
592 outgoing = pushop.outgoing
592 outgoing = pushop.outgoing
593 unfi = pushop.repo.unfiltered()
593 unfi = pushop.repo.unfiltered()
594 remotephases = pushop.remote.listkeys('phases')
594 remotephases = listkeys(pushop.remote, 'phases')
595
595 if (pushop.ui.configbool('ui', '_usedassubrepo')
596 if (pushop.ui.configbool('ui', '_usedassubrepo')
596 and remotephases # server supports phases
597 and remotephases # server supports phases
597 and not pushop.outgoing.missing # no changesets to be pushed
598 and not pushop.outgoing.missing # no changesets to be pushed
@@ -638,14 +639,20 b' def _pushdiscoveryphase(pushop):'
638
639
639 @pushdiscovery('obsmarker')
640 @pushdiscovery('obsmarker')
640 def _pushdiscoveryobsmarkers(pushop):
641 def _pushdiscoveryobsmarkers(pushop):
641 if (obsolete.isenabled(pushop.repo, obsolete.exchangeopt)
642 if not obsolete.isenabled(pushop.repo, obsolete.exchangeopt):
642 and pushop.repo.obsstore
643 return
643 and 'obsolete' in pushop.remote.listkeys('namespaces')):
644
644 repo = pushop.repo
645 if not pushop.repo.obsstore:
645 # very naive computation, that can be quite expensive on big repo.
646 return
646 # However: evolution is currently slow on them anyway.
647
647 nodes = (c.node() for c in repo.set('::%ln', pushop.futureheads))
648 if 'obsolete' not in listkeys(pushop.remote, 'namespaces'):
648 pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(nodes)
649 return
650
651 repo = pushop.repo
652 # very naive computation, that can be quite expensive on big repo.
653 # However: evolution is currently slow on them anyway.
654 nodes = (c.node() for c in repo.set('::%ln', pushop.futureheads))
655 pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(nodes)
649
656
650 @pushdiscovery('bookmarks')
657 @pushdiscovery('bookmarks')
651 def _pushdiscoverybookmarks(pushop):
658 def _pushdiscoverybookmarks(pushop):
@@ -657,7 +664,8 b' def _pushdiscoverybookmarks(pushop):'
657 if pushop.revs:
664 if pushop.revs:
658 revnums = map(repo.changelog.rev, pushop.revs)
665 revnums = map(repo.changelog.rev, pushop.revs)
659 ancestors = repo.changelog.ancestors(revnums, inclusive=True)
666 ancestors = repo.changelog.ancestors(revnums, inclusive=True)
660 remotebookmark = remote.listkeys('bookmarks')
667
668 remotebookmark = listkeys(remote, 'bookmarks')
661
669
662 explicit = set([repo._bookmarks.expandname(bookmark)
670 explicit = set([repo._bookmarks.expandname(bookmark)
663 for bookmark in pushop.bookmarks])
671 for bookmark in pushop.bookmarks])
@@ -1168,7 +1176,7 b' def _pushsyncphase(pushop):'
1168 """synchronise phase information locally and remotely"""
1176 """synchronise phase information locally and remotely"""
1169 cheads = pushop.commonheads
1177 cheads = pushop.commonheads
1170 # even when we don't push, exchanging phase data is useful
1178 # even when we don't push, exchanging phase data is useful
1171 remotephases = pushop.remote.listkeys('phases')
1179 remotephases = listkeys(pushop.remote, 'phases')
1172 if (pushop.ui.configbool('ui', '_usedassubrepo')
1180 if (pushop.ui.configbool('ui', '_usedassubrepo')
1173 and remotephases # server supports phases
1181 and remotephases # server supports phases
1174 and pushop.cgresult is None # nothing was pushed
1182 and pushop.cgresult is None # nothing was pushed
@@ -1392,6 +1400,10 b' class transactionmanager(util.transactio'
1392 if self._tr is not None:
1400 if self._tr is not None:
1393 self._tr.release()
1401 self._tr.release()
1394
1402
1403 def listkeys(remote, namespace):
1404 with remote.commandexecutor() as e:
1405 return e.callcommand('listkeys', {'namespace': namespace}).result()
1406
1395 def _fullpullbundle2(repo, pullop):
1407 def _fullpullbundle2(repo, pullop):
1396 # The server may send a partial reply, i.e. when inlining
1408 # The server may send a partial reply, i.e. when inlining
1397 # pre-computed bundles. In that case, update the common
1409 # pre-computed bundles. In that case, update the common
@@ -1529,7 +1541,7 b' def _pullbookmarkbundle1(pullop):'
1529 # all known bundle2 servers now support listkeys, but lets be nice with
1541 # all known bundle2 servers now support listkeys, but lets be nice with
1530 # new implementation.
1542 # new implementation.
1531 return
1543 return
1532 books = pullop.remote.listkeys('bookmarks')
1544 books = listkeys(pullop.remote, 'bookmarks')
1533 pullop.remotebookmarks = bookmod.unhexlifybookmarks(books)
1545 pullop.remotebookmarks = bookmod.unhexlifybookmarks(books)
1534
1546
1535
1547
@@ -1741,7 +1753,7 b' def _pullphase(pullop):'
1741 # Get remote phases data from remote
1753 # Get remote phases data from remote
1742 if 'phases' in pullop.stepsdone:
1754 if 'phases' in pullop.stepsdone:
1743 return
1755 return
1744 remotephases = pullop.remote.listkeys('phases')
1756 remotephases = listkeys(pullop.remote, 'phases')
1745 _pullapplyphases(pullop, remotephases)
1757 _pullapplyphases(pullop, remotephases)
1746
1758
1747 def _pullapplyphases(pullop, remotephases):
1759 def _pullapplyphases(pullop, remotephases):
@@ -1805,7 +1817,7 b' def _pullobsolete(pullop):'
1805 tr = None
1817 tr = None
1806 if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
1818 if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
1807 pullop.repo.ui.debug('fetching remote obsolete markers\n')
1819 pullop.repo.ui.debug('fetching remote obsolete markers\n')
1808 remoteobs = pullop.remote.listkeys('obsolete')
1820 remoteobs = listkeys(pullop.remote, 'obsolete')
1809 if 'dump0' in remoteobs:
1821 if 'dump0' in remoteobs:
1810 tr = pullop.gettransaction()
1822 tr = pullop.gettransaction()
1811 markers = []
1823 markers = []
General Comments 0
You need to be logged in to leave comments. Login now