Tree._iter_changes(specific_files=[]) behaviour.
Wouter van Heyst
larstiq at larstiq.dyndns.org
Sat Jul 14 11:14:36 BST 2007
Hi Aaron,
I believe the recent _iter_changes based merge introduced in bzr.dev r2603
throws off at least one test in nested-trees. When calling
tree.merge_from_branch and passing in an empty list of specific files,
that list gets ignored. Merger.set_interesting_files used to build a
set of interesting_ids, but now it is left to tree._iter_changes. When
you pass specific_files=[] to tree._iterchanges it iterates over all the
changes between the two trees.
I think my question is, what do we want _iter_changes(specific_files=[])
to do? Klaus ran into similar questions for tree.{revert,add,commit},
they're not consistent in handling files=[].
The test below fails:
def test_nested_conflicts(self):
tree, sub_tree, tree2 = self.prepare_nested_merge()
self.build_tree_contents([('tree/sub-tree/file', 'text3')])
tree.commit('changed text to text3')
self.assertEqual(0, tree.merge_from_branch(tree2.branch,
interesting_files=[]))
The relevant hunk:
@@ -168,11 +169,7 @@
self.this_rev_id = self.this_basis
def set_interesting_files(self, file_list):
- try:
- self._set_interesting_files(file_list)
- except NotVersionedError, e:
- raise BzrCommandError("%s is not a source file in any"
- " tree." % e.path)
+ self.interesting_files = file_list
def _set_interesting_files(self, file_list):
"""Set the list of interesting ids from a list of files."""
With the rest of _set_intereseting_files being:
def _set_interesting_files(self, file_list):
"""Set the list of interesting ids from a list of files."""
if file_list is None:
self.interesting_ids = None
return
interesting_ids = set()
for path in file_list:
found_id = False
for tree in (self.this_tree, self.base_tree, self.other_tree):
file_id = tree.path2id(path)
if file_id is not None:
interesting_ids.add(file_id)
found_id = True
if not found_id:
raise NotVersionedError(path=path)
self.interesting_ids = interesting_ids
Wouter van Heyst
More information about the bazaar
mailing list