##// END OF EJS Templates
bundle2-push: introduce a list of part generating functions...
Pierre-Yves David -
r21904:5fbccbcc default
parent child Browse files
Show More
@@ -227,6 +227,9 b' def _pushb2ctx(pushop, bundler):'
227 pushop.ret = cgreplies['changegroup'][0]['return']
227 pushop.ret = cgreplies['changegroup'][0]['return']
228 return handlereply
228 return handlereply
229
229
230 # list of function that may decide to add parts to an outgoing bundle2
231 bundle2partsgenerators = [_pushb2ctx]
232
230 def _pushbundle2(pushop):
233 def _pushbundle2(pushop):
231 """push data to the remote using bundle2
234 """push data to the remote using bundle2
232
235
@@ -237,9 +240,11 b' def _pushbundle2(pushop):'
237 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
240 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
238 bundler.newpart('b2x:replycaps', data=capsblob)
241 bundler.newpart('b2x:replycaps', data=capsblob)
239 extrainfo = _pushbundle2extraparts(pushop, bundler)
242 extrainfo = _pushbundle2extraparts(pushop, bundler)
240 # add the changegroup bundle
243 replyhandlers = []
241 cgreplyhandler = _pushb2ctx(pushop, bundler)
244 for partgen in bundle2partsgenerators:
242 # do not push if no other parts than the capability
245 ret = partgen(pushop, bundler)
246 replyhandlers.append(ret)
247 # do not push if nothing to push
243 if bundler.nbparts <= 1:
248 if bundler.nbparts <= 1:
244 return
249 return
245 stream = util.chunkbuffer(bundler.getchunks())
250 stream = util.chunkbuffer(bundler.getchunks())
@@ -251,7 +256,8 b' def _pushbundle2(pushop):'
251 op = bundle2.processbundle(pushop.repo, reply)
256 op = bundle2.processbundle(pushop.repo, reply)
252 except error.BundleValueError, exc:
257 except error.BundleValueError, exc:
253 raise util.Abort('missing support for %s' % exc)
258 raise util.Abort('missing support for %s' % exc)
254 cgreplyhandler(op)
259 for rephand in replyhandlers:
260 rephand(op)
255 _pushbundle2extrareply(pushop, op, extrainfo)
261 _pushbundle2extrareply(pushop, op, extrainfo)
256
262
257 def _pushbundle2extraparts(pushop, bundler):
263 def _pushbundle2extraparts(pushop, bundler):
General Comments 0
You need to be logged in to leave comments. Login now