Rev 4456: (jam) Fix some failing tests on win32 in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jun 17 22:33:12 BST 2009


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

------------------------------------------------------------
revno: 4456
revision-id: pqm at pqm.ubuntu.com-20090617213303-9ngqs0i399xitemd
parent: pqm at pqm.ubuntu.com-20090617194441-ttpmi4eewln8wlm1
parent: john at arbash-meinel.com-20090602181917-5gug1ukwzan9z2ht
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-06-17 22:33:03 +0100
message:
  (jam) Fix some failing tests on win32
modified:
  bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
    ------------------------------------------------------------
    revno: 4398.7.1
    revision-id: john at arbash-meinel.com-20090602181917-5gug1ukwzan9z2ht
    parent: pqm at pqm.ubuntu.com-20090602153906-1q6bresxw669b34i
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: 1.16-simple-win32
    timestamp: Tue 2009-06-02 13:19:17 -0500
    message:
      Fix some failing tests for repositories and win32.
      
      Old format repositories did not escape characters like ':', which is
      not a valid filename on Windows. As such, we need to trap when 'tree.commit'
      fails, and skip the test.
      
      Also, updated the test to make a proper distiction between a 'rev_id' which
      would be a string, and a 'rev_key' would would be a tuple.
    modified:
      bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
=== modified file 'bzrlib/tests/per_repository/test_repository.py'
--- a/bzrlib/tests/per_repository/test_repository.py	2009-06-15 19:11:56 +0000
+++ b/bzrlib/tests/per_repository/test_repository.py	2009-06-17 21:33:03 +0000
@@ -151,22 +151,27 @@
         """Test the basic behaviour of the text store."""
         tree = self.make_branch_and_tree('tree')
         repo = tree.branch.repository
-        file_id = ("Foo:Bar",)
+        file_id = "Foo:Bar"
+        file_key = (file_id,)
         tree.lock_write()
         try:
             self.assertEqual(set(), set(repo.texts.keys()))
-            tree.add(['foo'], file_id, ['file'])
-            tree.put_file_bytes_non_atomic(file_id[0], 'content\n')
-            revid = (tree.commit("foo"),)
+            tree.add(['foo'], [file_id], ['file'])
+            tree.put_file_bytes_non_atomic(file_id, 'content\n')
+            try:
+                rev_key = (tree.commit("foo"),)
+            except errors.IllegalPath:
+                raise TestNotApplicable('file_id %r cannot be stored on this'
+                    ' platform for this repo format' % (file_id,))
             if repo._format.rich_root_data:
-                root_commit = (tree.get_root_id(),) + revid
+                root_commit = (tree.get_root_id(),) + rev_key
                 keys = set([root_commit])
                 parents = {root_commit:()}
             else:
                 keys = set()
                 parents = {}
-            keys.add(file_id + revid)
-            parents[file_id + revid] = ()
+            keys.add(file_key + rev_key)
+            parents[file_key + rev_key] = ()
             self.assertEqual(keys, set(repo.texts.keys()))
             self.assertEqual(parents,
                 repo.texts.get_parent_map(repo.texts.keys()))
@@ -175,22 +180,23 @@
         tree2 = self.make_branch_and_tree('tree2')
         tree2.pull(tree.branch)
         tree2.put_file_bytes_non_atomic('Foo:Bar', 'right\n')
-        right_id = (tree2.commit('right'),)
-        keys.add(file_id + right_id)
-        parents[file_id + right_id] = (file_id + revid,)
+        right_key = (tree2.commit('right'),)
+        keys.add(file_key + right_key)
+        parents[file_key + right_key] = (file_key + rev_key,)
         tree.put_file_bytes_non_atomic('Foo:Bar', 'left\n')
-        left_id = (tree.commit('left'),)
-        keys.add(file_id + left_id)
-        parents[file_id + left_id] = (file_id + revid,)
+        left_key = (tree.commit('left'),)
+        keys.add(file_key + left_key)
+        parents[file_key + left_key] = (file_key + rev_key,)
         tree.merge_from_branch(tree2.branch)
         tree.put_file_bytes_non_atomic('Foo:Bar', 'merged\n')
         try:
             tree.auto_resolve()
         except errors.UnsupportedOperation:
             pass
-        merge_id = (tree.commit('merged'),)
-        keys.add(file_id + merge_id)
-        parents[file_id + merge_id] = (file_id + left_id, file_id + right_id)
+        merge_key = (tree.commit('merged'),)
+        keys.add(file_key + merge_key)
+        parents[file_key + merge_key] = (file_key + left_key,
+                                         file_key + right_key)
         repo.lock_read()
         self.addCleanup(repo.unlock)
         self.assertEqual(keys, set(repo.texts.keys()))




More information about the bazaar-commits mailing list