Exception-Based Programming : A Primer | Home | Start RESTing on your laurels

Filed under Lab on April 2, 2008 by Chris LoSacco

Introducing our first Apple Dashboard widget : SVN Notifier

It's widget time in the Arc90 lab. For all of you Mac developers who are a fan of the Dashboard and use Subversion for version control, take a glance at SVN Notifier. Growl support comes along, too!

Check it out and let us know what you think.

Post a Comment Digg Del.icio.us

Trackback Pings (TrackBack URL for this entry)

http://www.arc90.com/cgi-bin/mt4/mt-tb.cgi/128.

Comments

Perfect, works like a charm and looks good.

Posted on April 2, 2008 9:56 AM by julesj

It doesn't appear to work for paths with spaces unless you put quotes around the path, which one wouldn't expect to need to do in a text box.

Posted on April 2, 2008 10:24 AM by JamesK

Aha. Good catch, thanks!

We'll make a note of this for a future release.

Posted on April 2, 2008 10:28 AM by Chris LoSacco

Awesome!

I think that in general, if I'm the only one who's made a commit since my last update, then the widget should be green. Thing is, the repository can be r200, and my working copy can be r190, and still be 100% up-to-date, because I made ten commits to subfolders of my WC. The root folder of the WC looks out of date, but isn't really. Not sure how you can work around it, but I'm sure you can figure something out.

Posted on April 2, 2008 10:34 AM by Avi Flax

BTW you should get this listed in the Apple Widget directory/library.

Posted on April 2, 2008 10:36 AM by Avi Flax

Completely agree. The widget needs to filter out self-commits.

Posted on April 2, 2008 10:36 AM by Chris LoSacco

Already submitted. :)

Posted on April 2, 2008 10:38 AM by Chris LoSacco

Love it. Feedback: widgets needs to resize with the msg. The smallest font needs a 1px punch, it's barely readable depending on your settings.

Posted on April 2, 2008 4:41 PM by Wolf

Thanks for the feedback, Wolf. A few things:

* I'm not sure resizing the widget to fit long messages makes sense. What about a tooltip that displayed the full message on hover?

* The fonts are a bit small, yes, but we wanted the widget to be very compact. Maybe playing with position will help this.

Appreciate your comments!

Posted on April 2, 2008 4:45 PM by Chris LoSacco

Really nice! I've used hooks to send email commit notifications in the past, but the growl notifications are so much better. Great idea and great implementation.

Posted on April 3, 2008 9:22 AM by Doug Burns

Thanks Doug, much appreciated!

In our first iterations, we were talking about using post-commit hooks to allow a client to register and be pushed updates, instead of having to poll. That may be a future version.

Posted on April 3, 2008 9:28 AM by Chris LoSacco

Can't get it to work at all. Even with a checked out copy of a simple, small project from Google code :( According to Little Snitch, it's not even making any attempt to do a network connection.

Bummer.

Posted on April 3, 2008 5:52 PM by John

The original machine I tried it on was running 10.4.10. I tried it on another machine running OS X 10.5 and it worked.

Posted on April 3, 2008 5:57 PM by John

Aha. I guess Leopard support is required. The widget uses AppleScript under the hood to talk to Growl; maybe something changed between 10.4 and 10.5 with AppleScript?

Posted on April 3, 2008 6:00 PM by Chris LoSacco

John -

It just occurred to me why this might be working under 10.5 and not 10.4.x -- Leopard includes the svn binary in /usr/bin, while I think that packaged installer for Mac svn support (for older OS versions) put it in /usr/local/bin.

Maybe this should auto-detect or something...

Chris

Posted on April 4, 2008 10:55 AM by Chris LoSacco

I too am still in Tiger-land and noticed that it did not work. In the meantime, the workaround is to make a symbolic link in /usr/bin to the the svn binary in /usr/local/bin. (Thanks Chris for the tip off)

$ sudo bash
Password:
$ cd /usr/bin
$ ln -s /usr/local/bin/svn svn

