views:

313

answers:

2

Hi all,

I need your advice. In my application I need to get programmatically such metrics for users check-ins as lines of added/updated code for each file in check-in. This app is writed on c# and uses the Subversion as version control system. How can I do it? Offer me your ideas please...

Thanks a lot! (:

A: 

You could use a post-commit hook to automatically add it. Just parse the svnlook diff output and you're done.

Have a look at this example: http://techchorus.net/writing-php-script-send-svn-commit-changeset-email-notification

WoLpH
It souds good.. but I'm not a strongly skilled user of SVN. Can you provide some useful links as addition to your answer? thanks
w1z
I've added a link with an example of mailing the diff :)
WoLpH
+1  A: 

well "hooks" are basically programs that get triggered when a particular svn event happens. Accordingly, the post-commit hook gets triggered after every commit. If you have access to your svn repository (as an admin, not just as a user), you should go to /path/to/repo/hooks directory and see the templates of various hooks that get run. Use the post-commit.tmpl file there as a template and add whatever you want. Note that whatever program/script gets run as the hook, automatcially gets arguments like name of the repo, current revision being checked in etc. as command line arguments. See here for reference:

http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks

Then you can take the arguments and do whatever you like after every commit, including counting diff lines or what have you.

chetan