Rev 5867: Handle a bunch of rename cases. 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 09:57:03 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.4-set-parent-trees-delta-282941
------------------------------------------------------------
revno: 5867
revision-id: john at arbash-meinel.com-20110519095654-frxbnbw2q43bmc2j
parent: john at arbash-meinel.com-20110519093148-4jei0cq6r46itxai
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-set-parent-trees-delta-282941
timestamp: Thu 2011-05-19 11:56:54 +0200
message:
Handle a bunch of rename cases.
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py 2011-05-19 09:31:48 +0000
+++ b/bzrlib/dirstate.py 2011-05-19 09:56:54 +0000
@@ -1713,7 +1713,9 @@
if not f_present:
continue
active_entry = self._dirblocks[block_i][1][entry_i]
- if active_entry is entry:
+ if (active_entry[0][2] != file_id):
+ # Some other file is at this path, we don't need to
+ # link it.
continue
real_active_kind = active_entry[1][0][0]
if real_active_kind in 'ar':
=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py 2011-05-19 09:12:07 +0000
+++ b/bzrlib/tests/test_dirstate.py 2011-05-19 09:56:54 +0000
@@ -2505,7 +2505,7 @@
state2 = self.create_empty_dirstate()
state2.set_state_from_scratch(active_tree.inventory,
[('target', target_tree)], [])
- self.assertEqual(state._dirblocks, state2._dirblocks)
+ self.assertEqual(state2._dirblocks, state._dirblocks)
return state
def test_remove_file_matching_active_state(self):
@@ -2564,3 +2564,47 @@
basis =[],
target=[('file', 'file-id')],
)
+
+ def test_add_file_active_state_has_diff_file_and_file_elsewhere(self):
+ state = self.assertUpdate(
+ active=[('other-file', 'file-id'),
+ ('file', 'file-id-2')],
+ basis =[],
+ target=[('file', 'file-id')],
+ )
+
+ def test_rename_file_matching_active_state(self):
+ state = self.assertUpdate(
+ active=[('other-file', 'file-id')],
+ basis =[('file', 'file-id')],
+ target=[('other-file', 'file-id')],
+ )
+
+ def test_rename_file_missing_in_active_state(self):
+ state = self.assertUpdate(
+ active=[],
+ basis =[('file', 'file-id')],
+ target=[('other-file', 'file-id')],
+ )
+
+ def test_rename_file_present_elsewhere_in_active_state(self):
+ state = self.assertUpdate(
+ active=[('third', 'file-id')],
+ basis =[('file', 'file-id')],
+ target=[('other-file', 'file-id')],
+ )
+
+ def test_rename_file_active_state_has_diff_source_file(self):
+ import pdb; pdb.set_trace()
+ state = self.assertUpdate(
+ active=[('file', 'file-id-2')],
+ basis =[('file', 'file-id')],
+ target=[('other-file', 'file-id')],
+ )
+
+ def test_rename_file_active_state_has_diff_target_file(self):
+ state = self.assertUpdate(
+ active=[('other-file', 'file-id-2')],
+ basis =[('file', 'file-id')],
+ target=[('other-file', 'file-id')],
+ )
More information about the bazaar-commits
mailing list