Mercurial > hg
comparison mercurial/bundle2.py @ 34260:cc7b37c90616
bundle2: remove unnecessary try finally
This is no longer needed.
Differential Revision: https://phab.mercurial-scm.org/D708
author | Durham Goode <durham@fb.com> |
---|---|
date | Thu, 14 Sep 2017 10:20:05 -0700 |
parents | 07e4170f02f3 |
children | f010097c885c |
comparison
equal
deleted
inserted
replaced
34259:07e4170f02f3 | 34260:cc7b37c90616 |
---|---|
503 def _processpart(op, part): | 503 def _processpart(op, part): |
504 """process a single part from a bundle | 504 """process a single part from a bundle |
505 | 505 |
506 The part is guaranteed to have been fully consumed when the function exits | 506 The part is guaranteed to have been fully consumed when the function exits |
507 (even if an exception is raised).""" | 507 (even if an exception is raised).""" |
508 handler = _gethandler(op, part) | |
509 if handler is None: | |
510 return | |
511 | |
512 # handler is called outside the above try block so that we don't | |
513 # risk catching KeyErrors from anything other than the | |
514 # parthandlermapping lookup (any KeyError raised by handler() | |
515 # itself represents a defect of a different variety). | |
516 output = None | |
517 if op.captureoutput and op.reply is not None: | |
518 op.ui.pushbuffer(error=True, subproc=True) | |
519 output = '' | |
508 try: | 520 try: |
509 handler = _gethandler(op, part) | 521 handler(op, part) |
510 if handler is None: | |
511 return | |
512 | |
513 # handler is called outside the above try block so that we don't | |
514 # risk catching KeyErrors from anything other than the | |
515 # parthandlermapping lookup (any KeyError raised by handler() | |
516 # itself represents a defect of a different variety). | |
517 output = None | |
518 if op.captureoutput and op.reply is not None: | |
519 op.ui.pushbuffer(error=True, subproc=True) | |
520 output = '' | |
521 try: | |
522 handler(op, part) | |
523 finally: | |
524 if output is not None: | |
525 output = op.ui.popbuffer() | |
526 if output: | |
527 outpart = op.reply.newpart('output', data=output, | |
528 mandatory=False) | |
529 outpart.addparam( | |
530 'in-reply-to', pycompat.bytestr(part.id), mandatory=False) | |
531 finally: | 522 finally: |
532 pass | 523 if output is not None: |
533 | 524 output = op.ui.popbuffer() |
525 if output: | |
526 outpart = op.reply.newpart('output', data=output, | |
527 mandatory=False) | |
528 outpart.addparam( | |
529 'in-reply-to', pycompat.bytestr(part.id), mandatory=False) | |
534 | 530 |
535 def decodecaps(blob): | 531 def decodecaps(blob): |
536 """decode a bundle2 caps bytes blob into a dictionary | 532 """decode a bundle2 caps bytes blob into a dictionary |
537 | 533 |
538 The blob is a list of capabilities (one per line) | 534 The blob is a list of capabilities (one per line) |