~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Gary van der Merwe
  • Date: 2009-12-01 11:08:28 UTC
  • mto: This revision was merged to the branch mainline in revision 4862.
  • Revision ID: garyvdm@gmail.com-20091201110828-o6yxb3kz82v0o6vu
When launching an external diff app, don't write temporary files for a working tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    timestamp,
40
40
    views,
41
41
    )
 
42
 
 
43
from bzrlib.workingtree import WorkingTree
42
44
""")
43
45
 
44
46
from bzrlib.symbol_versioning import (
722
724
 
723
725
    def _write_file(self, file_id, tree, prefix, relpath, force_temp=False,
724
726
                    allow_write=False):
 
727
        if isinstance(tree, WorkingTree):
 
728
            return tree.abspath(tree.id2path(file_id))
 
729
        
725
730
        full_path = osutils.pathjoin(self._root, prefix, relpath)
726
731
        if not force_temp and self._try_symlink_root(tree, prefix):
727
732
            return full_path
766
771
    def diff(self, file_id, old_path, new_path, old_kind, new_kind):
767
772
        if (old_kind, new_kind) != ('file', 'file'):
768
773
            return DiffPath.CANNOT_DIFF
769
 
        self._prepare_files(file_id, old_path, new_path)
770
 
        self._execute(osutils.pathjoin('old', old_path),
771
 
                      osutils.pathjoin('new', new_path))
 
774
        (old_disk_path, new_disk_path) = self._prepare_files(
 
775
                                                file_id, old_path, new_path)
 
776
        self._execute(old_disk_path, new_disk_path)
772
777
 
773
778
    def edit_file(self, file_id):
774
779
        """Use this tool to edit a file.