diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -228,7 +228,7 @@ class ui(object): if result is None: result = default or [] if isinstance(result, basestring): - result = _configlist(result) + result = _configlist(result.lstrip(' ,\n')) if result is None: result = default or [] return result diff --git a/tests/test-ui-config.py b/tests/test-ui-config.py --- a/tests/test-ui-config.py +++ b/tests/test-ui-config.py @@ -24,6 +24,7 @@ parsed = dispatch._parseconfig(testui, [ 'lists.list15=" just with starting quotation', 'lists.list16="longer quotation" with "no ending quotation', 'lists.list17=this is \\" "not a quotation mark"', + 'lists.list18=\n \n\nding\ndong', ]) print repr(testui.configitems('values')) @@ -62,6 +63,7 @@ print repr(testui.configlist('lists', 'l print repr(testui.configlist('lists', 'list15')) print repr(testui.configlist('lists', 'list16')) print repr(testui.configlist('lists', 'list17')) +print repr(testui.configlist('lists', 'list18')) print repr(testui.configlist('lists', 'unknown')) print repr(testui.configlist('lists', 'unknown', '')) print repr(testui.configlist('lists', 'unknown', 'foo')) diff --git a/tests/test-ui-config.py.out b/tests/test-ui-config.py.out --- a/tests/test-ui-config.py.out +++ b/tests/test-ui-config.py.out @@ -1,5 +1,5 @@ [('string', 'string value'), ('bool1', 'true'), ('bool2', 'false')] -[('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"')] +[('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')] --- 'string value' 'true' @@ -31,6 +31,7 @@ True ['"', 'just', 'with', 'starting', 'quotation'] ['longer quotation', 'with', '"no', 'ending', 'quotation'] ['this', 'is', '"', 'not a quotation mark'] +['ding', 'dong'] [] [] ['foo']