Rev 2904: Fix 149019 by using a proper line number when reporting errors in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Oct 10 09:52:31 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2904
revision-id: pqm at pqm.ubuntu.com-20071010085229-7x5al1tirr29mq0l
parent: pqm at pqm.ubuntu.com-20071010023136-u18s3z51ux7pwsme
parent: v.ladeuil+lp at free.fr-20071010081258-o3od7tef2646gm9c
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-10-10 09:52:29 +0100
message:
Fix 149019 by using a proper line number when reporting errors
modified:
bzrlib/tests/test_config.py testconfig.py-20051011041908-742d0c15d8d8c8eb
bzrlib/util/configobj/configobj.py configobj.py-20051018184548-06992a2246425e3e
------------------------------------------------------------
revno: 2903.1.1
merged: v.ladeuil+lp at free.fr-20071010081258-o3od7tef2646gm9c
parent: pqm at pqm.ubuntu.com-20071010023136-u18s3z51ux7pwsme
parent: v.ladeuil+lp at free.fr-20071009203229-5k200m1g7mf4jf9l
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Wed 2007-10-10 10:12:58 +0200
message:
Fix 149019 by using a proper line number when reporting errors
------------------------------------------------------------
revno: 2900.1.2
merged: v.ladeuil+lp at free.fr-20071009203229-5k200m1g7mf4jf9l
parent: v.ladeuil+lp at free.fr-20071009202521-pdg82kmh38lj3wek
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 149019
timestamp: Tue 2007-10-09 22:32:29 +0200
message:
Fix 149019 by using a proper line number when reporting errors.
* bzrlib/util/configobj/configobj.py:
(ConfigObj._handle_error): Trivial fix. Since cur_index is
0-based, line number was off by one.
------------------------------------------------------------
revno: 2900.1.1
merged: v.ladeuil+lp at free.fr-20071009202521-pdg82kmh38lj3wek
parent: pqm at pqm.ubuntu.com-20071009084347-m6boff8rxmzsz28f
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 149019
timestamp: Tue 2007-10-09 22:25:21 +0200
message:
* bzrlib/tests/test_config.py:
(TestConfigObjErrors): Add a test reproducing the bug.
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py 2007-10-05 14:52:02 +0000
+++ b/bzrlib/tests/test_config.py 2007-10-09 20:25:21 +0000
@@ -211,6 +211,21 @@
self.assertIs(co.get_bool('UPPERCASE', 'nonactive'), False)
+erroneous_config = """[section] # line 1
+good=good # line 2
+[section] # line 3
+whocares=notme # line 4
+"""
+class TestConfigObjErrors(TestCase):
+
+ def test_duplicate_section_name_error_line(self):
+ try:
+ co = ConfigObj(StringIO(erroneous_config), raise_errors=True)
+ except config.configobj.DuplicateError, e:
+ self.assertEqual(3, e.line_number)
+ else:
+ self.fail('Error in config file not detected')
+
class TestConfig(TestCase):
def test_constructs(self):
=== modified file 'bzrlib/util/configobj/configobj.py'
--- a/bzrlib/util/configobj/configobj.py 2006-09-08 18:46:29 +0000
+++ b/bzrlib/util/configobj/configobj.py 2007-10-09 20:32:29 +0000
@@ -1451,6 +1451,7 @@
The error will have occured at ``cur_index``
"""
line = infile[cur_index]
+ cur_index += 1
message = text % cur_index
error = ErrorClass(message, cur_index, line)
if self.raise_errors:
More information about the bazaar-commits
mailing list