Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 28081:a6344df5108e
dispatch: strip command line options like config file options
Currently, whitespace in command line --config options are considered
significant while whitespace in config files are not considered
significant. This diff strips the leading and trailing whitespace from
command line config options.
author | Tony Tung <ttung@fb.com> |
---|---|
date | Mon, 08 Feb 2016 15:35:30 -0800 |
parents | 6822f9382b4c |
children | 59509c6724c7 |
comparison
equal
deleted
inserted
replaced
28080:37b818cad146 | 28081:a6344df5108e |
---|---|
607 """parse the --config options from the command line""" | 607 """parse the --config options from the command line""" |
608 configs = [] | 608 configs = [] |
609 | 609 |
610 for cfg in config: | 610 for cfg in config: |
611 try: | 611 try: |
612 name, value = cfg.split('=', 1) | 612 name, value = [cfgelem.strip() |
613 for cfgelem in cfg.split('=', 1)] | |
613 section, name = name.split('.', 1) | 614 section, name = name.split('.', 1) |
614 if not section or not name: | 615 if not section or not name: |
615 raise IndexError | 616 raise IndexError |
616 ui.setconfig(section, name, value, '--config') | 617 ui.setconfig(section, name, value, '--config') |
617 configs.append((section, name, value)) | 618 configs.append((section, name, value)) |