mercurial/exchange.py
changeset 26464 9a7fc6d48898
parent 26462 3b0ec09192ae
child 26465 eda32ee9962f
equal deleted inserted replaced
26463:b3188339a772 26464:9a7fc6d48898
   891         else:
   891         else:
   892             # We pulled a specific subset
   892             # We pulled a specific subset
   893             # sync on this subset
   893             # sync on this subset
   894             return self.heads
   894             return self.heads
   895 
   895 
       
   896     @util.propertycache
       
   897     def remotebundle2caps(self):
       
   898         return bundle2.bundle2caps(self.remote)
       
   899 
   896     def gettransaction(self):
   900     def gettransaction(self):
   897         # deprecated; talk to trmanager directly
   901         # deprecated; talk to trmanager directly
   898         return self.trmanager.transaction()
   902         return self.trmanager.transaction()
   899 
   903 
   900 class transactionmanager(object):
   904 class transactionmanager(object):
  1015 
  1019 
  1016     If not using bundle2, we have to fetch bookmarks before changeset
  1020     If not using bundle2, we have to fetch bookmarks before changeset
  1017     discovery to reduce the chance and impact of race conditions."""
  1021     discovery to reduce the chance and impact of race conditions."""
  1018     if pullop.remotebookmarks is not None:
  1022     if pullop.remotebookmarks is not None:
  1019         return
  1023         return
  1020     if (_canusebundle2(pullop)
  1024     if _canusebundle2(pullop) and 'listkeys' in pullop.remotebundle2caps:
  1021             and 'listkeys' in bundle2.bundle2caps(pullop.remote)):
       
  1022         # all known bundle2 servers now support listkeys, but lets be nice with
  1025         # all known bundle2 servers now support listkeys, but lets be nice with
  1023         # new implementation.
  1026         # new implementation.
  1024         return
  1027         return
  1025     pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
  1028     pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
  1026 
  1029 
  1065 
  1068 
  1066 def _pullbundle2(pullop):
  1069 def _pullbundle2(pullop):
  1067     """pull data using bundle2
  1070     """pull data using bundle2
  1068 
  1071 
  1069     For now, the only supported data are changegroup."""
  1072     For now, the only supported data are changegroup."""
  1070     remotecaps = bundle2.bundle2caps(pullop.remote)
       
  1071     kwargs = {'bundlecaps': caps20to10(pullop.repo)}
  1073     kwargs = {'bundlecaps': caps20to10(pullop.repo)}
  1072     # pulling changegroup
  1074     # pulling changegroup
  1073     pullop.stepsdone.add('changegroup')
  1075     pullop.stepsdone.add('changegroup')
  1074 
  1076 
  1075     kwargs['common'] = pullop.common
  1077     kwargs['common'] = pullop.common
  1076     kwargs['heads'] = pullop.heads or pullop.rheads
  1078     kwargs['heads'] = pullop.heads or pullop.rheads
  1077     kwargs['cg'] = pullop.fetch
  1079     kwargs['cg'] = pullop.fetch
  1078     if 'listkeys' in remotecaps:
  1080     if 'listkeys' in pullop.remotebundle2caps:
  1079         kwargs['listkeys'] = ['phase']
  1081         kwargs['listkeys'] = ['phase']
  1080         if pullop.remotebookmarks is None:
  1082         if pullop.remotebookmarks is None:
  1081             # make sure to always includes bookmark data when migrating
  1083             # make sure to always includes bookmark data when migrating
  1082             # `hg incoming --bundle` to using this function.
  1084             # `hg incoming --bundle` to using this function.
  1083             kwargs['listkeys'].append('bookmarks')
  1085             kwargs['listkeys'].append('bookmarks')
  1086         pullop.cgresult = 0
  1088         pullop.cgresult = 0
  1087     else:
  1089     else:
  1088         if pullop.heads is None and list(pullop.common) == [nullid]:
  1090         if pullop.heads is None and list(pullop.common) == [nullid]:
  1089             pullop.repo.ui.status(_("requesting all changes\n"))
  1091             pullop.repo.ui.status(_("requesting all changes\n"))
  1090     if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
  1092     if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
  1091         remoteversions = bundle2.obsmarkersversion(remotecaps)
  1093         remoteversions = bundle2.obsmarkersversion(pullop.remotebundle2caps)
  1092         if obsolete.commonversion(remoteversions) is not None:
  1094         if obsolete.commonversion(remoteversions) is not None:
  1093             kwargs['obsmarkers'] = True
  1095             kwargs['obsmarkers'] = True
  1094             pullop.stepsdone.add('obsmarkers')
  1096             pullop.stepsdone.add('obsmarkers')
  1095     _pullbundle2extraprepare(pullop, kwargs)
  1097     _pullbundle2extraprepare(pullop, kwargs)
  1096     bundle = pullop.remote.getbundle('pull', **kwargs)
  1098     bundle = pullop.remote.getbundle('pull', **kwargs)