Show More
@@ -203,6 +203,23 b' def _pushcheckoutgoing(pushop):' | |||||
203 | newbm) |
|
203 | newbm) | |
204 | return True |
|
204 | return True | |
205 |
|
205 | |||
|
206 | def _pushb2ctx(pushop, bundler): | |||
|
207 | """handle changegroup push through bundle2 | |||
|
208 | ||||
|
209 | addchangegroup result is stored in the ``pushop.ret`` attribute. | |||
|
210 | """ | |||
|
211 | # Send known heads to the server for race detection. | |||
|
212 | if not pushop.force: | |||
|
213 | bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads)) | |||
|
214 | cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing) | |||
|
215 | cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks()) | |||
|
216 | def handlereply(op): | |||
|
217 | """extract addchangroup returns from server reply""" | |||
|
218 | cgreplies = op.records.getreplies(cgpart.id) | |||
|
219 | assert len(cgreplies['changegroup']) == 1 | |||
|
220 | pushop.ret = cgreplies['changegroup'][0]['return'] | |||
|
221 | return handlereply | |||
|
222 | ||||
206 | def _pushbundle2(pushop): |
|
223 | def _pushbundle2(pushop): | |
207 | """push data to the remote using bundle2 |
|
224 | """push data to the remote using bundle2 | |
208 |
|
225 | |||
@@ -213,12 +230,8 b' def _pushbundle2(pushop):' | |||||
213 | capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) |
|
230 | capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) | |
214 | bundler.newpart('b2x:replycaps', data=capsblob) |
|
231 | bundler.newpart('b2x:replycaps', data=capsblob) | |
215 | extrainfo = _pushbundle2extraparts(pushop, bundler) |
|
232 | extrainfo = _pushbundle2extraparts(pushop, bundler) | |
216 | # Send known heads to the server for race detection. |
|
|||
217 | if not pushop.force: |
|
|||
218 | bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads)) |
|
|||
219 | # add the changegroup bundle |
|
233 | # add the changegroup bundle | |
220 | cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing) |
|
234 | cgreplyhandler = _pushb2ctx(pushop, bundler) | |
221 | cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks()) |
|
|||
222 | stream = util.chunkbuffer(bundler.getchunks()) |
|
235 | stream = util.chunkbuffer(bundler.getchunks()) | |
223 | try: |
|
236 | try: | |
224 | reply = pushop.remote.unbundle(stream, ['force'], 'push') |
|
237 | reply = pushop.remote.unbundle(stream, ['force'], 'push') | |
@@ -228,9 +241,7 b' def _pushbundle2(pushop):' | |||||
228 | op = bundle2.processbundle(pushop.repo, reply) |
|
241 | op = bundle2.processbundle(pushop.repo, reply) | |
229 | except error.BundleValueError, exc: |
|
242 | except error.BundleValueError, exc: | |
230 | raise util.Abort('missing support for %s' % exc) |
|
243 | raise util.Abort('missing support for %s' % exc) | |
231 | cgreplies = op.records.getreplies(cgpart.id) |
|
244 | cgreplyhandler(op) | |
232 | assert len(cgreplies['changegroup']) == 1 |
|
|||
233 | pushop.ret = cgreplies['changegroup'][0]['return'] |
|
|||
234 | _pushbundle2extrareply(pushop, op, extrainfo) |
|
245 | _pushbundle2extrareply(pushop, op, extrainfo) | |
235 |
|
246 | |||
236 | def _pushbundle2extraparts(pushop, bundler): |
|
247 | def _pushbundle2extraparts(pushop, bundler): |
General Comments 0
You need to be logged in to leave comments.
Login now