D960: bundle2: immediate exit for ctrl+c (issue5692)

durham (Durham Goode) phabricator at mercurial-scm.org
Thu Oct 5 21:20:22 UTC 2017


durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  https://phab.mercurial-scm.org/rHG21c2df59a1dad534bfac45acc0bbfb6cb2afe9b4 regressed bundle2 by catching all exceptions and trying to handle
  them. The old behavior was to allow KeyboardInterrupts to throw and not have
  graceful cleanup, which allowed it to exit immediately. Let's go back to that
  behavior.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D960

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -370,7 +370,10 @@
         if not self.iterator:
             return
 
-        if exc:
+        # Only gracefully abort in a normal exception situation. User aborts
+        # like Ctrl+C throw a KeyboardInterrupt which is not a base Exception,
+        # and should not gracefully cleanup.
+        if isinstance(exc, Exception):
             # If exiting or interrupted, do not attempt to seek the stream in
             # the finally block below. This makes abort faster.
             if (self.current and



To: durham, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list