mercurial/exchange.py
changeset 46713 bc2519513ae0
parent 46711 a41565bef69f
child 46780 6266d19556ad
equal deleted inserted replaced
46712:e8c11a2c96c0 46713:bc2519513ae0
   418             _(
   418             _(
   419                 b'cannot push: destination does not support the '
   419                 b'cannot push: destination does not support the '
   420                 b'unbundle wire protocol command'
   420                 b'unbundle wire protocol command'
   421             )
   421             )
   422         )
   422         )
   423 
   423     for category in sorted(bundle2.read_remote_wanted_sidedata(pushop.remote)):
       
   424         # Check that a computer is registered for that category for at least
       
   425         # one revlog kind.
       
   426         for kind, computers in repo._sidedata_computers.items():
       
   427             if computers.get(category):
       
   428                 break
       
   429         else:
       
   430             raise error.Abort(
       
   431                 _(
       
   432                     b'cannot push: required sidedata category not supported'
       
   433                     b" by this client: '%s'"
       
   434                 )
       
   435                 % pycompat.bytestr(category)
       
   436             )
   424     # get lock as we might write phase data
   437     # get lock as we might write phase data
   425     wlock = lock = None
   438     wlock = lock = None
   426     try:
   439     try:
   427         # bundle2 push may receive a reply bundle touching bookmarks
   440         # bundle2 push may receive a reply bundle touching bookmarks
   428         # requiring the wlock. Take it now to ensure proper ordering.
   441         # requiring the wlock. Take it now to ensure proper ordering.
   863             if v in changegroup.supportedoutgoingversions(pushop.repo)
   876             if v in changegroup.supportedoutgoingversions(pushop.repo)
   864         ]
   877         ]
   865         if not cgversions:
   878         if not cgversions:
   866             raise error.Abort(_(b'no common changegroup version'))
   879             raise error.Abort(_(b'no common changegroup version'))
   867         version = max(cgversions)
   880         version = max(cgversions)
       
   881 
       
   882     remote_sidedata = bundle2.read_remote_wanted_sidedata(pushop.remote)
   868     cgstream = changegroup.makestream(
   883     cgstream = changegroup.makestream(
   869         pushop.repo, pushop.outgoing, version, b'push'
   884         pushop.repo,
       
   885         pushop.outgoing,
       
   886         version,
       
   887         b'push',
       
   888         bundlecaps=b2caps,
       
   889         remote_sidedata=remote_sidedata,
   870     )
   890     )
   871     cgpart = bundler.newpart(b'changegroup', data=cgstream)
   891     cgpart = bundler.newpart(b'changegroup', data=cgstream)
   872     if cgversions:
   892     if cgversions:
   873         cgpart.addparam(b'version', version)
   893         cgpart.addparam(b'version', version)
   874     if scmutil.istreemanifest(pushop.repo):
   894     if scmutil.istreemanifest(pushop.repo):
  1605                 b" supported in the destination:"
  1625                 b" supported in the destination:"
  1606                 b" %s"
  1626                 b" %s"
  1607             ) % (b', '.join(sorted(missing)))
  1627             ) % (b', '.join(sorted(missing)))
  1608             raise error.Abort(msg)
  1628             raise error.Abort(msg)
  1609 
  1629 
       
  1630     for category in repo._wanted_sidedata:
       
  1631         # Check that a computer is registered for that category for at least
       
  1632         # one revlog kind.
       
  1633         for kind, computers in repo._sidedata_computers.items():
       
  1634             if computers.get(category):
       
  1635                 break
       
  1636         else:
       
  1637             # This should never happen since repos are supposed to be able to
       
  1638             # generate the sidedata they require.
       
  1639             raise error.ProgrammingError(
       
  1640                 _(
       
  1641                     b'sidedata category requested by local side without local'
       
  1642                     b"support: '%s'"
       
  1643                 )
       
  1644                 % pycompat.bytestr(category)
       
  1645             )
       
  1646 
  1610     pullop.trmanager = transactionmanager(repo, b'pull', remote.url())
  1647     pullop.trmanager = transactionmanager(repo, b'pull', remote.url())
  1611     wlock = util.nullcontextmanager()
  1648     wlock = util.nullcontextmanager()
  1612     if not bookmod.bookmarksinstore(repo):
  1649     if not bookmod.bookmarksinstore(repo):
  1613         wlock = repo.wlock()
  1650         wlock = repo.wlock()
  1614     with wlock, repo.lock(), pullop.trmanager:
  1651     with wlock, repo.lock(), pullop.trmanager:
  1817         remoteversions = bundle2.obsmarkersversion(pullop.remotebundle2caps)
  1854         remoteversions = bundle2.obsmarkersversion(pullop.remotebundle2caps)
  1818         if obsolete.commonversion(remoteversions) is not None:
  1855         if obsolete.commonversion(remoteversions) is not None:
  1819             kwargs[b'obsmarkers'] = True
  1856             kwargs[b'obsmarkers'] = True
  1820             pullop.stepsdone.add(b'obsmarkers')
  1857             pullop.stepsdone.add(b'obsmarkers')
  1821     _pullbundle2extraprepare(pullop, kwargs)
  1858     _pullbundle2extraprepare(pullop, kwargs)
       
  1859 
       
  1860     remote_sidedata = bundle2.read_remote_wanted_sidedata(pullop.remote)
       
  1861     if remote_sidedata:
       
  1862         kwargs[b'remote_sidedata'] = remote_sidedata
  1822 
  1863 
  1823     with pullop.remote.commandexecutor() as e:
  1864     with pullop.remote.commandexecutor() as e:
  1824         args = dict(kwargs)
  1865         args = dict(kwargs)
  1825         args[b'source'] = b'pull'
  1866         args[b'source'] = b'pull'
  1826         bundle = e.callcommand(b'getbundle', args).result()
  1867         bundle = e.callcommand(b'getbundle', args).result()
  2386     if scmutil.istreemanifest(repo):
  2427     if scmutil.istreemanifest(repo):
  2387         part.addparam(b'treemanifest', b'1')
  2428         part.addparam(b'treemanifest', b'1')
  2388 
  2429 
  2389     if b'exp-sidedata-flag' in repo.requirements:
  2430     if b'exp-sidedata-flag' in repo.requirements:
  2390         part.addparam(b'exp-sidedata', b'1')
  2431         part.addparam(b'exp-sidedata', b'1')
       
  2432         sidedata = bundle2.format_remote_wanted_sidedata(repo)
       
  2433         part.addparam(b'exp-wanted-sidedata', sidedata)
  2391 
  2434 
  2392     if (
  2435     if (
  2393         kwargs.get('narrow', False)
  2436         kwargs.get('narrow', False)
  2394         and kwargs.get('narrow_acl', False)
  2437         and kwargs.get('narrow_acl', False)
  2395         and (include or exclude)
  2438         and (include or exclude)