Rev 4756: (mbp) cope with links changing into directories (Martin Pool) in file:///home/pqm/archives/thelove/bzr/2.0/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jul 20 18:34:11 BST 2010


At file:///home/pqm/archives/thelove/bzr/2.0/

------------------------------------------------------------
revno: 4756 [merge]
revision-id: pqm at pqm.ubuntu.com-20100720173406-cxfg7fgbzn1a90eo
parent: pqm at pqm.ubuntu.com-20100719115126-nbjdil02f2jrw4gp
parent: mbp at canonical.com-20100720153418-1yu8hdif4rsgnztp
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.0
timestamp: Tue 2010-07-20 18:34:06 +0100
message:
  (mbp) cope with links changing into directories (Martin Pool)
modified:
  bzrlib/tests/per_workingtree/test_symlinks.py test_symlinks.py-20100715135626-4lw38d8njbzyec6l-1
=== modified file 'bzrlib/tests/per_workingtree/test_symlinks.py'
--- a/bzrlib/tests/per_workingtree/test_symlinks.py	2010-07-17 17:16:19 +0000
+++ b/bzrlib/tests/per_workingtree/test_symlinks.py	2010-07-20 17:34:06 +0000
@@ -21,6 +21,7 @@
 
 from bzrlib import (
     builtins,
+    osutils,
     tests,
     workingtree,
     )
@@ -79,24 +80,13 @@
 
     _test_needs_features = [tests.SymlinkFeature]
 
-    def test_symlink_to_dir(self):
+    def test_symlink_changes_to_dir(self):
         # <https://bugs.launchpad.net/bzr/+bug/192859>:
         # we had some past problems with the workingtree remembering for too
         # long what kind of object was at a particular name; we really
         # shouldn't do that.  Operating on the dirstate through passing
         # inventory deltas rather than mutating the inventory largely avoids
         # that.
-        if self.workingtree_format.upgrade_recommended: 
-            # File "bzrlib/workingtree.py", line 2341, in conflicts
-            #   for conflicted in self._iter_conflicts():
-            # File "bzrlib/workingtree.py", line 1590, in _iter_conflicts
-            #   for info in self.list_files():
-            # File "bzrlib/workingtree.py", line 1203, in list_files
-            #   f_ie = inv.get_child(from_dir_id, f)
-            # File "bzrlib/inventory.py", line 1269, in get_child
-            #   return self[parent_id].children.get(filename)
-            # AttributeError: children
-            raise tests.TestSkipped("known broken on pre-dirstate formats; wontfix")
         tree = self.make_branch_and_tree('tree')
         self.build_tree_contents([
             ('tree/a@', 'target')])
@@ -109,6 +99,29 @@
             ])
         tree.smart_add(['tree/a/f'])
         tree.commit('change to dir')
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        self.assertEquals([], list(tree.iter_changes(tree.basis_tree())))
+
+    def test_dir_changes_to_symlink(self):
+        # <https://bugs.launchpad.net/bzr/+bug/192859>:
+        # we had some past problems with the workingtree remembering for too
+        # long what kind of object was at a particular name; we really
+        # shouldn't do that.  Operating on the dirstate through passing
+        # inventory deltas rather than mutating the inventory largely avoids
+        # that.
+        tree = self.make_branch_and_tree('tree')
+        self.build_tree_contents([
+            ('tree/a/',),
+            ('tree/a/file', 'content'),
+            ])
+        tree.smart_add(['tree/a'])
+        tree.commit('add dir')
+        osutils.rmtree('tree/a')
+        self.build_tree_contents([
+            ('tree/a@', 'target'),
+            ])
+        tree.commit('change to symlink')
 
 
 class TestOpenTree(TestCaseWithWorkingTree):




More information about the bazaar-commits mailing list