bundle2: decorate exception raised during bundle processing
This is a small hack to help us do some graceful error handling in bundle2
without major refactoring. See embedded comment for details.
--- a/mercurial/bundle2.py Tue Apr 22 10:14:16 2014 -0300
+++ b/mercurial/bundle2.py Tue Apr 22 11:22:41 2014 -0700
@@ -323,13 +323,19 @@
data=output)
op.reply.addpart(outpart)
part.read()
- except Exception:
+ except Exception, exc:
if part is not None:
# consume the bundle content
part.read()
for part in iterparts:
# consume the bundle content
part.read()
+ # Small hack to let caller code distinguish exceptions from bundle2
+ # processing fron the ones from bundle1 processing. This is mostly
+ # needed to handle different return codes to unbundle according to the
+ # type of bundle. We should probably clean up or drop this return code
+ # craziness in a future version.
+ exc.duringunbundle2 = True
raise
return op