Subversion and Notifo and Post-Commit
Saturday, June 19th, 2010
A service called Notifo just launched recently. They facilitate ridiculously simple push notifications. So I wanted to be notified when any of my developers checked in code, and what the message they sent was. This is useful for me because we all work remotely, and I can’t just walk over to their office to check in on them. So I wrote a couple-line post-commit hook to tell me these things. Then i figured other people would want it, so i made it prettier and put it up on github.
Pick up the script at github Notifo Post Commit Hook
You’ll need to change the NAME and APISECRET variables, and then it will work straight out of the box. You can test it without having to actually check anything in by doing cd’ing into your repo’s ‘hooks’ folder, and then run the command ‘./post-commit /path/to/your/repo <a revision number>’
Some highlights from the code:
Notifo requires that the data you send it be url-encoded (makes sense), but there is no command line utility for that, specifically. So I had to use a tiny little perl script I found on this stack overflow question that had the same url encoding from a bash script problem. I also put in handling an empty message (yes, some people suck).
Don’t forget to make sure you have curl installed. php5-curl (or equivalent apache plugin) will not do, you need to actually have the command-line tool for this to work. The other programs used i’m pretty sure come standard. Svnlook comes with a standard subversion command-line installation (which I assume you have if you’ve got a repo on there…).
Something i’d like to improve is to get the author and message in one call. However, i can’t figure out how to separate them with awk, or any other command line utility.
Notes on Notifo
I am super happy with this service. I’ve wanted to add push notifications to several of my projects for a while, but the barrier to entry with sending notifications is pretty steep. The only other comparable option is Prowl, but it’s api page is sparse, with no examples, and it’s only for iPhone (And costs $2.99). Also, they do not allow the flexibility of Notifo. With Notifo, you can send yourself a notification, you do not have to have a registered application or service. This is what allows my script to work, as well as the Chrome to Notifo link sharing extension written by Notifo co-founder Paul Stamatiou.
Email me at hello at andrebluehs dot net with any questions.
A service called Notifo just launched recently. They facilitate ridiculously simple push notifications. So I wanted to be notified when any of my developers checked in code, and what the message they sent was. This is useful for me because we all work remotely, and I can’t just walk over to their office to check in on them. So I wrote a couple-line post-commit hook to tell me these things. Then i figured other people would want it, so i made it prettier and put it up on github.
Pick up the script at github Notifo Post Commit Hook
You’ll need to change the NAME and APISECRET variables, and then it will work straight out of the box. You can test it without having to actually check anything in by doing cd’ing into your repo’s ‘hooks’ folder, and then run the command ‘./post-commit /path/to/your/repo <a revision number>’
Some highlights from the code:
Notifo requires that the data you send it be url-encoded (makes sense), but there is no command line utility for that, specifically. So I had to use a tiny little perl script I found on this stack overflow question that had the same url encoding from a bash script problem. I also put in handling an empty message (yes, some people suck).
Don’t forget to make sure you have curl installed. php5-curl (or equivalent apache plugin) will not do, you need to actually have the command-line tool for this to work. The other programs used i’m pretty sure come standard. Svnlook comes with a standard subversion command-line installation (which I assume you have if you’ve got a repo on there…).
Something i’d like to improve is to get the author and message in one call. However, i can’t figure out how to separate them with awk, or any other command line utility.
Notes on Notifo
I am super happy with this service. I’ve wanted to add push notifications to several of my projects for a while, but the barrier to entry with sending notifications is pretty steep. The only other comparable option is Prowl, but it’s api page is sparse, with no examples, and it’s only for iPhone (And costs $2.99). Also, they do not allow the flexibility of Notifo. With Notifo, you can send yourself a notification, you do not have to have a registered application or service. This is what allows my script to work, as well as the Chrome to Notifo link sharing extension written by Notifo co-founder Paul Stamatiou.
Email me at hello at andrebluehs dot net with any questions.