bundle2: decorate exception raised during bundle processing stable
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 22 Apr 2014 11:22:41 -0700
branchstable
changeset 21176 70fcb0a71445
parent 21175 dae36d3e1c60
child 21177 952af771bc17
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.
mercurial/bundle2.py
--- 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