Rev 5510: (gz) Check committer values are ascii or unicode and fix a test where it was in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Oct 19 20:10:40 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5510 [merge]
revision-id: pqm at pqm.ubuntu.com-20101019191035-v1rj4gag5ba3cenn
parent: pqm at pqm.ubuntu.com-20101019072823-2ysxmj0dcdpk3wgx
parent: gzlist at googlemail.com-20101015164303-dcqt08g8oueb5mgg
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-10-19 20:10:35 +0100
message:
  (gz) Check committer values are ascii or unicode and fix a test where it was
   not (Martin [gz])
modified:
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/per_repository/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
  bzrlib/tests/test_testament.py testtestament.py-20051011100429-5df1657310caa929
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2010-10-15 11:20:45 +0000
+++ b/bzrlib/repository.py	2010-10-19 19:10:35 +0000
@@ -115,6 +115,8 @@
 
         if committer is None:
             self._committer = self._config.username()
+        elif not isinstance(committer, unicode):
+            self._committer = committer.decode() # throw if non-ascii
         else:
             self._committer = committer
 

=== modified file 'bzrlib/tests/per_repository/test_commit_builder.py'
--- a/bzrlib/tests/per_repository/test_commit_builder.py	2010-08-10 19:17:49 +0000
+++ b/bzrlib/tests/per_repository/test_commit_builder.py	2010-10-15 16:43:03 +0000
@@ -1288,6 +1288,16 @@
         self.assertRaises(ValueError, builder.commit,
             u'Invalid\r\ncommit message\r\n')
 
+    def test_non_ascii_str_committer_rejected(self):
+        """Ensure an error is raised on a non-ascii byte string committer"""
+        branch = self.make_branch('.')
+        branch.repository.lock_write()
+        self.addCleanup(branch.repository.unlock)
+        self.assertRaises(UnicodeDecodeError,
+            branch.repository.get_commit_builder,
+            branch, [], branch.get_config(),
+            committer="Erik B\xe5gfors <erik at example.com>")
+
     def test_stacked_repositories_reject_commit_builder(self):
         # As per bug 375013, committing to stacked repositories is currently
         # broken, so repositories with fallbacks refuse to hand out a commit

=== modified file 'bzrlib/tests/test_testament.py'
--- a/bzrlib/tests/test_testament.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/test_testament.py	2010-10-13 14:32:22 +0000
@@ -129,7 +129,7 @@
             timestamp=1129025493,
             timezone=36000,
             rev_id='test at user-3',
-            committer='Erik B\xe5gfors <test at user>',
+            committer=u'Erik B\xe5gfors <test at user>',
             revprops={'uni':u'\xb5'}
             )
         t = self.from_revision(self.b.repository, 'test at user-3')




More information about the bazaar-commits mailing list