~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Robert Collins
  • Date: 2005-10-07 01:01:07 UTC
  • mfrom: (1185.13.2)
  • Revision ID: robertc@robertcollins.net-20051007010107-fe48434051a15b92
mergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
209
209
 
210
210
    for path, file_id, kind in delta.removed:
211
211
        print >>to_file, '=== removed %s %r' % (kind, path)
212
 
        if kind == 'file':
213
 
            diff_file(old_label + path,
214
 
                      old_tree.get_file(file_id).readlines(),
215
 
                      DEVNULL, 
216
 
                      [],
217
 
                      to_file)
 
212
        old_tree.inventory[file_id].diff(diff_file, old_label + path, old_tree,
 
213
                                         DEVNULL, None, None, to_file)
218
214
    for path, file_id, kind in delta.added:
219
215
        print >>to_file, '=== added %s %r' % (kind, path)
220
 
        if kind == 'file':
221
 
            diff_file(DEVNULL,
222
 
                      [],
223
 
                      new_label + path,
224
 
                      new_tree.get_file(file_id).readlines(),
225
 
                      to_file)
 
216
        new_tree.inventory[file_id].diff(diff_file, new_label + path, new_tree,
 
217
                                         DEVNULL, None, None, to_file, 
 
218
                                         reverse=True)
226
219
    for (old_path, new_path, file_id, kind,
227
220
         text_modified, meta_modified) in delta.renamed:
228
221
        prop_str = get_prop_change(meta_modified)
251
244
                                new_label, new_path, new_tree, text_modified,
252
245
                                kind, to_file, diff_file):
253
246
    if text_modified:
254
 
        if kind == 'file':
255
 
            diff_file(old_label + old_path,
256
 
                      old_tree.get_file(file_id).readlines(),
257
 
                      new_label + new_path,
258
 
                      new_tree.get_file(file_id).readlines(),
259
 
                      to_file)
260
 
        elif kind == 'symlink':
261
 
            _diff_symlink(old_tree, new_tree, file_id, to_file)
262
 
            
263
 
def _diff_symlink(old_tree, new_tree, file_id, to_file):
264
 
    t1 = old_tree.get_symlink_target(file_id)
265
 
    t2 = new_tree.get_symlink_target(file_id)
266
 
    print >>to_file, '=== target changed %r => %r' % (t1, t2)
 
247
        new_entry = new_tree.inventory[file_id]
 
248
        old_tree.inventory[file_id].diff(diff_file,
 
249
                                         old_label + old_path, old_tree,
 
250
                                         new_label + new_path, new_entry, 
 
251
                                         new_tree, to_file)