Show More
@@ -243,6 +243,31 b' def _pushcheckoutgoing(pushop):' | |||
|
243 | 243 | newbm) |
|
244 | 244 | return True |
|
245 | 245 | |
|
246 | # List of names of steps to perform for an outgoing bundle2, order matters. | |
|
247 | b2partsgenorder = [] | |
|
248 | ||
|
249 | # Mapping between step name and function | |
|
250 | # | |
|
251 | # This exists to help extensions wrap steps if necessary | |
|
252 | b2partsgenmapping = {} | |
|
253 | ||
|
254 | def b2partsgenerator(stepname): | |
|
255 | """decorator for function generating bundle2 part | |
|
256 | ||
|
257 | The function is added to the step -> function mapping and appended to the | |
|
258 | list of steps. Beware that decorated functions will be added in order | |
|
259 | (this may matter). | |
|
260 | ||
|
261 | You can only use this decorator for new steps, if you want to wrap a step | |
|
262 | from an extension, attack the b2partsgenmapping dictionary directly.""" | |
|
263 | def dec(func): | |
|
264 | assert stepname not in b2partsgenmapping | |
|
265 | b2partsgenmapping[stepname] = func | |
|
266 | b2partsgenorder.append(stepname) | |
|
267 | return func | |
|
268 | return dec | |
|
269 | ||
|
270 | @b2partsgenerator('changeset') | |
|
246 | 271 | def _pushb2ctx(pushop, bundler): |
|
247 | 272 | """handle changegroup push through bundle2 |
|
248 | 273 | |
@@ -269,8 +294,6 b' def _pushb2ctx(pushop, bundler):' | |||
|
269 | 294 | pushop.ret = cgreplies['changegroup'][0]['return'] |
|
270 | 295 | return handlereply |
|
271 | 296 | |
|
272 | # list of function that may decide to add parts to an outgoing bundle2 | |
|
273 | bundle2partsgenerators = [_pushb2ctx] | |
|
274 | 297 | |
|
275 | 298 | def _pushbundle2(pushop): |
|
276 | 299 | """push data to the remote using bundle2 |
@@ -282,7 +305,8 b' def _pushbundle2(pushop):' | |||
|
282 | 305 | capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) |
|
283 | 306 | bundler.newpart('b2x:replycaps', data=capsblob) |
|
284 | 307 | replyhandlers = [] |
|
285 |
for partgen in b |
|
|
308 | for partgenname in b2partsgenorder: | |
|
309 | partgen = b2partsgenmapping[partgenname] | |
|
286 | 310 | ret = partgen(pushop, bundler) |
|
287 | 311 | if callable(ret): |
|
288 | 312 | replyhandlers.append(ret) |
@@ -964,7 +964,8 b' Setting up' | |||
|
964 | 964 | > raise util.Abort('Abandon ship!', hint="don't panic") |
|
965 | 965 | > |
|
966 | 966 | > def uisetup(ui): |
|
967 |
> exchange.b |
|
|
967 | > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart | |
|
968 | > exchange.b2partsgenorder.insert(0, 'failpart') | |
|
968 | 969 | > |
|
969 | 970 | > EOF |
|
970 | 971 |
General Comments 0
You need to be logged in to leave comments.
Login now