Patchwork [01,of,12,stable] bundle2: decorate exception raised during bundle processing

mail settings
Submitter Pierre-Yves David
Date April 22, 2014, 8:10 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/4420/
State Accepted
Commit 70fcb0a714457662421baf3f3dfbcbcb2f25620e
Headers show


Pierre-Yves David - April 22, 2014, 8:10 p.m.
# HG changeset patch
# User Pierre-Yves David <>
# Date 1398190961 25200
#      Tue Apr 22 11:22:41 2014 -0700
# Branch stable
# Node ID be776cb27517486130180fa9d7abdd9f20fdff84
# Parent  bf28918773785705bb4197899dec139513ff470c
bundle2: decorate exception raised during bundle processing

This is a small hack to helpuse doing some graceful error handling in bundle2
without major refactoring. See embedded comment for details.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -321,17 +321,23 @@  def processbundle(repo, unbundler, trans
-    except Exception:
+    except Exception, exc:
         if part is not None:
             # consume the bundle content
         for part in iterparts:
             # consume the bundle content
+        # Small hack to let caller code distincting exception from bundle2
+        # processing fron the ones from bundle1 processing. This is mostly
+        # needed to handle different return code to unbundle according to the
+        # type of bundle. We should probably clean up or drop this return code
+        # crazyness in future version.
+        exc.duringunbundle2 = True
     return op
 def decodecaps(blob):
     """decode a bundle2 caps bytes blob into a dictionnary