P.S. Thanks so much for this tool. It will be very useful.

Posted on April 5, 2008 1:14 AM by Blake Coffman

What is the poll period? Is it smart enough (like Mail.app) to not poll when there is no network connection?

Posted on May 1, 2008 9:10 PM by Timothy Reaves

The poll period is 20 seconds -- and yep, currently, it will stop polling if it doesn't receive meaningful results from the first call. If you want to try again, just show the Dashboard, and it will restart.

Thanks,

Chris

Posted on May 2, 2008 9:44 AM by Chris LoSacco

I too am in Tiger-land, and like someone else who posted earlier, I have not been able to get this to work, either--just empty fields on the widget. However, I am using version 1.0.1, and I can see that it's coded to look for the SVN binary and use it wherever it finds it. So I don't know what's going on.

I thought it might be because the "AllowNetworkAccess" key was missing from Info.plist, but there's no change even after I put that in (not a big surprise since the system call would do an end-around on that access control, I guess).

I've tried calling SVN on my working copy with --xml just like the widget does, and that works fine.

I'm using MacPorts, which puts SVN in /opt/local/bin. I don't see how that would pose a problem, though. /usr/bin/which locates it correctly.

Posted on May 3, 2008 3:34 PM by Larry Gilbert

Quick follow-up to give you extra information that may be helpful:

The version of Subversion in MacPorts right now is 1.4.6. I did an "upgrade" for it and its dependencies just to make sure I had the latest of everything; Subversion was already okay, but a few dependencies were upgraded. No change.

One more interesting thing: If I put in complete garbage for a Subversion path, I still get blank fields. Is there supposed to be some kind of error message or something in a case like that?

Posted on May 3, 2008 4:06 PM by Larry Gilbert

Larry -

Thanks very much for all of the info. On the front of the widget, the indicator in the upper right should turn red with an error. Can you hover over it and see what the tooltip error is?

I'm stumped as to why this would be failing, if (a) it's finding the svn binary correctly and (b) the svn info call is succeeding.

Could you try one more thing for me? After running svn info on your working copy, run "svn info {name of your repository}" and see what happens.

Thanks again,

Chris

Posted on May 3, 2008 4:30 PM by Chris LoSacco

(Above - that should be URL to your repository, not name of your repository.)

Posted on May 3, 2008 4:31 PM by Chris LoSacco

Chris,

You reminded me of one more detail I should have mentioned. I guessed that the little "light" in the corner must be a status indicator. But for me, it was grey, not lit up at all.

Your reply got me thinking: "How do I know for *sure* that it's finding the SVN binary?" (I only knew that "/usr/bin/which svn" worked from the bash shell.)

So I tried digging into SVN Notifier.js and hard-coding SVN_BINARY again to point to my SVN binary (/opt/local/bin/svn). And... that got it working!

So there must be something about the way MacPorts sets the PATH environment variable that only works in, say, the bash shell, but it doesn't work for things like Widgets. In other words, I guess it's more MacPorts' fault than SVN Notifier's.

Posted on May 4, 2008 8:44 PM by Larry Gilbert

I was thinking... even if there's a way to come up with a more airtight detection of the SVN binary, I think there will always be exceptions to the rule that will cause detection to fail.

So, idea: Add one more user configuration field for the path to the SVN binary. The widget could still try to auto-detect it, but the field will always be there to fill in manually as a fallback.

Posted on May 4, 2008 10:48 PM by Larry Gilbert

I have 4 SVN Notifiers on my Dashboard... and I looked in activity monitor and there were over 50 svn processes being run by DashboardClient (Hierarchically) - Is it just me or should the program WAIT for a response before launching a bundle more? I would like to see it either check less often, or at least wait for a response before launching 10 more svns....

Posted on May 5, 2008 7:33 AM by Simon Hollingshead

Post a Comment:

Exception-Based Programming : A Primer | Main | Start RESTing on your laurels