difftools and FileMerge.app

Jean-François Veillette jean_francois_veillette at yahoo.ca
Fri Nov 10 11:49:49 GMT 2006


FileMerge.app is a graphical OS-X application, it can be invoked from  
the command line using «opendiff fileA fileB».
With the difftools plugin installed, I tried to use « bzr diff -- 
using opendiff » but it always failed,  Looking at it, here is what I  
found out :
- « opendiff » spawn FileMerge.app and return right away.
- « difftools » remove temporary files (clean itself) right after the  
external tools invoked return (in this case opendiff).
- FileMerge.app is asked to compare files  that doesn't exist and  
complain.

This is a short term patch that will simply never remove temporary  
files created by bzr difftools.
This patch also include the changes from JAM related to an unrelated  
bug.

=== modified file '__init__.py'
--- __init__.py 2006-08-23 11:06:00 +0000
+++ __init__.py 2006-11-09 13:19:01 +0000
@@ -337,5 +337,6 @@
register_diff_tool(ListDiffTool('vim', diff_options='-d'))
register_diff_tool(ListDiffTool('vimdiff'))
register_diff_tool(TreeDiffTool('xxdiff', diff_options='-- 
exclude=.bzr*'))
+register_diff_tool(TreeDiffTool('opendiff'))
# The End.

=== modified file 'tempdir.py'
--- tempdir.py  2006-08-23 11:06:00 +0000
+++ tempdir.py  2006-11-09 14:29:32 +0000
@@ -6,8 +6,9 @@
from os import walk
from shutil import rmtree
+from bzrlib import osutils
from bzrlib.osutils import (pathjoin, basename, delete_any,  
make_readonly,
-                            mkdtemp, pumpfile)
+                            pumpfile)
from bzrlib.export import export
from bzrlib.errors import BzrError
@@ -20,13 +21,13 @@
    keeping the file (directory) open.
    """
-  def __init__(self, prefix='', suffix='', readonly=True):
+  def __init__(self, prefix='', suffix='', readonly=True,  
cleaned=True):
      """
      Create a temporary directory.
      """
-    self.path = mkdtemp(prefix=prefix, suffix=suffix + '_tmp')
+    self.path = osutils.mkdtemp(prefix=prefix, suffix=suffix + '_tmp')
      self.readonly = readonly
-    self.cleaned = False
+    self.cleaned = cleaned
      return

    def write_stuff(self, rev_tree, file_id_list, use_tree=False):


I'm an absolute newcomer in python programming, this is so far the  
extend of my comprehension.
But it would be nice if the registered diff tool could dictate if it  
allow the temporary files to be cleaned, that's why I added the named  
argument to the tempdir constructor object (but I still don't know  
how the registered diff tool could somehow configure this object).

- jfv





More information about the bazaar mailing list