Sunday, July 27, 2008

Quick AppleScript Attack on SVN Diff

I'm doing some PHP to drive some Flash gauges. But I've really not a lot to say about that. Instead something about another quick SVN Diff hack.

Whilst my Automator right-click context menu hack worked, the sizeable delay (if 10 seconds is sizeable) was annoying me.

Now, I know third-party tools might solve this problem more easily, I've sort of got a 'do it with things lying about on my machine' bug. However, I also don't want to spend more than 30 minutes development, which sort of discounts Obj-C, C++, C, Java, even Python, Perl, etc. (Yeah, of course you could do it in 15 minutes with these.)

So, it sounded like another approach was in order. How about a droplet - an application were you can just drop the files on to? A quick search on the great place of quick hacks - Mac OS X Hints - revealed several things that were very close and could be changed quickly. AppleScript, of course.

Anyhow, I've uploaded a text file with the AppleScript code to morestuff on Lightsoft. Load it into the Script Editor and save it as an Application. Again it relies upon being installed. So get that off morestuff (it's inside and install it as per the instructions (you don't need the Automator stuff).

Some notes:

(All time measurements are on my machine only)
  1. Launching takes about 4-5 seconds before FileMerge shows the file - although 1-2 seconds are FileMerge launching and displaying the file.
  2. When you save the application, you probably don't want "Startup Screen" as this gives a large dialogue before anything happens.
  3. If you save as "stay open" then you can drop more files onto the already launched script - this means end to end is 1-2 seconds (even with a FileMerge launch)!
  4. Keep it in the dock for ease of use and drop right onto it.
  5. For reasons I haven't figured out yet, you can't use the script again until you quit FileMerge. This is not the case if you get Terminal to run the script (see the commented out code in "perform_SVN_diff"). This also happened in the Automator version.
  6. It also supports just running the script - you get a file selection dialogue.
Have fun!


Post a Comment

<< Home

Newer›  ‹Older