Show More
@@ -371,7 +371,7 b' def _runcommand(ui, options, cmd, cmdfun' | |||||
371 | def checkargs(): |
|
371 | def checkargs(): | |
372 | try: |
|
372 | try: | |
373 | return cmdfunc() |
|
373 | return cmdfunc() | |
374 |
except |
|
374 | except error.SignatureError: | |
375 | raise error.ParseError(cmd, _("invalid arguments")) |
|
375 | raise error.ParseError(cmd, _("invalid arguments")) | |
376 |
|
376 | |||
377 | if options['profile']: |
|
377 | if options['profile']: |
@@ -59,3 +59,6 b' class AmbiguousCommand(Exception):' | |||||
59 | # derived from KeyboardInterrupt to simplify some breakout code |
|
59 | # derived from KeyboardInterrupt to simplify some breakout code | |
60 | class SignalInterrupt(KeyboardInterrupt): |
|
60 | class SignalInterrupt(KeyboardInterrupt): | |
61 | """Exception raised on SIGTERM and SIGHUP.""" |
|
61 | """Exception raised on SIGTERM and SIGHUP.""" | |
|
62 | ||||
|
63 | class SignatureError(Exception): | |||
|
64 | pass |
@@ -13,7 +13,7 b' platform-specific details from the core.' | |||||
13 | """ |
|
13 | """ | |
14 |
|
14 | |||
15 | from i18n import _ |
|
15 | from i18n import _ | |
16 | import cStringIO, errno, getpass, re, shutil, sys, tempfile, traceback |
|
16 | import cStringIO, errno, getpass, re, shutil, sys, tempfile, traceback, error | |
17 | import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil |
|
17 | import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil | |
18 | import imp |
|
18 | import imp | |
19 |
|
19 | |||
@@ -707,9 +707,6 b' def system(cmd, environ={}, cwd=None, on' | |||||
707 | if cwd is not None and oldcwd != cwd: |
|
707 | if cwd is not None and oldcwd != cwd: | |
708 | os.chdir(oldcwd) |
|
708 | os.chdir(oldcwd) | |
709 |
|
709 | |||
710 | class SignatureError(Exception): |
|
|||
711 | pass |
|
|||
712 |
|
||||
713 | def checksignature(func): |
|
710 | def checksignature(func): | |
714 | '''wrap a function with code to check for calling errors''' |
|
711 | '''wrap a function with code to check for calling errors''' | |
715 | def check(*args, **kwargs): |
|
712 | def check(*args, **kwargs): | |
@@ -717,7 +714,7 b' def checksignature(func):' | |||||
717 | return func(*args, **kwargs) |
|
714 | return func(*args, **kwargs) | |
718 | except TypeError: |
|
715 | except TypeError: | |
719 | if len(traceback.extract_tb(sys.exc_info()[2])) == 1: |
|
716 | if len(traceback.extract_tb(sys.exc_info()[2])) == 1: | |
720 | raise SignatureError |
|
717 | raise error.SignatureError | |
721 | raise |
|
718 | raise | |
722 |
|
719 | |||
723 | return check |
|
720 | return check |
General Comments 0
You need to be logged in to leave comments.
Login now