views:

379

answers:

3

At my place of work we've started to introduce proper SVN hooks, "proper" meaning "doing a lot of policy checking". Currently, our policy consists of Perl::Critic with Perl::Tidy checking enabled. However, especially the latter one takes a lot of time on commits with several to many files touched and SVN wouldn't return until the post-commit hook is done.

Is there any way I can save some time in the post-commit hook without sacrificing policy checks?

+1  A: 

If you want the commit to fail if the hook says "no", the commit has to wait for the hook to finish its check.

Besides speeding up the check, I can't see anything you can do. (Except for the old mantra: commit often. Then you won't commit so many files at once.)

sbi
+3  A: 

If you only need some report (like list of errors) then you can use Continious Intergation system run some post commit actions. This systems allow to put any action after changes in your source control system made. Here is example scenario:

  • Some one commit to SVN repository
  • After some time CC founds this change and runs the script:
    • Get latest version from SVN
    • Run checks like Perl::Critic and Perl::Tidy
  • If any check failed then
    • Create detailed error report (which is available from web)
    • Send email notification if necessary

There are many good Continious Intergation system. I like Hudson.

Ivan Nevostruev
+1  A: 

This is another place where branch-based development can be useful. Essentially you create a new branch for each task you want to do. The branch is exempt from the quality checks, but the merge to trunk or whatever is not. So your day-to-day commits are fast, and it's only slow to merge. And you can reduce the pain of that by putting together a bot to do that task for you.

retracile