Rev 2428: add a test that shows _iter_changes works when only contents have changed, and nothing is considered newly added. in http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate
John Arbash Meinel
john at arbash-meinel.com
Tue Feb 27 22:08:55 GMT 2007
At http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate
------------------------------------------------------------
revno: 2428
revision-id: john at arbash-meinel.com-20070227220753-bdvb7lo8fu5yhqg9
parent: john at arbash-meinel.com-20070227213216-a6kogwpq49j6dgpm
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate
timestamp: Tue 2007-02-27 16:07:53 -0600
message:
add a test that shows _iter_changes works when only contents have changed, and nothing is considered newly added.
modified:
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
-------------- next part --------------
=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py 2007-02-27 21:32:16 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py 2007-02-27 22:07:53 +0000
@@ -312,29 +312,49 @@
"""Create a tree with filenames chosen to exercise the walk order."""
tree1 = self.make_branch_and_tree('tree1')
tree2 = self.make_to_branch_and_tree('tree2')
- from_paths = ['b-ar/', 'b-ar/a',
- 'b-foo/', 'b-foo/a',
- 'b-zar/', 'b-zar/a',
- 'bar/', 'bar/a',
- 'bfoo/', 'bfoo/a',
- 'bzar/', 'bzar/a',
- 'b/', 'b/a',
- 'b/ar/', 'b/ar/a',
- 'b/foo/', 'b/foo/a',
- 'b/zar/', 'b/zar/a',
- 'b/foo-a/', 'b/foo-a/a',
- 'b/foo-z/', 'b/foo-z/a',
- 'b/fooa/', 'b/fooa/a',
- 'b/fooz/', 'b/fooz/a',
- 'b/foo/z/', 'b/foo/z/a',
- ]
- self.build_tree(['tree2/' + p for p in from_paths])
- paths_no_slashes = [p.strip('/') for p in from_paths]
- path_ids = [p.replace('/', '_') + '-id' for p in paths_no_slashes]
- tree2.add(paths_no_slashes, path_ids)
+ paths, path_ids = self._create_special_names(tree2, 'tree2')
tree2.commit('initial', rev_id='rev-1')
tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
- return (tree1, tree2, paths_no_slashes, path_ids)
+ return (tree1, tree2, paths, path_ids)
+
+ def make_trees_with_special_names(self):
+ """Both trees will use the special names.
+
+ But the contents will differ for each file.
+ """
+ tree1 = self.make_branch_and_tree('tree1')
+ tree2 = self.make_to_branch_and_tree('tree2')
+ paths, path_ids = self._create_special_names(tree1, 'tree1')
+ paths, path_ids = self._create_special_names(tree2, 'tree2')
+ tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
+ return (tree1, tree2, paths, path_ids)
+
+ def _create_special_names(self, tree, base_path):
+ """Create a tree with paths that expose differences in sort orders."""
+ # Each directory will have a single file named 'f' inside
+ dirs = ['a',
+ 'a-a',
+ 'a/a',
+ 'a/a-a',
+ 'a/a/a',
+ 'a/a/a-a',
+ 'a/a/a/a',
+ 'a/a/a/a-a',
+ 'a/a/a/a/a',
+ ]
+ with_slashes = []
+ paths = []
+ path_ids = []
+ for d in dirs:
+ with_slashes.append(base_path + '/' + d + '/')
+ with_slashes.append(base_path + '/' + d + '/f')
+ paths.append(d)
+ paths.append(d+'/f')
+ path_ids.append(d.replace('/', '_') + '-id')
+ path_ids.append(d.replace('/', '_') + '_f-id')
+ self.build_tree(with_slashes)
+ tree.add(paths, path_ids)
+ return paths, path_ids
def test_compare_empty_trees(self):
tree1 = self.make_branch_and_tree('1')
@@ -737,3 +757,13 @@
self.addCleanup(tree2.unlock)
expected = sorted(self.added(tree2, f_id) for f_id in path_ids)
self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
+
+ def test_trees_with_special_names(self):
+ tree1, tree2, paths, path_ids = self.make_trees_with_special_names()
+ tree1.lock_read()
+ self.addCleanup(tree1.unlock)
+ tree2.lock_read()
+ self.addCleanup(tree2.unlock)
+ expected = sorted(self.content_changed(tree2, f_id) for f_id in path_ids
+ if f_id.endswith('_f-id'))
+ self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
More information about the bazaar-commits
mailing list