Rev 2421: Try to create an intertree test that exposes the walkdir vs dirstate mismatch. No luck yet. in http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate
John Arbash Meinel
john at arbash-meinel.com
Mon Feb 26 21:52:05 GMT 2007
At http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate
------------------------------------------------------------
revno: 2421
revision-id: john at arbash-meinel.com-20070226215104-1bv5mq6ac140jc15
parent: john at arbash-meinel.com-20070226211703-hqcam97hrxohk5jc
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate
timestamp: Mon 2007-02-26 15:51:04 -0600
message:
Try to create an intertree test that exposes the walkdir vs dirstate mismatch. No luck yet.
modified:
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
-------------- next part --------------
=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py 2007-02-26 05:14:05 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py 2007-02-26 21:51:04 +0000
@@ -308,6 +308,25 @@
tree1.unlock()
tree2.unlock()
+ def make_tree_with_special_names(self):
+ """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-foo', 'b-zar',
+ 'bar', 'bfoo','bzar',
+ 'b/', 'b/ar', 'b/foo/', 'b/zar',
+ 'b/foo-a', 'b/foo-z',
+ 'b/fooa', 'b/fooz',
+ 'b/foo/a', 'b/foo/z',
+ ]
+ 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)
+ 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)
+
def test_compare_empty_trees(self):
tree1 = self.make_branch_and_tree('1')
tree2 = self.make_to_branch_and_tree('2')
@@ -700,3 +719,12 @@
self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
specific_files=['added', 'changed', 'fromdir', 'fromfile',
'removed', 'unchanged', 'todir', 'tofile']))
+
+ def test_tree_with_special_names(self):
+ tree1, tree2, paths, path_ids = self.make_tree_with_special_names()
+ tree1.lock_read()
+ self.addCleanup(tree1.unlock)
+ tree2.lock_read()
+ 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))
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2007-02-26 19:18:58 +0000
+++ b/bzrlib/workingtree_4.py 2007-02-26 21:51:04 +0000
@@ -319,7 +319,8 @@
# add this entry to the parent map.
parent_ies[(dirname + '/' + name).strip('/')] = inv_entry
# These checks cost us around 40ms on a 55k entry tree
- assert file_id not in inv_byid
+ assert file_id not in inv_byid, ('file_id %s already in'
+ ' inventory as %s' % (file_id, inv_byid[file_id]))
assert name_unicode not in parent_ie.children
inv_byid[file_id] = inv_entry
parent_ie.children[name_unicode] = inv_entry
More information about the bazaar-commits
mailing list