comparison mercurial/commands.py @ 2153:635653cd73ab

move SignalInterrupt class into util module.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Fri, 28 Apr 2006 14:50:23 -0700
parents 6447a32aefce
children ec96c4518236
comparison
equal deleted inserted replaced
2151:0ce3cd330996 2153:635653cd73ab
3258 if choice: 3258 if choice:
3259 return choice.values()[0] 3259 return choice.values()[0]
3260 3260
3261 raise UnknownCommand(cmd) 3261 raise UnknownCommand(cmd)
3262 3262
3263 class SignalInterrupt(Exception):
3264 """Exception raised on SIGTERM and SIGHUP."""
3265
3266 def catchterm(*args): 3263 def catchterm(*args):
3267 raise SignalInterrupt 3264 raise util.SignalInterrupt
3268 3265
3269 def run(): 3266 def run():
3270 sys.exit(dispatch(sys.argv[1:])) 3267 sys.exit(dispatch(sys.argv[1:]))
3271 3268
3272 class ParseError(Exception): 3269 class ParseError(Exception):
3462 except lock.LockUnavailable, inst: 3459 except lock.LockUnavailable, inst:
3463 u.warn(_("abort: could not lock %s: %s\n") % 3460 u.warn(_("abort: could not lock %s: %s\n") %
3464 (inst.desc or inst.filename, inst.strerror)) 3461 (inst.desc or inst.filename, inst.strerror))
3465 except revlog.RevlogError, inst: 3462 except revlog.RevlogError, inst:
3466 u.warn(_("abort: "), inst, "!\n") 3463 u.warn(_("abort: "), inst, "!\n")
3467 except SignalInterrupt: 3464 except util.SignalInterrupt:
3468 u.warn(_("killed!\n")) 3465 u.warn(_("killed!\n"))
3469 except KeyboardInterrupt: 3466 except KeyboardInterrupt:
3470 try: 3467 try:
3471 u.warn(_("interrupted!\n")) 3468 u.warn(_("interrupted!\n"))
3472 except IOError, inst: 3469 except IOError, inst: