error: move SignalInterrupt
authorMatt Mackall <mpm@selenic.com>
Mon, 12 Jan 2009 11:48:05 -0600
changeset 7644 182b7114d35a
parent 7643 9a1ea6587557
child 7645 020a896a5292
error: move SignalInterrupt now derived from KeyboardInterrupt to simplify catches
mercurial/dispatch.py
mercurial/error.py
mercurial/extensions.py
mercurial/hook.py
mercurial/localrepo.py
mercurial/util.py
--- a/mercurial/dispatch.py	Mon Jan 12 11:39:38 2009 -0600
+++ b/mercurial/dispatch.py	Mon Jan 12 11:48:05 2009 -0600
@@ -26,7 +26,7 @@
 
 def _runcatch(ui, args):
     def catchterm(*args):
-        raise util.SignalInterrupt
+        raise error.SignalInterrupt
 
     for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
         num = getattr(signal, name, None)
@@ -74,7 +74,7 @@
                (inst.desc or inst.filename, inst.strerror))
     except error.RevlogError, inst:
         ui.warn(_("abort: %s!\n") % inst)
-    except util.SignalInterrupt:
+    except error.SignalInterrupt:
         ui.warn(_("killed!\n"))
     except KeyboardInterrupt:
         try:
--- a/mercurial/error.py	Mon Jan 12 11:39:38 2009 -0600
+++ b/mercurial/error.py	Mon Jan 12 11:48:05 2009 -0600
@@ -56,3 +56,6 @@
 class AmbiguousCommand(Exception):
     """Exception raised if command shortcut matches more than one command."""
 
+# derived from KeyboardInterrupt to simplify some breakout code
+class SignalInterrupt(KeyboardInterrupt):
+    """Exception raised on SIGTERM and SIGHUP."""
--- a/mercurial/extensions.py	Mon Jan 12 11:39:38 2009 -0600
+++ b/mercurial/extensions.py	Mon Jan 12 11:48:05 2009 -0600
@@ -75,7 +75,7 @@
             path = os.path.expanduser(path)
         try:
             load(ui, name, path)
-        except (util.SignalInterrupt, KeyboardInterrupt):
+        except KeyboardInterrupt:
             raise
         except Exception, inst:
             if path:
--- a/mercurial/hook.py	Mon Jan 12 11:39:38 2009 -0600
+++ b/mercurial/hook.py	Mon Jan 12 11:48:05 2009 -0600
@@ -49,7 +49,7 @@
                              (hname, funcname))
     try:
         r = obj(ui=ui, repo=repo, hooktype=name, **args)
-    except (KeyboardInterrupt, util.SignalInterrupt):
+    except KeyboardInterrupt:
         raise
     except Exception, exc:
         if isinstance(exc, util.Abort):
--- a/mercurial/localrepo.py	Mon Jan 12 11:39:38 2009 -0600
+++ b/mercurial/localrepo.py	Mon Jan 12 11:48:05 2009 -0600
@@ -412,7 +412,7 @@
                 if not l: continue
                 node, label = l.split(" ", 1)
                 partial[label.strip()] = bin(node)
-        except (KeyboardInterrupt, util.SignalInterrupt):
+        except KeyboardInterrupt:
             raise
         except Exception, inst:
             if self.ui.debugflag:
--- a/mercurial/util.py	Mon Jan 12 11:39:38 2009 -0600
+++ b/mercurial/util.py	Mon Jan 12 11:48:05 2009 -0600
@@ -185,9 +185,6 @@
     "%b %Y",
     )
 
-class SignalInterrupt(Exception):
-    """Exception raised on SIGTERM and SIGHUP."""
-
 # differences from SafeConfigParser:
 # - case-sensitive keys
 # - allows values that are not strings (this means that you may not