Patchwork [3,of,4,reviewed,by,Augie] bundle2: comment to clarify why the handler call is where it is

login
register
mail settings
Submitter Pierre-Yves David
Date April 12, 2014, 9:27 p.m.
Message ID <27ab4b8d250352987f68.1397338041@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4301/
State Accepted
Headers show

Comments

Pierre-Yves David - April 12, 2014, 9:27 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1397248981 14400
#      Fri Apr 11 16:43:01 2014 -0400
# Node ID 27ab4b8d250352987f68c7060c8dde5df81ec635
# Parent  0f7e01e0c06f19b9b26c1b571a4b6de6b15d7cbd
bundle2: comment to clarify why the handler call is where it is

The reason why it is here is not obvious. I'm the one who wrote it there in the
first place and almost moved it 2 weeks later.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -303,10 +303,15 @@  def processbundle(repo, unbundler, trans
                     raise
                 op.ui.debug('ignoring unknown advisory part %r\n' % key)
                 # todo:
                 # - consume the part once we use streaming
                 continue
+
+            # 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).
             handler(op, part)
     except Exception:
         for part in iterparts:
             pass # consume the bundle content
         raise