# HG changeset patch # User Matt Mackall # Date 1181614163 18000 # Node ID af02e6078d08f50746f7a55d510ddbf8d5c2de0f # Parent 3f4555babe7430b1879a76a3a027bb49ba2e677a dispatch: reorder functions diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3033,6 +3033,9 @@ norepo = ("clone init version help debug " debugindex debugindexdot debugdate debuginstall") optionalrepo = ("paths serve showconfig") +def run(): + sys.exit(dispatch(sys.argv[1:])) + def findpossible(ui, cmd): """ Return cmd -> (aliases, command table entry) @@ -3079,12 +3082,6 @@ def findcmd(ui, cmd): raise UnknownCommand(cmd) -def catchterm(*args): - raise util.SignalInterrupt - -def run(): - sys.exit(dispatch(sys.argv[1:])) - class ParseError(Exception): """Exception raised on errors in parsing the command line.""" @@ -3126,6 +3123,20 @@ def parse(ui, args): return (cmd, cmd and i[0] or None, args, options, cmdoptions) +def parseconfig(config): + """parse the --config options from the command line""" + parsed = [] + for cfg in config: + try: + name, value = cfg.split('=', 1) + section, name = name.split('.', 1) + if not section or not name: + raise IndexError + parsed.append((section, name, value)) + except (IndexError, ValueError): + raise util.Abort(_('malformed --config option: %s') % cfg) + return parsed + external = {} def findext(name): @@ -3185,19 +3196,8 @@ def load_extensions(ui): % (name, " ".join(overrides))) table.update(cmdtable) -def parseconfig(config): - """parse the --config options from the command line""" - parsed = [] - for cfg in config: - try: - name, value = cfg.split('=', 1) - section, name = name.split('.', 1) - if not section or not name: - raise IndexError - parsed.append((section, name, value)) - except (IndexError, ValueError): - raise util.Abort(_('malformed --config option: %s') % cfg) - return parsed +def catchterm(*args): + raise util.SignalInterrupt def dispatch(args): for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':