Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 3346:1700a103458e
move the parsing of --config options to commands.py
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Tue, 10 Oct 2006 18:43:20 -0300 |
parents | a09be4317f9c |
children | e4aa22eaa0e4 |
comparison
equal
deleted
inserted
replaced
3345:a09be4317f9c | 3346:1700a103458e |
---|---|
3273 for t in cmdtable: | 3273 for t in cmdtable: |
3274 if t in table: | 3274 if t in table: |
3275 ui.warn(_("module %s overrides %s\n") % (name, t)) | 3275 ui.warn(_("module %s overrides %s\n") % (name, t)) |
3276 table.update(cmdtable) | 3276 table.update(cmdtable) |
3277 | 3277 |
3278 def parseconfig(config): | |
3279 """parse the --config options from the command line""" | |
3280 parsed = [] | |
3281 for cfg in config: | |
3282 try: | |
3283 name, value = cfg.split('=', 1) | |
3284 section, name = name.split('.', 1) | |
3285 if not section or not name: | |
3286 raise IndexError | |
3287 parsed.append((section, name, value)) | |
3288 except (IndexError, ValueError): | |
3289 raise util.Abort(_('malformed --config option: %s') % cfg) | |
3290 return parsed | |
3291 | |
3278 def dispatch(args): | 3292 def dispatch(args): |
3279 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': | 3293 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
3280 num = getattr(signal, name, None) | 3294 num = getattr(signal, name, None) |
3281 if num: signal.signal(num, catchterm) | 3295 if num: signal.signal(num, catchterm) |
3282 | 3296 |
3304 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) | 3318 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
3305 atexit.register(print_time) | 3319 atexit.register(print_time) |
3306 | 3320 |
3307 u.updateopts(options["verbose"], options["debug"], options["quiet"], | 3321 u.updateopts(options["verbose"], options["debug"], options["quiet"], |
3308 not options["noninteractive"], options["traceback"], | 3322 not options["noninteractive"], options["traceback"], |
3309 options["config"]) | 3323 parseconfig(options["config"])) |
3310 | 3324 |
3311 # enter the debugger before command execution | 3325 # enter the debugger before command execution |
3312 if options['debugger']: | 3326 if options['debugger']: |
3313 pdb.set_trace() | 3327 pdb.set_trace() |
3314 | 3328 |