/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/delta.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-06-15 17:53:40 UTC
  • mfrom: (7322.1.8 objects-1)
  • Revision ID: breezy.the.bot@gmail.com-20190615175340-yxo036zu96wh8lcz
Use the new attributes on TreeChange rather than indexing.

Merged from https://code.launchpad.net/~jelmer/brz/objects-1/+merge/368859

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
    delta = TreeDelta()
126
126
    # mutter('start compare_trees')
127
127
 
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]))
135
 
            continue
136
 
        if not include_root and (None, None) == parent_id:
137
 
            continue
138
 
        fully_present = tuple((versioned[x] and kind[x] is not None) for
139
 
                              x in range(2))
 
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]))
 
134
            continue
 
135
        if not include_root and (None, None) == change.parent_id:
 
136
            continue
 
137
        fully_present = tuple(
 
138
            (change.versioned[x] and change.kind[x] is not None)
 
139
            for x in range(2))
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]))
143
143
            else:
144
 
                if kind[0] == 'symlink' and not new_tree.supports_symlinks():
 
144
                if change.kind[0] == 'symlink' and not new_tree.supports_symlinks():
145
145
                    trace.warning(
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],))
148
148
                else:
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
155
156
            # file)
156
 
            delta.renamed.append((path[0],
157
 
                                  path[1],
158
 
                                  file_id,
159
 
                                  kind[1],
160
 
                                  content_change,
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],
166
 
                                   content_change,
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])))
168
168
        else:
169
 
            delta.unchanged.append((path[1], file_id, kind[1]))
 
169
            delta.unchanged.append((change.path[1], change.file_id, change.kind[1]))
170
170
 
171
171
    delta.removed.sort()
172
172
    delta.added.sort()