changeset 24798:9fbf0a2a72a1

bundle2: add on more layer of exception catching in localrepo.unbundle We are going to add output related logic in this function. We do the indentation first to help next changeset readability. We need a new try except because we want to handle output on any exception, including PushRaced ones.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 16 Apr 2015 05:09:37 -0400
parents 0c4d5e01b31f
children d99d7e3f5cda
files mercurial/localrepo.py
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Apr 16 03:17:37 2015 -0400
+++ b/mercurial/localrepo.py	Thu Apr 16 05:09:37 2015 -0400
@@ -125,15 +125,18 @@
 
         This function handles the repo locking itself."""
         try:
-            cg = exchange.readbundle(self.ui, cg, None)
-            ret = exchange.unbundle(self._repo, cg, heads, 'push', url)
-            if util.safehasattr(ret, 'getchunks'):
-                # This is a bundle20 object, turn it into an unbundler.
-                # This little dance should be dropped eventually when the API
-                # is finally improved.
-                stream = util.chunkbuffer(ret.getchunks())
-                ret = bundle2.getunbundler(self.ui, stream)
-            return ret
+            try:
+                cg = exchange.readbundle(self.ui, cg, None)
+                ret = exchange.unbundle(self._repo, cg, heads, 'push', url)
+                if util.safehasattr(ret, 'getchunks'):
+                    # This is a bundle20 object, turn it into an unbundler.
+                    # This little dance should be dropped eventually when the
+                    # API is finally improved.
+                    stream = util.chunkbuffer(ret.getchunks())
+                    ret = bundle2.getunbundler(self.ui, stream)
+                return ret
+            except Exception, exc:
+                raise
         except error.PushRaced, exc:
             raise error.ResponseError(_('push failed:'), str(exc))