Search code examples
svntortoisesvnvisualsvn

validate files checking in to svn


My team members often check-in Cshasrp project files with CopyLocal option True for assembly references. I would like to prevent this.

What mechanisms available to validate files checked to svn?


Solution

  • The available mechanism is a pre-commit hook. I think most distributions of SVN come with examples of such hook scripts.

    Here's the example hook that is created by by distribution when I create a new repo:

    #!/bin/sh
    
    REPOS="$1"
    TXN="$2"
    
    # Make sure that the log message contains some text.
    SVNLOOK=/usr/local/bin/svnlook
    $SVNLOOK log -t "$TXN" "$REPOS" | \
       grep "[a-zA-Z0-9]" > /dev/null || exit 1
    
    # Check that the author of this commit has the rights to perform
    # the commit on the files and directories being modified.
    commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1
    
    # All checks passed, so allow the commit.
    exit 0