~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 13:58:08 UTC
  • mto: This revision was merged to the branch mainline in revision 2162.
  • Revision ID: abentley@panoramicfeedback.com-20060919135808-4187174fc93b3d10
Always generate tuples (because kind is always used, even when not different)

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
            continue
172
172
        if file_id == root_id:
173
173
            continue
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
176
 
        if kind is not None:
177
 
            new_kind = kind[1]
178
 
        else:
179
 
            try:
180
 
                new_kind = new_tree.kind(file_id)
181
 
            except errors.NoSuchFile:
182
 
                new_kind = None
183
176
 
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]))
190
183
            else:
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]))
198
191
            else:
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))
203
196
                
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,
207
200
                                  path,
208
201
                                  file_id, 
209
 
                                  new_kind,
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)))
 
202
                                  kind[1],
 
203
                                  content_change, 
 
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],
 
207
                                   content_change, 
 
208
                                   (executable[0] != executable[1])))
214
209
        else:
215
 
            delta.unchanged.append((path, file_id, new_kind))
 
210
            delta.unchanged.append((path, file_id, kind[1]))
216
211
 
217
212
    delta.removed.sort()
218
213
    delta.added.sort()