Rev 3539: Handle when OTHER doesn't have the entry. in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/merge_lca_multi
John Arbash Meinel
john at arbash-meinel.com
Wed Jul 23 00:14:59 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/merge_lca_multi
------------------------------------------------------------
revno: 3539
revision-id: john at arbash-meinel.com-20080722231354-fem3xq4gkjusdf8j
parent: john at arbash-meinel.com-20080722230449-4mn4a3q2pr5b1zyq
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge_lca_multi
timestamp: Tue 2008-07-22 18:13:54 -0500
message:
Handle when OTHER doesn't have the entry.
-------------- next part --------------
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py 2008-07-22 22:25:42 +0000
+++ b/bzrlib/merge.py 2008-07-22 23:13:54 +0000
@@ -668,22 +668,29 @@
this_inventory = self.this_tree.inventory
for path, file_id, other_ie, lca_values in walker.iter_all():
# Is this modified at all from any of the other trees?
- last_rev = other_ie.revision
+ if other_ie is None:
+ last_rev = other_kind = other_parent_id = other_name = None
+ other_executable = None
+ else:
+ last_rev = other_ie.revision
+ other_kind = other_ie.kind
+ other_parent_id = other_ie.parent_id
+ other_name = other_ie.name
+ other_executable = other_ie.executable
+
# I believe we can actually change this to see if last_rev is
# identical to *any* of the lca values.
for lca_path, ie in lca_values:
- if ie is None or ie.revision != last_rev:
+ if ((ie is None and other_ie is not None)
+ or ie.revision != last_rev):
break
else: # Identical in all trees
continue
- other_kind = other_ie.kind
- other_parent_id = other_ie.parent_id
- other_name = other_ie.name
kind_changed = False
parent_id_changed = False
name_changed = False
for lca_path, ie in lca_values:
- if ie is None:
+ if ie is None and other_ie is not None:
kind_changed = parent_id_changed = name_changed = True
break
if ie.kind != other_kind:
@@ -730,11 +737,11 @@
# If we have gotten this far, that means something has changed
result.append((file_id, True,
((base_parent_id, lca_parent_ids),
- other_ie.parent_id, this_parent_id),
+ other_parent_id, this_parent_id),
((base_name, lca_names),
- other_ie.name, this_name),
+ other_name, this_name),
((base_executable, lca_executable),
- other_ie.executable, this_executable)
+ other_executable, this_executable)
))
return result
=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py 2008-07-22 23:04:49 +0000
+++ b/bzrlib/tests/test_merge.py 2008-07-22 23:13:54 +0000
@@ -1339,6 +1339,26 @@
((None, [None, False]), False, False)),
], entries)
+ def test_not_in_other(self):
+ builder = self.get_builder()
+ builder.build_snapshot('A-id', None,
+ [('add', (u'', 'a-root-id', 'directory', None)),
+ ('add', (u'a', 'a-id', 'file', 'a\nb\nc\n'))])
+ builder.build_snapshot('B-id', ['A-id'], [])
+ builder.build_snapshot('C-id', ['A-id'], [])
+ builder.build_snapshot('E-id', ['C-id', 'B-id'],
+ [('unversion', 'a-id')])
+ builder.build_snapshot('D-id', ['B-id', 'C-id'], [])
+ merge_obj = self.make_merge_obj(builder, 'E-id')
+
+ entries = list(merge_obj._entries_lca())
+ root_id = 'a-root-id'
+ self.assertEqual([('a-id', True,
+ ((root_id, [root_id, root_id]), None, root_id),
+ ((u'a', [u'a', u'a']), None, u'a'),
+ ((False, [False, False]), None, False)),
+ ], entries)
+
# TODO: cases to test
# simple criss-cross LCAS identical, BASE different
# x-x changed from BASE but identical for all LCAs and tips
More information about the bazaar-commits
mailing list