Rev 2681: Make missing an annotation on text raise a real error. in http://bzr.arbash-meinel.com/branches/bzr/0.19-dev/pyrex_knit_extract
John Arbash Meinel
john at arbash-meinel.com
Fri Aug 3 19:36:34 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.19-dev/pyrex_knit_extract
------------------------------------------------------------
revno: 2681
revision-id: john at arbash-meinel.com-20070803183559-hnigy7ugk0crb3ap
parent: john at arbash-meinel.com-20070803161657-imr9sa6de3htjdok
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: pyrex_knit_extract
timestamp: Fri 2007-08-03 13:35:59 -0500
message:
Make missing an annotation on text raise a real error.
modified:
bzrlib/_knit_helpers_py.py _knit_load_data_py.p-20070629000948-9a0nh4s118bi5y8n-1
bzrlib/tests/test__knit_helpers.py test__knit_helpers.p-20070724214127-vkhtjicq8lrlotz3-1
-------------- next part --------------
=== modified file 'bzrlib/_knit_helpers_py.py'
--- a/bzrlib/_knit_helpers_py.py 2007-08-03 16:16:57 +0000
+++ b/bzrlib/_knit_helpers_py.py 2007-08-03 18:35:59 +0000
@@ -177,7 +177,11 @@
"""
digest, lines = _extract_knit_lines_from_gzip(version_id, data, kd_name)
if is_annotated:
- lines = [line.split(' ', 1)[1] for line in lines]
+ try:
+ lines = [line.split(' ', 1)[1] for line in lines]
+ except IndexError, e:
+ raise errors.KnitCorrupt(kd_name,
+ "Line did not start with an annotation value.")
return digest, lines
=== modified file 'bzrlib/tests/test__knit_helpers.py'
--- a/bzrlib/tests/test__knit_helpers.py 2007-08-03 16:16:57 +0000
+++ b/bzrlib/tests/test__knit_helpers.py 2007-08-03 18:35:59 +0000
@@ -280,6 +280,15 @@
'end rev-id'),
'fname', False)
+ def test_missing_annotation(self):
+ extract_fulltext = self.get_extract_knit_fulltext_from_gzip()
+ self.assertRaises(errors.KnitCorrupt, extract_fulltext, 'rev-id',
+ gzip_compress('version rev-id 2 12345\n'
+ 'foo bar\n'
+ 'fooxbar\n'
+ 'end rev-id\n'),
+ 'fname', True)
+
class TestExtractKnitFulltextFromGzipCompiled(TestExtractKnitFulltextFromGzip):
More information about the bazaar-commits
mailing list