Rev 4862: (mbp, for garyvdm) run extdiff programs against the working copy when possible in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Dec 4 08:07:58 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4862 [merge]
revision-id: pqm at pqm.ubuntu.com-20091204080756-orgsvo74a1jk13rs
parent: pqm at pqm.ubuntu.com-20091204071016-eo2bjtfv36jlzl5m
parent: garyvdm at gmail.com-20091203073617-hymf9ydv4wgvebuv
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-12-04 08:07:56 +0000
message:
  (mbp, for garyvdm) run extdiff programs against the working copy when possible
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
  bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
=== modified file 'NEWS'
--- a/NEWS	2009-12-03 02:24:54 +0000
+++ b/NEWS	2009-12-04 08:07:56 +0000
@@ -57,6 +57,12 @@
   new rich-root heads. This can cut a conversion time in half (mysql from
   13.5h => 6.2h) (John Arbash Meinel, #487632)
 
+* When launching a external diff tool via bzr diff --using, temporary files
+  are no longer created, rather, the path to the file in the working tree is
+  passed to the external diff tool. This allows the file to be edited if the
+  diff tool provides for this. (Gary van der Merwe, #490738)
+  
+
 Improvements
 ************
 

=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py	2009-11-03 01:15:09 +0000
+++ b/bzrlib/diff.py	2009-12-03 07:36:17 +0000
@@ -39,6 +39,8 @@
     timestamp,
     views,
     )
+
+from bzrlib.workingtree import WorkingTree
 """)
 
 from bzrlib.symbol_versioning import (
@@ -722,6 +724,9 @@
 
     def _write_file(self, file_id, tree, prefix, relpath, force_temp=False,
                     allow_write=False):
+        if not force_temp and isinstance(tree, WorkingTree):
+            return tree.abspath(tree.id2path(file_id))
+        
         full_path = osutils.pathjoin(self._root, prefix, relpath)
         if not force_temp and self._try_symlink_root(tree, prefix):
             return full_path
@@ -766,9 +771,9 @@
     def diff(self, file_id, old_path, new_path, old_kind, new_kind):
         if (old_kind, new_kind) != ('file', 'file'):
             return DiffPath.CANNOT_DIFF
-        self._prepare_files(file_id, old_path, new_path)
-        self._execute(osutils.pathjoin('old', old_path),
-                      osutils.pathjoin('new', new_path))
+        (old_disk_path, new_disk_path) = self._prepare_files(
+                                                file_id, old_path, new_path)
+        self._execute(old_disk_path, new_disk_path)
 
     def edit_file(self, file_id):
         """Use this tool to edit a file.

=== modified file 'bzrlib/tests/test_diff.py'
--- a/bzrlib/tests/test_diff.py	2009-10-31 01:16:23 +0000
+++ b/bzrlib/tests/test_diff.py	2009-12-01 11:08:28 +0000
@@ -1378,7 +1378,7 @@
                                                      'newname')
         self.assertContainsRe(old_path, 'old/oldname$')
         self.assertEqual(0, os.stat(old_path).st_mtime)
-        self.assertContainsRe(new_path, 'new/newname$')
+        self.assertContainsRe(new_path, 'tree/newname$')
         self.assertFileEqual('oldcontent', old_path)
         self.assertFileEqual('newcontent', new_path)
         if osutils.host_os_dereferences_symlinks():




More information about the bazaar-commits mailing list