comparison mercurial/exchange.py @ 21902:7a7def851ba0

push: use `stepsdone` to control changegroup push through bundle10 or bundle20 We use the newly introduced `pushop.stepsdone` attribute to inform older methods than changegroup have already been pushed using a newer method.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 07 Jul 2014 12:30:31 +0200
parents 8612c4ab7f54
children 48f61cfb7576
comparison
equal deleted inserted replaced
21901:8612c4ab7f54 21902:7a7def851ba0
137 pushop.outgoing) 137 pushop.outgoing)
138 if (pushop.repo.ui.configbool('experimental', 'bundle2-exp', 138 if (pushop.repo.ui.configbool('experimental', 'bundle2-exp',
139 False) 139 False)
140 and pushop.remote.capable('bundle2-exp')): 140 and pushop.remote.capable('bundle2-exp')):
141 _pushbundle2(pushop) 141 _pushbundle2(pushop)
142 else: 142 _pushchangeset(pushop)
143 _pushchangeset(pushop)
144 _pushcomputecommonheads(pushop) 143 _pushcomputecommonheads(pushop)
145 _pushsyncphase(pushop) 144 _pushsyncphase(pushop)
146 _pushobsolete(pushop) 145 _pushobsolete(pushop)
147 finally: 146 finally:
148 if lock is not None: 147 if lock is not None:
209 def _pushb2ctx(pushop, bundler): 208 def _pushb2ctx(pushop, bundler):
210 """handle changegroup push through bundle2 209 """handle changegroup push through bundle2
211 210
212 addchangegroup result is stored in the ``pushop.ret`` attribute. 211 addchangegroup result is stored in the ``pushop.ret`` attribute.
213 """ 212 """
213 if 'changesets' in pushop.stepsdone:
214 return
215 pushop.stepsdone.add('changesets')
214 # Send known heads to the server for race detection. 216 # Send known heads to the server for race detection.
215 if not pushop.force: 217 if not pushop.force:
216 bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads)) 218 bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads))
217 cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing) 219 cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing)
218 cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks()) 220 cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks())
261 """ 263 """
262 pass 264 pass
263 265
264 def _pushchangeset(pushop): 266 def _pushchangeset(pushop):
265 """Make the actual push of changeset bundle to remote repo""" 267 """Make the actual push of changeset bundle to remote repo"""
268 if 'changesets' in pushop.stepsdone:
269 return
270 pushop.stepsdone.add('changesets')
266 outgoing = pushop.outgoing 271 outgoing = pushop.outgoing
267 unbundle = pushop.remote.capable('unbundle') 272 unbundle = pushop.remote.capable('unbundle')
268 # TODO: get bundlecaps from remote 273 # TODO: get bundlecaps from remote
269 bundlecaps = None 274 bundlecaps = None
270 # create a changegroup from local 275 # create a changegroup from local