[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Keeping stuff out of my repository?

From: Matthew Pounsett <matt_at_conundrum.com>
Date: Thu, 30 Oct 2008 14:33:09 -0400

On 30-Oct-2008, at 14:25 , caston first wrote:

> Thanks, Toby,
>
> But unfortunately, the Book says: "do not modify a commit
> transaction using hook scripts."

Rejecting a commit is different from modifying it. That mechanism is
commonly used to enforce anything from comment standards to code
standards.

The general method for what you want would be to write the pre-commit
hook so that it checks the list of files being committed. If it sees
anything that matches the set of "compiler cruft" have it exit with an
error. The error will propagate back up to the SVN client giving the
user clue as to why their commit failed. They can then ammend their
commit (e.g. 'revert' the 'add' commands for .o files) and then try to
commit again.

There are probably a bunch of samples online for similar things.
Here's a chunk from my standard pre-commit hook which enforces non-
empty commit messages:

REPOS="$1"
TXN="$2"
TEXT=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]"`
if [ "x${TEXT}" = "x" ]; then
        echo "Empty commit message." 1>&2
        exit 1;
fi

HTH,
    Matt

Received on 2008-10-30 19:34:11 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.