mercurial/bundle2.py
changeset 29937 2c302c654451
parent 29759 e584c6235500
parent 29851 ccd436f7db6d
child 30030 0f6d6fdd3c2a
--- a/mercurial/bundle2.py	Tue Sep 13 13:49:42 2016 -0700
+++ b/mercurial/bundle2.py	Wed Sep 14 17:12:39 2016 +0200
@@ -353,7 +353,7 @@
     try:
         for nbpart, part in iterparts:
             _processpart(op, part)
-    except BaseException as exc:
+    except Exception as exc:
         for nbpart, part in iterparts:
             # consume the bundle content
             part.seek(0, 2)
@@ -382,6 +382,7 @@
     The part is guaranteed to have been fully consumed when the function exits
     (even if an exception is raised)."""
     status = 'unknown' # used by debug output
+    hardabort = False
     try:
         try:
             handler = parthandlermapping.get(part.type)
@@ -436,9 +437,15 @@
                 outpart = op.reply.newpart('output', data=output,
                                            mandatory=False)
                 outpart.addparam('in-reply-to', str(part.id), mandatory=False)
+    # If exiting or interrupted, do not attempt to seek the stream in the
+    # finally block below. This makes abort faster.
+    except (SystemExit, KeyboardInterrupt):
+        hardabort = True
+        raise
     finally:
         # consume the part content to not corrupt the stream.
-        part.seek(0, 2)
+        if not hardabort:
+            part.seek(0, 2)
 
 
 def decodecaps(blob):
@@ -1467,7 +1474,7 @@
 def handleoutput(op, inpart):
     """forward output captured on the server to the client"""
     for line in inpart.read().splitlines():
-        op.ui.status(('remote: %s\n' % line))
+        op.ui.status(_('remote: %s\n') % line)
 
 @parthandler('replycaps')
 def handlereplycaps(op, inpart):