visualsvn pre-commit hook

I wanted to disable commits without messages. Here’s how I did it.

Right click the repo, and go to hooks. At the pre-commit hook, I added this line:

ruby script.rb %1 %2

and then the code to get the commit message was:

repo = ARGV[0]
txn = ARGV[1]
binary = "svnlook.exe"
message = `#{binary} log #{repo} -t #{txn}`

Afterwards, your tests can be made based on message.To fail a commit, simply exit with a return code different than 0.


0 Responses to “visualsvn pre-commit hook”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog Stats

  • 234,395 hits

%d bloggers like this: