# HG changeset patch # User Tony Tung # Date 1454974530 28800 # Node ID a6344df5108e0333b057967db3d298a1d5cf1982 # Parent 37b818cad14664f7cf262a3cfb1f81e616dd1f4d 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. diff -r 37b818cad146 -r a6344df5108e mercurial/dispatch.py --- a/mercurial/dispatch.py Thu Feb 11 22:52:23 2016 -0800 +++ b/mercurial/dispatch.py Mon Feb 08 15:35:30 2016 -0800 @@ -609,7 +609,8 @@ for cfg in config: try: - name, value = cfg.split('=', 1) + name, value = [cfgelem.strip() + for cfgelem in cfg.split('=', 1)] section, name = name.split('.', 1) if not section or not name: raise IndexError diff -r 37b818cad146 -r a6344df5108e tests/test-ui-config.py.out --- a/tests/test-ui-config.py.out Thu Feb 11 22:52:23 2016 -0800 +++ b/tests/test-ui-config.py.out Mon Feb 08 15:35:30 2016 -0800 @@ -1,5 +1,5 @@ [('string', 'string value'), ('bool1', 'true'), ('bool2', 'false'), ('boolinvalid', 'foo'), ('int1', '42'), ('int2', '-42'), ('intinvalid', 'foo')] -[('list1', 'foo'), ('list2', 'foo bar baz'), ('list3', 'alice, bob'), ('list4', 'foo bar baz alice, bob'), ('list5', 'abc d"ef"g "hij def"'), ('list6', '"hello world", "how are you?"'), ('list7', 'Do"Not"Separate'), ('list8', '"Do"Separate'), ('list9', '"Do\\"NotSeparate"'), ('list10', 'string "with extraneous" quotation mark"'), ('list11', 'x, y'), ('list12', '"x", "y"'), ('list13', '""" key = "x", "y" """'), ('list14', ',,,, '), ('list15', '" just with starting quotation'), ('list16', '"longer quotation" with "no ending quotation'), ('list17', 'this is \\" "not a quotation mark"'), ('list18', '\n \n\nding\ndong')] +[('list1', 'foo'), ('list2', 'foo bar baz'), ('list3', 'alice, bob'), ('list4', 'foo bar baz alice, bob'), ('list5', 'abc d"ef"g "hij def"'), ('list6', '"hello world", "how are you?"'), ('list7', 'Do"Not"Separate'), ('list8', '"Do"Separate'), ('list9', '"Do\\"NotSeparate"'), ('list10', 'string "with extraneous" quotation mark"'), ('list11', 'x, y'), ('list12', '"x", "y"'), ('list13', '""" key = "x", "y" """'), ('list14', ',,,,'), ('list15', '" just with starting quotation'), ('list16', '"longer quotation" with "no ending quotation'), ('list17', 'this is \\" "not a quotation mark"'), ('list18', 'ding\ndong')] --- 'string value' 'true'