Change to configlist

Greg Ward greg at gerg.ca
Thu Jun 3 13:56:39 CDT 2010


Hi Henrik --

I just discovered that your change for adding quote support to
ui.configlist (changeset 0a548640e012) broke one way of writing a list
in configuration.  In particular, I have a config setting like this:

  exempt_review =
    **.txt
    **doc/*

Pre-0a548640e012, this was parsed to the list

  ['**.txt', '**doc/*']

which works fine.  After your change, it is parsed to

  ['', '**.txt', '**doc/*']

I assume that was an unintended change!

Here is a start at a patch:

# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1275591230 14400
# Node ID 66c5c5a67c23bc2728dbc8cbdea86dd850d4c0e0
# Parent  457813cb30245902ea49f999f6045c21ab87b4d5
test-ui-config: add failing test for configlist() with multiline strings.

Specifically, when configlist() parses a string that starts with a
newline, it returns a list starting with ''.  That is an incompatible
change from 1.5.x introduced by 0a548640e012.

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 @@
     'lists.list15=" just with starting quotation',
     'lists.list16="longer quotation" with "no ending quotation',
     'lists.list17=this is \\" "not a quotation mark"',
+    'lists.list18=\nding\ndong',
 ])

 print repr(testui.configitems('values'))
@@ -62,6 +63,7 @@
 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', '\nding\ndong')]
 ---
 'string value'
 'true'
@@ -31,6 +31,7 @@
 ['"', 'just', 'with', 'starting', 'quotation']
 ['longer quotation', 'with', '"no', 'ending', 'quotation']
 ['this', 'is', '"', 'not a quotation mark']
+['ding', 'dong']
 []
 []
 ['foo']


More information about the Mercurial-devel mailing list