20
20
from __future__ import absolute_import
26
from breezy.bundle.serializer import (
28
28
_get_bundle_header,
31
from ..bundle_data import (
30
from breezy.bundle.serializer import binary_diff
31
from breezy.bundle.bundle_data import (
35
from ....diff import internal_diff
36
from ....revision import NULL_REVISION
37
from ....sixish import text_type
38
from ...testament import StrictTestament
39
from ....timestamp import (
35
from breezy.diff import internal_diff
36
from breezy.revision import NULL_REVISION
37
from breezy.sixish import text_type
38
from breezy.bzr.testament import StrictTestament
39
from breezy.timestamp import (
40
40
format_highres_date,
42
from ....textfile import text_file
43
from ....trace import mutter
42
from breezy.textfile import text_file
43
from breezy.trace import mutter
45
45
bool_text = {True: 'yes', False: 'no'}
311
310
delta = new_tree.changes_from(old_tree, want_unchanged=True,
312
311
include_root=True)
313
for change in delta.removed:
314
action = Action('removed', [change.kind[0], change.path[0]]).write(self.to_file)
312
for path, file_id, kind in delta.removed:
313
action = Action('removed', [kind, path]).write(self.to_file)
316
# TODO(jelmer): Treat copied specially here?
317
for change in delta.added + delta.copied:
315
for path, file_id, kind in delta.added:
319
'added', [change.kind[1], change.path[1]],
320
[('file-id', change.file_id.decode('utf-8'))])
321
meta_modified = (change.kind[1] == 'file' and
322
change.executable[1])
323
finish_action(action, change.file_id, change.kind[1], meta_modified, change.changed_content,
324
DEVNULL, change.path[1])
326
for change in delta.renamed:
327
action = Action('renamed', [change.kind[1], change.path[0]], [(change.path[1],)])
328
finish_action(action, change.file_id, change.kind[1], change.meta_modified(), change.changed_content,
329
change.path[0], change.path[1])
331
for change in delta.modified:
332
action = Action('modified', [change.kind[1], change.path[1]])
333
finish_action(action, change.file_id, change.kind[1], change.meta_modified(), change.changed_content,
334
change.path[0], change.path[1])
336
for change in delta.unchanged:
337
new_rev = new_tree.get_file_revision(change.path[1])
317
'added', [kind, path], [('file-id', file_id.decode('utf-8'))])
318
meta_modified = (kind == 'file' and
319
new_tree.is_executable(path))
320
finish_action(action, file_id, kind, meta_modified, True,
323
for (old_path, new_path, file_id, kind,
324
text_modified, meta_modified) in delta.renamed:
325
action = Action('renamed', [kind, old_path], [(new_path,)])
326
finish_action(action, file_id, kind, meta_modified, text_modified,
329
for (path, file_id, kind,
330
text_modified, meta_modified) in delta.modified:
331
action = Action('modified', [kind, path])
332
finish_action(action, file_id, kind, meta_modified, text_modified,
335
for path, file_id, kind in delta.unchanged:
336
new_rev = new_tree.get_file_revision(path)
338
337
if new_rev is None:
340
old_rev = old_tree.get_file_revision(change.path[0])
339
old_rev = old_tree.get_file_revision(old_tree.id2path(file_id))
341
340
if new_rev != old_rev:
342
action = Action('modified', [change.kind[1], change.path[1]])
341
action = Action('modified', [new_tree.kind(path), path])
343
342
action.add_utf8_property('last-changed', new_rev)
344
343
action.write(self.to_file)