Show More
@@ -348,14 +348,27 b' def applybundle(repo, unbundler, tr, sou' | |||||
348 | return op |
|
348 | return op | |
349 |
|
349 | |||
350 | class partiterator(object): |
|
350 | class partiterator(object): | |
351 | def __init__(self, unbundler): |
|
351 | def __init__(self, repo, unbundler): | |
|
352 | self.repo = repo | |||
352 | self.unbundler = unbundler |
|
353 | self.unbundler = unbundler | |
|
354 | self.iterator = None | |||
|
355 | self.count = 0 | |||
353 |
|
356 | |||
354 | def __enter__(self): |
|
357 | def __enter__(self): | |
355 | return enumerate(self.unbundler.iterparts()) |
|
358 | def func(): | |
|
359 | itr = enumerate(self.unbundler.iterparts()) | |||
|
360 | for count, p in itr: | |||
|
361 | self.count = count | |||
|
362 | yield p | |||
|
363 | self.iterator = func() | |||
|
364 | return self.iterator | |||
356 |
|
365 | |||
357 | def __exit__(self, type, value, tb): |
|
366 | def __exit__(self, type, value, tb): | |
358 | pass |
|
367 | if not self.iterator: | |
|
368 | return | |||
|
369 | ||||
|
370 | self.repo.ui.debug('bundle2-input-bundle: %i parts total\n' % | |||
|
371 | self.count) | |||
359 |
|
372 | |||
360 | def processbundle(repo, unbundler, transactiongetter=None, op=None): |
|
373 | def processbundle(repo, unbundler, transactiongetter=None, op=None): | |
361 | """This function process a bundle, apply effect to/from a repo |
|
374 | """This function process a bundle, apply effect to/from a repo | |
@@ -389,11 +402,10 b' def processbundle(repo, unbundler, trans' | |||||
389 | msg.append('\n') |
|
402 | msg.append('\n') | |
390 | repo.ui.debug(''.join(msg)) |
|
403 | repo.ui.debug(''.join(msg)) | |
391 |
|
404 | |||
392 | with partiterator(unbundler) as parts: |
|
405 | with partiterator(repo, unbundler) as parts: | |
393 | part = None |
|
406 | part = None | |
394 | nbpart = 0 |
|
|||
395 | try: |
|
407 | try: | |
396 |
for |
|
408 | for part in parts: | |
397 | _processpart(op, part) |
|
409 | _processpart(op, part) | |
398 | except Exception as exc: |
|
410 | except Exception as exc: | |
399 | # Any exceptions seeking to the end of the bundle at this point are |
|
411 | # Any exceptions seeking to the end of the bundle at this point are | |
@@ -403,7 +415,7 b' def processbundle(repo, unbundler, trans' | |||||
403 | # re-raise the original error. |
|
415 | # re-raise the original error. | |
404 | seekerror = False |
|
416 | seekerror = False | |
405 | try: |
|
417 | try: | |
406 |
for |
|
418 | for part in parts: | |
407 | # consume the bundle content |
|
419 | # consume the bundle content | |
408 | part.seek(0, 2) |
|
420 | part.seek(0, 2) | |
409 | except Exception: |
|
421 | except Exception: | |
@@ -429,8 +441,6 b' def processbundle(repo, unbundler, trans' | |||||
429 | raise exc |
|
441 | raise exc | |
430 | else: |
|
442 | else: | |
431 | raise |
|
443 | raise | |
432 | finally: |
|
|||
433 | repo.ui.debug('bundle2-input-bundle: %i parts total\n' % nbpart) |
|
|||
434 |
|
444 | |||
435 | return op |
|
445 | return op | |
436 |
|
446 |
General Comments 0
You need to be logged in to leave comments.
Login now