Rev 3836: It seems we have some direct tests that don't use strings and expect a value error as well. in http://bzr.arbash-meinel.com/branches/bzr/1.10-dev/revision_strictness
John Arbash Meinel
john at arbash-meinel.com
Tue Nov 25 18:52:08 GMT 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.10-dev/revision_strictness
------------------------------------------------------------
revno: 3836
revision-id: john at arbash-meinel.com-20081125185148-jsfkqnzfjjqsleds
parent: john at arbash-meinel.com-20081125172714-184bkswbz4bc5ffe
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: revision_strictness
timestamp: Tue 2008-11-25 12:51:48 -0600
message:
It seems we have some direct tests that don't use strings and expect a value error as well.
They would be sanitized later on by Revision. We could use that code, but this test
depends on the serializer, which Revision wouldn't know about.
-------------- next part --------------
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2008-11-25 17:07:22 +0000
+++ b/bzrlib/repository.py 2008-11-25 18:51:48 +0000
@@ -128,6 +128,9 @@
for key, value in revprops.iteritems():
# We know that the XML serializers do not round trip '\r'
# correctly, so refuse to accept them
+ if not isinstance(value, basestring):
+ raise ValueError('revision property (%s) is not a valid'
+ ' (unicode) string: %r' % (key, value))
self._validate_unicode_text(value,
'revision property (%s)' % (key,))
=== modified file 'bzrlib/tests/per_repository/test_revision.py'
--- a/bzrlib/tests/per_repository/test_revision.py 2008-09-04 20:32:04 +0000
+++ b/bzrlib/tests/per_repository/test_revision.py 2008-11-25 18:51:48 +0000
@@ -31,14 +31,14 @@
condiment='orange\n mint\n\tcandy',
empty='',
non_ascii=u'\xb5')
- wt.commit(message='initial null commit',
+ wt.commit(message='initial null commit',
revprops=props,
allow_pointless=True,
rev_id='test at user-1')
rev = b.repository.get_revision('test at user-1')
self.assertTrue('flavor' in rev.properties)
self.assertEquals(rev.properties['flavor'], 'choc-mint')
- self.assertEquals([('branch-nick', 'Nicholas'),
+ self.assertEquals([('branch-nick', 'Nicholas'),
('condiment', 'orange\n mint\n\tcandy'),
('empty', ''),
('flavor', 'choc-mint'),
@@ -50,11 +50,11 @@
wt = self.make_branch_and_tree('.')
b = wt.branch
self.assertRaises(ValueError,
- wt.commit,
+ wt.commit,
message='invalid',
revprops={'what a silly property': 'fine'})
self.assertRaises(ValueError,
- wt.commit,
+ wt.commit,
message='invalid',
revprops=dict(number=13))
@@ -63,7 +63,7 @@
"""Test that revision attributes are correct."""
def test_revision_accessors(self):
- """Make sure the values that come out of a revision are the
+ """Make sure the values that come out of a revision are the
same as the ones that go in.
"""
tree1 = self.make_branch_and_tree("br1")
@@ -91,7 +91,7 @@
verbose=True)
rev_b = tree2.branch.repository.get_revision(
tree2.branch.last_revision())
-
+
self.assertEqual(rev_a.message, rev_b.message)
self.assertEqual(rev_a.timestamp, rev_b.timestamp)
self.assertEqual(rev_a.timezone, rev_b.timezone)
More information about the bazaar-commits
mailing list