125
125
delta = TreeDelta()
126
126
# mutter('start compare_trees')
128
for (file_id, path, content_change, versioned, parent_id, name, kind,
129
executable) in new_tree.iter_changes(old_tree, want_unchanged,
130
specific_files, extra_trees=extra_trees,
131
require_versioned=require_versioned,
132
want_unversioned=want_unversioned):
133
if versioned == (False, False):
134
delta.unversioned.append((path[1], None, kind[1]))
136
if not include_root and (None, None) == parent_id:
138
fully_present = tuple((versioned[x] and kind[x] is not None) for
128
for change in new_tree.iter_changes(
129
old_tree, want_unchanged, specific_files, extra_trees=extra_trees,
130
require_versioned=require_versioned,
131
want_unversioned=want_unversioned):
132
if change.versioned == (False, False):
133
delta.unversioned.append((change.path[1], None, change.kind[1]))
135
if not include_root and (None, None) == change.parent_id:
137
fully_present = tuple(
138
(change.versioned[x] and change.kind[x] is not None)
140
140
if fully_present[0] != fully_present[1]:
141
141
if fully_present[1] is True:
142
delta.added.append((path[1], file_id, kind[1]))
142
delta.added.append((change.path[1], change.file_id, change.kind[1]))
144
if kind[0] == 'symlink' and not new_tree.supports_symlinks():
144
if change.kind[0] == 'symlink' and not new_tree.supports_symlinks():
146
146
'Ignoring "%s" as symlinks '
147
'are not supported on this filesystem.' % (path[0],))
147
'are not supported on this filesystem.' % (change.path[0],))
149
delta.removed.append((path[0], file_id, kind[0]))
149
delta.removed.append(
150
(change.path[0], change.file_id, change.kind[0]))
150
151
elif fully_present[0] is False:
151
delta.missing.append((path[1], file_id, kind[1]))
152
elif name[0] != name[1] or parent_id[0] != parent_id[1]:
152
delta.missing.append((change.path[1], change.file_id, change.kind[1]))
153
elif change.name[0] != change.name[1] or change.parent_id[0] != change.parent_id[1]:
153
154
# If the name changes, or the parent_id changes, we have a rename
154
155
# (if we move a parent, that doesn't count as a rename for the
156
delta.renamed.append((path[0],
161
(executable[0] != executable[1])))
162
elif kind[0] != kind[1]:
163
delta.kind_changed.append((path[1], file_id, kind[0], kind[1]))
164
elif content_change or executable[0] != executable[1]:
165
delta.modified.append((path[1], file_id, kind[1],
167
(executable[0] != executable[1])))
157
delta.renamed.append(
158
(change.path[0], change.path[1], change.file_id,
159
change.kind[1], change.changed_content,
160
(change.executable[0] != change.executable[1])))
161
elif change.kind[0] != change.kind[1]:
162
delta.kind_changed.append(
163
(change.path[1], change.file_id, change.kind[0], change.kind[1]))
164
elif change.changed_content or change.executable[0] != change.executable[1]:
165
delta.modified.append((change.path[1], change.file_id, change.kind[1],
166
change.changed_content,
167
(change.executable[0] != change.executable[1])))
169
delta.unchanged.append((path[1], file_id, kind[1]))
169
delta.unchanged.append((change.path[1], change.file_id, change.kind[1]))
171
171
delta.removed.sort()
172
172
delta.added.sort()