Is there anybody who has clear instructions on how to add a pre-commit hook that avoids changes to tags subdirectories?
I already searched the internet quite a bit.
The listed answers are great but none did exactly what I need. I want to allow creating tags easily, but once they are created they should be fully read-only.
I also want to prevent the stupid situation where if you do this:
svn copy myrepo/trunk myrepo/tags/newrelease
All is well the first time. But the second time, if the tag already exists, you will end up with myrepo/tags/newrelease/trunk.
My pre-commit hook will look for any pre-existing SVN directory matching (repo)/tags/(tag)/ and fail if it's found:
$SVNLOOK tree -N --full-paths "$REPOS" "`$SVNLOOK changed -t "$TXN" "$REPOS" \
| sed 's/[A-Z][[:space:]]*\([^/]*\)\/tags\/\([^/]*\)\/.*/\1\/tags\/\2\//' \
| head -n 1`" \
&& echo "Tag already exists, commit rejected." >&2 \
&& exit 1