Rev 5883: test cases for stuff like a parent becoming its own parent, in http://bazaar.launchpad.net/~jameinel/bzr/2.4-set-parent-trees-delta-282941
John Arbash Meinel
john at arbash-meinel.com
Thu May 19 15:03:08 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.4-set-parent-trees-delta-282941
------------------------------------------------------------
revno: 5883
revision-id: john at arbash-meinel.com-20110519150258-qbvu80sa6qp7ndu1
parent: john at arbash-meinel.com-20110519144205-427xxh4ob11g8zqy
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-set-parent-trees-delta-282941
timestamp: Thu 2011-05-19 17:02:58 +0200
message:
test cases for stuff like a parent becoming its own parent,
and replacing a directory underneath an otherwise unmoving child.
(broken)
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py 2011-05-19 13:56:58 +0000
+++ b/bzrlib/dirstate.py 2011-05-19 15:02:58 +0000
@@ -1764,9 +1764,11 @@
for old_path, new_path, file_id, new_details in changes:
# the entry for this file_id must be in tree 0.
entry = self._get_entry(1, file_id, new_path)
- if entry[0] is None or entry[1][1][0] in 'ar':
+ if entry[0] is None or entry[1][1][0] == 'a':
self._raise_invalid(new_path, file_id,
'changed entry considered not present')
+ if entry[1][1][0] == 'r':
+ import pdb; pdb.set_trace()
entry[1][1] = new_details
def _update_basis_apply_deletes(self, deletes):
=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py 2011-05-19 13:37:13 +0000
+++ b/bzrlib/tests/test_dirstate.py 2011-05-19 15:02:58 +0000
@@ -2758,6 +2758,57 @@
basis= [],
delta=[(None, 'path/path2', 'file-id')])
+ def test_renamed_dir_same_path(self):
+ # We replace the parent directory, with another parent dir. But the C
+ # file doesn't look like it has been moved.
+ state = self.assertUpdate(# Same as basis
+ active=[('A/', 'A-id'),
+ ('A/B', 'B-id')],
+ basis= [('A/', 'A-id'),
+ ('A/B', 'B-id')],
+ target=[('A/', 'C-id'),
+ ('A/B', 'B-id')])
+
+ def test_parent_child_swap(self):
+ state = self.assertUpdate(# Same as basis
+ active=[('A/', 'A-id'),
+ ('A/B/', 'B-id'),
+ ('A/B/C', 'C-id')],
+ basis= [('A/', 'A-id'),
+ ('A/B/', 'B-id'),
+ ('A/B/C', 'C-id')],
+ target=[('A/', 'B-id'),
+ ('A/B/', 'A-id'),
+ ('A/B/C', 'C-id')])
+ state = self.assertUpdate(# Same as target
+ active=[('A/', 'B-id'),
+ ('A/B/', 'A-id'),
+ ('A/B/C', 'C-id')],
+ basis= [('A/', 'A-id'),
+ ('A/B/', 'B-id'),
+ ('A/B/C', 'C-id')],
+ target=[('A/', 'B-id'),
+ ('A/B/', 'A-id'),
+ ('A/B/C', 'C-id')])
+ state = self.assertUpdate(# empty active
+ active=[],
+ basis= [('A/', 'A-id'),
+ ('A/B/', 'B-id'),
+ ('A/B/C', 'C-id')],
+ target=[('A/', 'B-id'),
+ ('A/B/', 'A-id'),
+ ('A/B/C', 'C-id')])
+ state = self.assertUpdate(# different active
+ active=[('D/', 'A-id'),
+ ('D/E/', 'B-id'),
+ ('F', 'C-id')],
+ basis= [('A/', 'A-id'),
+ ('A/B/', 'B-id'),
+ ('A/B/C', 'C-id')],
+ target=[('A/', 'B-id'),
+ ('A/B/', 'A-id'),
+ ('A/B/C', 'C-id')])
+
def test_change_root_id(self):
state = self.assertUpdate( # same as basis
active=[('', 'root-id'),
More information about the bazaar-commits
mailing list