172
172
if file_id == root_id:
174
assert kind is None or None in kind
174
assert kind[0] == kind[1] or None in kind
175
175
# the only 'kind change' permitted is creation/deletion
180
new_kind = new_tree.kind(file_id)
181
except errors.NoSuchFile:
184
177
# If the name changes, or the parent_id changes, we have a rename
185
178
# (if we move a parent, that doesn't count as a rename for the file)
186
if versioned is not None:
187
if versioned == (False, True) and (kind is not None
179
if versioned[0] != versioned[1]:
180
if versioned == (False, True) and (kind[0] != kind[1]
188
181
and kind[1] is not None):
189
delta.added.append((path, file_id, new_kind))
182
delta.added.append((path, file_id, kind[1]))
191
184
assert versioned == (True, False)
192
185
old_path = old_tree.id2path(file_id)
193
186
old_kind = old_tree.kind(file_id)
194
187
delta.removed.append((old_path, file_id, old_kind))
195
elif kind is not None:
188
elif kind[0] != kind[1]:
196
189
if kind[0] is None:
197
delta.added.append((path, file_id, new_kind))
190
delta.added.append((path, file_id, kind[1]))
199
192
assert kind[1] is None
200
193
old_path = old_tree.id2path(file_id)
201
194
old_kind = old_tree.kind(file_id)
202
195
delta.removed.append((old_path, file_id, old_kind))
204
elif name is not None or parent_id is not None:
197
elif name[0] != name[1] or parent_id[0] != parent_id[1]:
205
198
old_path = old_tree.id2path(file_id)
206
199
delta.renamed.append((old_path,
210
content_change, (executable is not None)))
211
elif content_change is True or executable is not None:
212
delta.modified.append((path, file_id, new_kind,
213
content_change, (executable is not None)))
204
(executable[0] != executable[1])))
205
elif content_change is True or executable[0] != executable[1]:
206
delta.modified.append((path, file_id, kind[1],
208
(executable[0] != executable[1])))
215
delta.unchanged.append((path, file_id, new_kind))
210
delta.unchanged.append((path, file_id, kind[1]))
217
212
delta.removed.sort()
218
213
delta.added.sort()