Merge lp:~mbp/bzr/192859-2.0-symlinks into lp:bzr/2.0

Proposed by Martin Pool
Status: Merged
Approved by: Martin Pool
Approved revision: no longer in the source branch.
Merged at revision: 4756
Proposed branch: lp:~mbp/bzr/192859-2.0-symlinks
Merge into: lp:bzr/2.0
Diff against target: 67 lines (+25/-12)
1 file modified
bzrlib/tests/per_workingtree/test_symlinks.py (+25/-12)
To merge this branch: bzr merge lp:~mbp/bzr/192859-2.0-symlinks
Reviewer Review Type Date Requested Status
John A Meinel Needs Fixing
Review via email: mp+30180@code.launchpad.net

Commit message

cope with links changing into directories

Description of the change

This fixes another symlink problem case: adding a file under a directory that was a symlink in the basis revision.

The really right fix for this is to get away from wt inventory entries having a defined in-memory kind: their kind is whatever is on disk. But doing that would probably be much too big for 2.0. I might try a 2.3 branch for it later.

There may be more problem cases.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

My only comment is that the tests for "tree.smart_add(['tree/a/file'])", etc, don't actually assert the state of the final tree. Just that tree.smart_add() doesn't fail.

Which I think does prove that bug 192859 is fixed, but it would be more useful as an ongoing test to not just assert that the functions don't fail with an exception, but that they did have the expected effect (the tree now sees a dir, etc.)

review: Needs Fixing
Revision history for this message
Martin Pool (mbp) wrote :
Revision history for this message
Martin Pool (mbp) wrote :

I've added an additional test assertion, so I might merge this on the basis of John's tweak-type review.

Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/tests/per_workingtree/test_symlinks.py'
--- bzrlib/tests/per_workingtree/test_symlinks.py 2010-07-17 17:16:19 +0000
+++ bzrlib/tests/per_workingtree/test_symlinks.py 2010-07-20 15:37:47 +0000
@@ -21,6 +21,7 @@
2121
22from bzrlib import (22from bzrlib import (
23 builtins,23 builtins,
24 osutils,
24 tests,25 tests,
25 workingtree,26 workingtree,
26 )27 )
@@ -79,24 +80,13 @@
7980
80 _test_needs_features = [tests.SymlinkFeature]81 _test_needs_features = [tests.SymlinkFeature]
8182
82 def test_symlink_to_dir(self):83 def test_symlink_changes_to_dir(self):
83 # <https://bugs.launchpad.net/bzr/+bug/192859>:84 # <https://bugs.launchpad.net/bzr/+bug/192859>:
84 # we had some past problems with the workingtree remembering for too85 # we had some past problems with the workingtree remembering for too
85 # long what kind of object was at a particular name; we really86 # long what kind of object was at a particular name; we really
86 # shouldn't do that. Operating on the dirstate through passing87 # shouldn't do that. Operating on the dirstate through passing
87 # inventory deltas rather than mutating the inventory largely avoids88 # inventory deltas rather than mutating the inventory largely avoids
88 # that.89 # that.
89 if self.workingtree_format.upgrade_recommended:
90 # File "bzrlib/workingtree.py", line 2341, in conflicts
91 # for conflicted in self._iter_conflicts():
92 # File "bzrlib/workingtree.py", line 1590, in _iter_conflicts
93 # for info in self.list_files():
94 # File "bzrlib/workingtree.py", line 1203, in list_files
95 # f_ie = inv.get_child(from_dir_id, f)
96 # File "bzrlib/inventory.py", line 1269, in get_child
97 # return self[parent_id].children.get(filename)
98 # AttributeError: children
99 raise tests.TestSkipped("known broken on pre-dirstate formats; wontfix")
100 tree = self.make_branch_and_tree('tree')90 tree = self.make_branch_and_tree('tree')
101 self.build_tree_contents([91 self.build_tree_contents([
102 ('tree/a@', 'target')])92 ('tree/a@', 'target')])
@@ -109,6 +99,29 @@
109 ])99 ])
110 tree.smart_add(['tree/a/f'])100 tree.smart_add(['tree/a/f'])
111 tree.commit('change to dir')101 tree.commit('change to dir')
102 tree.lock_read()
103 self.addCleanup(tree.unlock)
104 self.assertEquals([], list(tree.iter_changes(tree.basis_tree())))
105
106 def test_dir_changes_to_symlink(self):
107 # <https://bugs.launchpad.net/bzr/+bug/192859>:
108 # we had some past problems with the workingtree remembering for too
109 # long what kind of object was at a particular name; we really
110 # shouldn't do that. Operating on the dirstate through passing
111 # inventory deltas rather than mutating the inventory largely avoids
112 # that.
113 tree = self.make_branch_and_tree('tree')
114 self.build_tree_contents([
115 ('tree/a/',),
116 ('tree/a/file', 'content'),
117 ])
118 tree.smart_add(['tree/a'])
119 tree.commit('add dir')
120 osutils.rmtree('tree/a')
121 self.build_tree_contents([
122 ('tree/a@', 'target'),
123 ])
124 tree.commit('change to symlink')
112125
113126
114class TestOpenTree(TestCaseWithWorkingTree):127class TestOpenTree(TestCaseWithWorkingTree):

Subscribers

People subscribed via source and target branches