[PATCH 01 of 12 stable] bundle2: decorate exception raised during bundle processing
pierre-yves.david at ens-lyon.org
pierre-yves.david at ens-lyon.org
Tue Apr 22 15:10:45 CDT 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# 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/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -321,17 +321,23 @@ def processbundle(repo, unbundler, trans
advisoryparams=[('in-reply-to',
str(part.id))],
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 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
raise
return op
def decodecaps(blob):
"""decode a bundle2 caps bytes blob into a dictionnary
More information about the Mercurial-devel
mailing list