Web Development

Subversion Hook

Subversion hooks allow you to do some interesting stuffs at specific svn events which you can not do otherwise. For example consider the followings

1. Inform all users of that repository right after any commit
2. If some one locks a file, inform the admin after a successful unlock
3. Keeping track of commits made by any user
4. Do anything after the following event occurs

Start Commit
Pre Commit
Post Commit
Pre Lock
Post Lock
Pre Unlock
Post Unlock
Pre Revision Property Change
Post Revision Property Change

So how to do it? open the hooks folder under your repository folder and find there are files identical to these events. So if you want to do something, for example, after any commit then open post-commit.tmpl file and write code inside it. Write code in python, php, perl, bash or whatever and make that file executable using “chmod” and you are done. Subversion server will take care of the rest.

About the author

Written by .

If you found this post useful you may also want to check these out:

  1. Perl binding, or vs. ||
  2. PEAR Text_Diff is now stable!
  3. File I/O in PHP
  4. Dumping Form Information Onto a Web Page
  5. Emailing Form Data with ASP
  6. Track Your Visitors, Using PHP