~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Martin Pool
  • Date: 2005-07-22 19:33:37 UTC
  • Revision ID: mbp@sourcefrog.net-20050722193337-d89de1dccf315a3a
- try to avoid calling id2path from compare_trees when unnecessary

Show diffs side-by-side

added added

removed removed

Lines of Context:
389
389
 
390
390
    for file_id in old_tree:
391
391
        if file_id in new_tree:
392
 
            kind = old_inv.get_file_kind(file_id)
393
 
            assert kind == new_inv.get_file_kind(file_id)
 
392
            old_ie = old_inv[file_id]
 
393
            new_ie = new_inv[file_id]
 
394
 
 
395
            kind = old_ie.kind
 
396
            assert kind == new_ie.kind
394
397
            
395
398
            assert kind in ('file', 'directory', 'symlink', 'root_directory'), \
396
399
                   'invalid file kind %r' % kind
398
401
            if kind == 'root_directory':
399
402
                continue
400
403
            
401
 
            old_path = old_inv.id2path(file_id)
402
 
            new_path = new_inv.id2path(file_id)
403
 
 
404
 
            old_ie = old_inv[file_id]
405
 
            new_ie = new_inv[file_id]
406
 
 
407
404
            if specific_files:
408
 
                if (not is_inside_any(specific_files, old_path) 
409
 
                    and not is_inside_any(specific_files, new_path)):
 
405
                if (not is_inside_any(specific_files, old_inv.id2path(file_id)) 
 
406
                    and not is_inside_any(specific_files, new_inv.id2path(file_id))):
410
407
                    continue
411
408
 
412
409
            if kind == 'file':
424
421
            
425
422
            if (old_ie.name != new_ie.name
426
423
                or old_ie.parent_id != new_ie.parent_id):
427
 
                delta.renamed.append((old_path, new_path, file_id, kind,
 
424
                delta.renamed.append((old_inv.id2path(file_id),
 
425
                                      new_inv.id2path(file_id),
 
426
                                      file_id, kind,
428
427
                                      text_modified))
429
428
            elif text_modified:
430
 
                delta.modified.append((new_path, file_id, kind))
 
429
                delta.modified.append((new_inv.id2path(file_id), file_id, kind))
431
430
            elif want_unchanged:
432
 
                delta.unchanged.append((new_path, file_id, kind))
 
431
                delta.unchanged.append((new_inv.id2path(file_id), file_id, kind))
433
432
        else:
434
433
            kind = old_inv.get_file_kind(file_id)
435
434
            old_path = old_inv.id2path(file_id)