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

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

I have the same problem as Simon.

Posted on June 18, 2008 10:58 AM by Mironov Anton

Nice widget. However it seem to only work with http/https-based repositories, not svn+ssh. It just says "Couldn't get information about the working copy...".

Posted on August 8, 2008 6:37 AM by Ulrik Stephansen

I was using the widget just fine until about a few days ago. I've been using the app "Versions" as my subversion client and recently it prompted me about an update to subversion. I believe that this somehow updated my repo and now my widget displays:
"Couldn't get information about the working copy. Please verify input and try again."

Hope there's a solution for this. I love the widget.

Posted on August 11, 2008 9:57 AM by Gabriel U.

Please ignore my previous post above. I figured out that "Versions" didn't update my installed subversion but it did update the version of my repo. I exported my repo again using my installed subversion and changed the preferences in "Versions" so that it uses subversion 1.4 rather than 1.5. The widget is working again.

Posted on August 11, 2008 10:15 AM by Gabriel U.

Just a heads-up that hardcoding the path to svn worked for me as well - the detection in the script doesn't seem to be working.

Posted on August 20, 2008 9:56 AM by Neil

I upgraded subversion to 1.5.2.
After the upgrade two things happened.
1. All my instances of svn notifier lost their information.
2. Stopped working

Is this a known problem?
Is there a work around?

Posted on October 4, 2008 4:00 PM by Chris Pesarchick

Chris,

This isn't something we've seen. Have you tried closing your instances and re-adding them? That may fix the problem.

Thanks,

Chris LoSacco

Posted on October 6, 2008 7:53 PM by Chris LoSacco

Thank you to the developers but I cannot quite use this. I need a tool such as this to be able to watch multiple working copies.

Posted on November 26, 2008 10:13 AM by E. Smith

E -

You are able to add multiple copies of the widget to your Dashboard to watch multiple working copies.

Hope this helps,

Chris

Posted on November 26, 2008 10:18 AM by Chris LoSacco

I just found I can create multiple instances of this widget via Dashboard's so this works fine for me. Thanks again!

Posted on November 26, 2008 10:19 AM by E. Smith

Thanks for your fast reply, Chris. Yes, I found this. Works nicely for me.

Posted on November 26, 2008 10:24 AM by E. Smith

First of all thanks for this widget. I consider it to be one of the most helpful widgets for the Dashboard.
But sadly it stopped working when I updated to SCPlugin with svn 1.5.0
Are you going to fix it?

Posted on November 27, 2008 10:01 AM by Kostia

Kostia -

Things are a bit busy with us right now, but hopefully we can get around to updating the widget to work with svn 1.5.0. There are a few other issues we'd like to fix, too.

Make sure to check back periodically to see if we've updated, or grab our RSS feed.

Thanks for the interest,

Chris

Posted on December 2, 2008 10:24 AM by Chris LoSacco

How can I enter the user name and password for my svn repository?

Thank you.

Posted on February 3, 2009 2:32 PM by yinglcs

yinglcs -

If you fire up Terminal and run an svn command on your working copy, it will ask you to authenticate and save your authentication. You should be all set after that.

Hope this helps,

Chris

Posted on February 3, 2009 11:51 PM by Chris LoSacco

Hmmm... a little web front end that calls svn in the background and parses some XML output and sends Growl notifications via AppleScript... and therefor it needs constantly 10 threads running, up to 26 threads when it actually runs SVN and 20 MB of private memory (29 MB real memory). So this tiny application needs more memory and threads than iCal, more than all my other Dashboard widgets together.

Yes, it's lovely, yes it's working like a charm, but don't expect me to applaud.

Posted on February 25, 2009 1:51 PM by Mecki

Double clicked on the SVN Notifier Widget and got the "The application Dock quit unexpectedly...EXC_BAD_ACCESS (SIGBUS)..." popup dialog.

Posted on March 24, 2009 3:40 AM by agitatedString

Is there a version of this that runs with Growl for Windows? I'd like to run this on a PC. Thanks!

Posted on May 22, 2009 2:11 PM by Eitan

I'm using the latest version of SVN via MacPorts.

"/opt/local/bin" is in my bash path, but apparently not in the Widget's path, so it can't get information about my repos, because Apple's svn is too old.

I hardcoded SVN_BINARY='/opt/local/bin/svn' in "SVN Notifier.js", and it works.

Posted on June 13, 2009 8:03 AM by Hraban

Post a Comment:

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