# HG changeset patch # User Durham Goode # Date 1505409605 25200 # Node ID cc7b37c906164789f0ea35bd520bb416a2318190 # Parent 07e4170f02f3dd4fbb88571032b5ede2622444b6 bundle2: remove unnecessary try finally This is no longer needed. Differential Revision: https://phab.mercurial-scm.org/D708 diff -r 07e4170f02f3 -r cc7b37c90616 mercurial/bundle2.py --- a/mercurial/bundle2.py Thu Sep 14 10:20:05 2017 -0700 +++ b/mercurial/bundle2.py Thu Sep 14 10:20:05 2017 -0700 @@ -505,32 +505,28 @@ The part is guaranteed to have been fully consumed when the function exits (even if an exception is raised).""" - try: - handler = _gethandler(op, part) - if handler is None: - return + handler = _gethandler(op, part) + if handler is None: + return - # handler is called outside the above try block so that we don't - # risk catching KeyErrors from anything other than the - # parthandlermapping lookup (any KeyError raised by handler() - # itself represents a defect of a different variety). - output = None - if op.captureoutput and op.reply is not None: - op.ui.pushbuffer(error=True, subproc=True) - output = '' - try: - handler(op, part) - finally: - if output is not None: - output = op.ui.popbuffer() - if output: - outpart = op.reply.newpart('output', data=output, - mandatory=False) - outpart.addparam( - 'in-reply-to', pycompat.bytestr(part.id), mandatory=False) + # handler is called outside the above try block so that we don't + # risk catching KeyErrors from anything other than the + # parthandlermapping lookup (any KeyError raised by handler() + # itself represents a defect of a different variety). + output = None + if op.captureoutput and op.reply is not None: + op.ui.pushbuffer(error=True, subproc=True) + output = '' + try: + handler(op, part) finally: - pass - + if output is not None: + output = op.ui.popbuffer() + if output: + outpart = op.reply.newpart('output', data=output, + mandatory=False) + outpart.addparam( + 'in-reply-to', pycompat.bytestr(part.id), mandatory=False) def decodecaps(blob): """decode a bundle2 caps bytes blob into a dictionary