Rev 2295: Track down some non-ascii deficiencies in commit logic. in http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/utf8_file_ids

John Arbash Meinel john at arbash-meinel.com
Sat Feb 17 17:25:15 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/utf8_file_ids

------------------------------------------------------------
revno: 2295
revision-id: john at arbash-meinel.com-20070217172506-ps0riemt041fkz0q
parent: pqm at pqm.ubuntu.com-20070217025822-306d98c244b53b08
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: utf8_file_ids
timestamp: Sat 2007-02-17 11:25:06 -0600
message:
  Track down some non-ascii deficiencies in commit logic.
modified:
  bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
  bzrlib/tests/tree_implementations/test_test_trees.py test_tree_trees.py-20060720091921-3nwi5h21lf06vf5p-1
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
-------------- next part --------------
=== modified file 'bzrlib/tests/tree_implementations/__init__.py'
--- a/bzrlib/tests/tree_implementations/__init__.py	2006-12-15 18:16:34 +0000
+++ b/bzrlib/tests/tree_implementations/__init__.py	2007-02-17 17:25:06 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 Canonical Ltd
+# Copyright (C) 2006, 2007 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -27,6 +27,7 @@
 
 from bzrlib import (
     errors,
+    tests,
     transform,
     )
 from bzrlib.transport import get_transport
@@ -164,6 +165,29 @@
         tt.apply()
         return self._convert_tree(tree, converter)
 
+    def get_tree_with_utf8(self, tree):
+        """Generate a tree with a utf8 revision and unicode paths."""
+        paths = [u'f\xf6',
+                 u'b\xe5r/',
+                 u'b\xe5r/b\xe1z',
+                ]
+        # bzr itself does not create unicode file ids, but we want them for
+        # testing.
+        file_ids = [u'f\xf6-id',
+                    u'b\xe5-r-id',
+                    u'b\xe1z-id',
+                   ]
+        try:
+            self.build_tree(paths)
+        except UnicodeError:
+            raise tests.TestSkipped('filesystem does not support unicode.')
+        tree.add(paths, file_ids)
+        try:
+            tree.commit(u'in\xedtial', rev_id=u'r\xe9v-1'.encode('utf8'))
+        except errors.NonAsciiRevisionId:
+            raise tests.TestSkipped('non-ascii revision ids not supported')
+        return self.workingtree_to_test_tree(tree)
+
 
 class TreeTestProviderAdapter(WorkingTreeTestProviderAdapter):
     """Generate test suites for each Tree implementation in bzrlib.

=== modified file 'bzrlib/tests/tree_implementations/test_test_trees.py'
--- a/bzrlib/tests/tree_implementations/test_test_trees.py	2006-10-16 01:50:48 +0000
+++ b/bzrlib/tests/tree_implementations/test_test_trees.py	2007-02-17 17:25:06 +0000
@@ -127,3 +127,7 @@
             [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
         self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
         self.assertTrue(tree.is_executable('c-id'))
+
+    def test_tree_with_utf8(self):
+        tree = self.make_branch_and_tree('.')
+        tree = self.get_tree_with_utf8(tree)

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-02-17 01:42:57 +0000
+++ b/bzrlib/workingtree.py	2007-02-17 17:25:06 +0000
@@ -1975,7 +1975,7 @@
                 pass
             return False
         else:
-            self._control_files.put_utf8('last-revision', revision_id)
+            self._control_files.put_bytes('last-revision', revision_id)
             return True
 
     @needs_tree_write_lock



More information about the bazaar-commits mailing list