~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/delta.py

  • Committer: Aaron Bentley
  • Date: 2006-09-19 16:17:31 UTC
  • mto: This revision was merged to the branch mainline in revision 2162.
  • Revision ID: abentley@panoramicfeedback.com-20060919161731-4a099268251f858c
Implement specific file id and dangling id handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
    # mutter('start compare_trees')
163
163
 
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.  
167
 
 
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:
171
 
            continue
 
166
         executable) in new_tree.iter_changes(old_tree, want_unchanged, 
 
167
                                              specific_file_ids):
172
168
        if file_id == root_id:
173
169
            continue
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
177
173
                              x in range(2))
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]))
 
177
            else:
 
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:
 
182
            continue
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