[TxMt] FileMerge revisited

Trevor Harmon trevor at vocaro.com
Fri Apr 28 01:02:50 UTC 2006


I have a follow-up to Aparajita's recent thread about adding  
FileMerge support to TextMate. I really like the idea, but as Chris  
pointed out, it shouldn't be necessary to clone the Subversion bundle  
or add special environment variables to TextMate. That's because  
Subversion isn't hard-coded to use diff; it can run any utility you  
want, as long as its arguments are diff-compatible. All you need to  
do is add a diff-cmd setting to ~/.subversion/config.

The problem, though, is that TextMate is hard-coded for diff. If you  
look at the svn_diff.rb file in the Subversion bundle, it forces svn  
to run diff instead of the user's diff-cmd. I think the best  
solution, then, is to change this file so that it's not hard-coded.  
Not only would this add support for FileMerge [1], but it would add  
support for any other diff utility, as well.

With that goal in mind, I've modified svn_diff.rb and posted my  
changes here:
http://vocaro.com/trevor/files/svn_diff.rb

To try it out, simply replace your existing svn_diff.rb with this  
one. You'll then be able to specify a custom diff utility by setting  
the diff-cmd variable in ~/.subversion/config [2]. The next time you  
run a Subversion diff command, TextMate will automatically run your  
preferred diff utility. If you comment out the diff-cmd line (or  
delete the config file entirely), TextMate will go back to using the  
standard diff utility as before.

The only functional change here is that if you specify a custom diff- 
cmd and a file has no changes, you'll see no output when doing a diff  
on it, not even a tooltip [3]. The problem here is that with the  
regular diff, no output means no changes, but with custom (graphical)  
diff utilities, usually nothing is printed to stdout, even when there  
are changes. So, the command can't simply look at stdout and know  
whether changes were detected or not.

With that caveat, I hope some of you can try this out and let me know  
what you think. I'm hoping that with the proper vetting it can be  
checked into the repo. After all, it's a pretty low-impact change. No  
new bundles, no new commands, just different behavior when specifying  
a custom diff-cmd. (If none is specified, TextMate works exactly as  
it did before.)

Trevor

[1] Unfortunately, opendiff (FileMerge's command-line launcher) is  
not diff compatible. You'll need a wrapper script like this one:  
http://vocaro.com/trevor/files/filemerge (It's buggy, though.  
Although it works great for diffs against BASE, whenever the network  
is involved, such as diffs with HEAD or PREV, it sometimes works,  
sometimes doesn't. Can anyone help?)
[2] I've posted an example config file here: http://vocaro.com/trevor/ 
files/config
[3] When no custom diff-cmd is specified, you'll get a tooltip that  
says "No differences found."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20060427/4f1b8a9c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2363 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20060427/4f1b8a9c/attachment.p7s>


More information about the textmate mailing list