changeset 21176:70fcb0a71445 stable

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 22 Apr 2014 11:22:41 -0700
parents dae36d3e1c60
children 952af771bc17
files mercurial/bundle2.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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