2008-04-09

Finder integration for restoring .svn folders






I created an Automator workflow for the shell script "svnRecover" I wrote about in an earlier post. This allows to restore the .svn folders in a Keynote/Pages or similar document that is under Subversion control. For this, you simply select More->Automator->SVN_Recover from the document's context menu (see screenshot). You can download the automator workflow here. To install it, unzip it and copy the workflow document into the folder ~/Library/Workflows/Applications/Finder in your home directory. (You do not need to install the shell script separately; it is included in the Automator workflow.)

Update 2008-09-16: I fixed a bug that could lead to the deletion of all contents of folders with extended privileges.

Kommentare:

Anonym hat gesagt…

Ow thanks, that really solved my problem! I like the script you wrote and will use it a lot! Also thanks for the workflow. You've made my night! Marcel.

Anonym hat gesagt…

Daniel, I just found out that this workflow has a serious, dangerous flaw! If you execute it on a directory with extended privileges but without any relation to subversion (e. g. ~/Downloads) IT WILL DELETE ALL OF ITS CONTENTS WITHOUT WARNING.
A friend of mine just executed it on his Desktop background to see what it does and lost everything... Ouch.
Go try it. Put something into ~/Downloads and execute SVN_Recover on ~/Downloads. I'd advise you to repair this bug as soon as possible.

Daniel A. Sadilek hat gesagt…

Thank you anonymous, I fixed the bug you described.

Dru Kepple hat gesagt…

This is very handy! Thanks for this (and it seems the steps are actually obvious in hindsight). Anyway, I liked the Automator workflow method, but it's been a few years since you released it, and things have changed in Snow Leopard. It's easy to fix; I just opened your workflow, created a new Service workflow in Automator, dragged your actions to my new workflow. Hit save, and that's it. The workflow ends up in ~/Library/Services/ now.

Also, I thought I might point out proper AppleScript ettiquette: You have the following:

on run {input, parameters}
set AppleScript's text item delimiters to ASCII character 10
display alert (input as string)
end run

You have a good reason for changing the text item delimiters, but you should never change it without changing it back. The text item delimiters value is global and might cause other AppleScripts to fail if they're relying on the default values. You should be doing this:

on run {input, parameters}
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ASCII character 10
display alert (input as string)
set AppleScript's text item delimiters to tid
end run

vero hat gesagt…

Thanks, still helpful!!!