162
162
# mutter('start compare_trees')
164
164
root_id = new_tree.inventory.root.file_id
165
# TODO: Rather than iterating over the whole tree and then filtering, we
166
# could diff just the specified files (if any) and their subtrees.
168
165
for (file_id, path, content_change, versioned, parent_id, name, kind,
169
executable) in new_tree.iter_changes(old_tree, want_unchanged):
170
if specific_file_ids and file_id not in specific_file_ids:
166
executable) in new_tree.iter_changes(old_tree, want_unchanged,
172
168
if file_id == root_id:
174
170
assert kind[0] == kind[1] or None in kind
175
171
# the only 'kind change' permitted is creation/deletion
176
172
fully_present = tuple((versioned[x] and kind[x] is not None) for
178
if fully_present[1] and not fully_present[0]:
179
delta.added.append((path, file_id, kind[1]))
180
elif fully_present[0] and not fully_present[1]:
181
old_path = old_tree.id2path(file_id)
182
delta.removed.append((old_path, file_id, kind[0]))
174
if fully_present[0] != fully_present[1]:
175
if fully_present[1] is True:
176
delta.added.append((path, file_id, kind[1]))
178
assert fully_present[0] is True
179
old_path = old_tree.id2path(file_id)
180
delta.removed.append((old_path, file_id, kind[0]))
181
elif fully_present[0] is False:
183
183
elif name[0] != name[1] or parent_id[0] != parent_id[1]:
184
184
# If the name changes, or the parent_id changes, we have a rename
185
185
# (if we move a parent, that doesn't count as a rename for the