Mercurial > hg
diff mercurial/commands.py @ 4542:af02e6078d08
dispatch: reorder functions
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 11 Jun 2007 21:09:23 -0500 |
parents | cbabc9ac7424 |
children | 6b4e8a75d5fc |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Jun 11 21:09:23 2007 -0500 +++ b/mercurial/commands.py Mon Jun 11 21:09:23 2007 -0500 @@ -3033,6 +3033,9 @@ " 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 @@ 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 @@ 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 @@ % (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':