Rev 6059: Add a direct Dirstate.update_basis_by_delta test. in http://bazaar.launchpad.net/~jameinel/bzr/2.4-dirstate-invalid-delta-855155
John Arbash Meinel
john at arbash-meinel.com
Wed May 29 06:00:18 UTC 2013
At http://bazaar.launchpad.net/~jameinel/bzr/2.4-dirstate-invalid-delta-855155
------------------------------------------------------------
revno: 6059
revision-id: john at arbash-meinel.com-20130529060009-mmt09o6li47f05r5
parent: john at arbash-meinel.com-20130528081113-azyyvad54c3am2oq
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-dirstate-invalid-delta-855155
timestamp: Wed 2013-05-29 07:00:09 +0100
message:
Add a direct Dirstate.update_basis_by_delta test.
Requires a slight tweak to the create_tree_from_shape code so that we
can set the exact revision_id for an entry (so a dir doesn't look changed
when it shouldn't).
-------------- next part --------------
=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py 2011-05-25 13:44:28 +0000
+++ b/bzrlib/tests/test_dirstate.py 2013-05-29 06:00:09 +0000
@@ -2477,7 +2477,13 @@
def create_tree_from_shape(self, rev_id, shape):
dir_ids = {'': 'root-id'}
inv = inventory.Inventory('root-id', rev_id)
- for path, file_id in shape:
+ #for path, file_id in shape:
+ for info in shape:
+ if len(info) == 2:
+ path, file_id = info
+ ie_rev_id = rev_id
+ else:
+ path, file_id, ie_rev_id = info
if path == '':
# Replace the root entry
del inv._byid[inv.root.file_id]
@@ -2485,7 +2491,7 @@
inv._byid[file_id] = inv.root
dir_ids[''] = file_id
continue
- inv.add(self.path_to_ie(path, file_id, rev_id, dir_ids))
+ inv.add(self.path_to_ie(path, file_id, ie_rev_id, dir_ids))
return revisiontree.InventoryRevisionTree(_Repo(), inv, rev_id)
def create_empty_dirstate(self):
@@ -2527,6 +2533,7 @@
state.set_state_from_scratch(active_tree.inventory,
[('basis', basis_tree)], [])
delta = target_tree.inventory._make_delta(basis_tree.inventory)
+ import pdb; pdb.set_trace()
state.update_basis_by_delta(delta, 'target')
state._validate()
dirstate_tree = workingtree_4.DirStateRevisionTree(state,
@@ -2613,6 +2620,13 @@
target=[('file', 'file-id')],
)
+ def test_add_file_in_empty_dir_not_matching_active_state(self):
+ state = self.assertUpdate(
+ active=[],
+ basis=[('dir/', 'dir-id')],
+ target=[('dir/', 'dir-id', 'basis'), ('dir/file', 'file-id')],
+ )
+
def test_add_file_missing_in_active_state(self):
state = self.assertUpdate(
active=[],
More information about the bazaar-commits
mailing list