| Main |

Command line Finder labels

Earlier today, whilst reading Omni Group’s Mac OS X dev list, I saw someone remark that they didn’t like the fact that Subversion doesn’t preserve Finder labels.

Helpfully, of course, Subversion allows you to set arbitrary, versioned, properties on your files, so it’s actually pretty easy to store the Finder labels and retrieve them when you want them. Or it would be if there were any command line tools that could read and write them.

Well there are now (download the source code).

Once you have that installed, it’s just a matter of doing

svn-save-labels

to save your Finder labels as Subversion properties (a change that you can then commit to your repository), or

svn-restore-labels

to restore them after an update.

Or you can do

getlabel myfile.txt

to see the colour of a label, or

setlabel myfile.txt red

to change its colour to red.

The getlabel and setlabel programs are provided with man pages. The Subversion scripts are not, but they should be self-explanatory anyway.

Trackbacks

TrackBack URL for this entry:
http://alastairs-place.net/movabletype/mt-tb.cgi/139.

Comments

It would be nice if you could get subversion to automatically do stuff before committing and after checking out. You could then make this kind of thing automatic. It would also help for the case where you want a file encoded in UTF-16, say, but want it in the repository as UTF-8 so that it's not considered binary (although this might not be the best solution for encoding issues). Same goes for binary NIB files; you could have them stored in the repository as text but on disk in a binary format.

Indeed, some sort of client-side hook support would be handy sometimes, though it isn’t too bothersome doing checkouts, updates or commits via a script rather than using svn directly.

I should note that currently the Subversion scripts are not recursive; you could change that by adding a “-R” to the “svn ls” commands in the scripts.

We have some legacy products at Ambrosia that require resource forks, so we use a patched version of Subversion to do the encode-in-properties trick. We resorted to this approach due to the lack of pre-commit and post-checkout hooks.

Matt Slot tried to submit the patch (against Subversion 1.2.3) back to the project, but they weren't interested. You can still download it from his website. More details available in the README and Matt's mail to the subversion-dev list.

The latest version of Subversion-AppleDouble now supports Subversion 1.4.5.

Post a comment

If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thank-you for your patience.

(Your e-mail address will not be displayed or included in any pages served on this site; nor will you get any spam as a result.)

A live preview of your comment will be displayed below. It should refresh automatically when you stop typing, but if not then the “Preview” button above will update it.

Live Comment Preview