# HG changeset patch # User Matt Mackall # Date 1231782485 21600 # Node ID 182b7114d35a4ca96f15d9ed2e503c51572da5a3 # Parent 9a1ea6587557e9972f29d428df730aff000a937a error: move SignalInterrupt now derived from KeyboardInterrupt to simplify catches diff -r 9a1ea6587557 -r 182b7114d35a mercurial/dispatch.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: diff -r 9a1ea6587557 -r 182b7114d35a mercurial/error.py --- 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.""" diff -r 9a1ea6587557 -r 182b7114d35a mercurial/extensions.py --- 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: diff -r 9a1ea6587557 -r 182b7114d35a mercurial/hook.py --- 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): diff -r 9a1ea6587557 -r 182b7114d35a mercurial/localrepo.py --- 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: diff -r 9a1ea6587557 -r 182b7114d35a mercurial/util.py --- 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