Hooking up svn events
Posted on | February 29, 2008 |
Anupom(my dev-met at Trippert) said that he needs a development environment where he will develop on his machine and test on the clickspan server. But, he will only commit once in his workstation, updating the “checked-out” app on clickspan each time is surely unpleasant.
So, what’s need to be done?
- create a repo
- Import local app to svn repo
- checkout in local machine
- checkout on clickspan in the document root(the desired location)
- commit in local machine.
- Implement a mechanism to auto update to the app folder in clickspan after each time an commit completes.
1, 2, 3 done easily. But problem raised when tried to check out on clickspan.com. Executing “svn co /var/REPO/test” exited
with the following error:
svn: Unable to open an ra_local session to URL
svn: Unable to open repository ‘file:///var/REPO/test’
svn: Unknown FS type ‘bdb’
I was totally amazed why it should look for Barkley database type ! The default is local file and I did not mentioned dbd.
After some fruitless time, I found the installed subversion is quite old when the default was bdb. So, created a repo with FS type fsfs.
Now, 4 worked fine.
5 simple, no problem.
At number 6, i used the hooking mechanism offered by the subversion system. According to the official definition “A hook is a program triggered by some repository event“. Currently there are 9 events, they are:
- start-commit — Notification of the beginning of a commit.
- pre-commit — Notification just prior to commit completion.
- post-commit — Notification of a successful commit.
- pre-revprop-change — Notification of a revision property change attempt.
- post-revprop-change — Notification of a successful revision property change.
- pre-lock — Notification of a path lock attempt.
- post-lock — Notification of a successful path lock.
- pre-unlock — Notification of a path unlock attempt.
- post-unlock — Notification of a successful path unlock.
There are 9 files with the event names having extension “.tmpl” under /path/to/repo/hooks directory.
Hence, the number 6 task became very easy by removing the extension from post-commit.tmpl and write necessary codes
in it :).
Anupom, now you just commit on your local machine and test on the server without any more hassle !!
Comments
4 Responses to “Hooking up svn events”
Leave a Reply
February 29th, 2008 @ 7:05 am
Anupom is Happy! Anupom - How about a party celebrating this?
February 29th, 2008 @ 11:17 am
Anupom futse ! :D:D
April 6th, 2008 @ 10:52 am
Looks perfectly straight to me. Of course, I’m also the type of person who allegedly [ahem! allegedly] agree with everything.
October 24th, 2008 @ 4:03 pm
People should read this.