Shaikh Sonny Aman’s Blog

previously www.mailtoaman.com

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?

  1. create a repo
  2. Import local app to svn repo
  3. checkout in local machine
  4. checkout on clickspan in the document root(the desired location)
  5. commit in local machine.
  6. 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:

  1. start-commit — Notification of the beginning of a commit.
  2. pre-commit — Notification just prior to commit completion.
  3. post-commit — Notification of a successful commit.
  4. pre-revprop-change — Notification of a revision property change attempt.
  5. post-revprop-change — Notification of a successful revision property change.
  6. pre-lock — Notification of a path lock attempt.
  7. post-lock — Notification of a successful path lock.
  8. pre-unlock — Notification of a path unlock attempt.
  9. 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”

  1. H2
    February 29th, 2008 @ 7:05 am

    Anupom is Happy! Anupom - How about a party celebrating this? :D

  2. Junal Rahman
    February 29th, 2008 @ 11:17 am

    Anupom futse ! :D:D

  3. regulatorr
    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.

  4. Ceana
    October 24th, 2008 @ 4:03 pm

    People should read this.

Leave a Reply