mercurial/exchange.py
changeset 21062 e7c0a65a5c9c
parent 21061 62d35f251c60
child 21063 7ca4f2049d3b
equal deleted inserted replaced
21061:62d35f251c60 21062:e7c0a65a5c9c
   107                                                  pushop.remote,
   107                                                  pushop.remote,
   108                                                  pushop.outgoing)
   108                                                  pushop.outgoing)
   109                 if pushop.remote.capable('bundle2'):
   109                 if pushop.remote.capable('bundle2'):
   110                     _pushbundle2(pushop)
   110                     _pushbundle2(pushop)
   111                 else:
   111                 else:
       
   112                     _pushchangeset(pushop)
   112             _pushcomputecommonheads(pushop)
   113             _pushcomputecommonheads(pushop)
   113             _pushsyncphase(pushop)
   114             _pushsyncphase(pushop)
   114             _pushobsolete(pushop)
   115             _pushobsolete(pushop)
   115         finally:
   116         finally:
   116             if lock is not None:
   117             if lock is not None:
   184     if not pushop.force:
   185     if not pushop.force:
   185         part = bundle2.bundlepart('CHECK:HEADS', data=iter(pushop.remoteheads))
   186         part = bundle2.bundlepart('CHECK:HEADS', data=iter(pushop.remoteheads))
   186         bundler.addpart(part)
   187         bundler.addpart(part)
   187     # add the changegroup bundle
   188     # add the changegroup bundle
   188     cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing)
   189     cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing)
   189     def cgchunks(cg=cg):
   190     cgpart = bundle2.bundlepart('CHANGEGROUP', data=cg.getchunks())
   190         yield 'HG10UN'
       
   191         for c in cg.getchunks():
       
   192             yield c
       
   193     cgpart = bundle2.bundlepart('CHANGEGROUP', data=cgchunks())
       
   194     bundler.addpart(cgpart)
   191     bundler.addpart(cgpart)
   195     stream = util.chunkbuffer(bundler.getchunks())
   192     stream = util.chunkbuffer(bundler.getchunks())
   196     sent = bundle2.unbundle20(pushop.repo.ui, stream)
   193     sent = bundle2.unbundle20(pushop.repo.ui, stream)
   197     reply = pushop.remote.unbundle(sent, ['force'], 'push')
   194     reply = pushop.remote.unbundle(sent, ['force'], 'push')
   198     try:
   195     try:
   632     if bundlecaps is None or 'HG20' not in bundlecaps:
   629     if bundlecaps is None or 'HG20' not in bundlecaps:
   633         return cg
   630         return cg
   634     # very crude first implementation,
   631     # very crude first implementation,
   635     # the bundle API will change and the generation will be done lazily.
   632     # the bundle API will change and the generation will be done lazily.
   636     bundler = bundle2.bundle20(repo.ui)
   633     bundler = bundle2.bundle20(repo.ui)
   637     def cgchunks(cg=cg):
   634     part = bundle2.bundlepart('changegroup', data=cg.getchunks())
   638         yield 'HG10UN'
       
   639         for c in cg.getchunks():
       
   640             yield c
       
   641     part = bundle2.bundlepart('changegroup', data=cgchunks())
       
   642     bundler.addpart(part)
   635     bundler.addpart(part)
   643     return bundle2.unbundle20(repo.ui, util.chunkbuffer(bundler.getchunks()))
   636     return bundle2.unbundle20(repo.ui, util.chunkbuffer(bundler.getchunks()))
   644 
   637 
   645 class PushRaced(RuntimeError):
   638 class PushRaced(RuntimeError):
   646     """An exception raised during unbundling that indicate a push race"""
   639     """An exception raised during unbundling that indicate a push race"""