Last active
December 30, 2015 12:59
-
-
Save deckerego/7832968 to your computer and use it in GitHub Desktop.
pre-commit script for Subversion that makes committers provide a tracking ticket ID with each commit for specified root paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
REPOS="$1" | |
TXN="$2" | |
SVNLOOK=/usr/bin/svnlook | |
PROJECTS='project-two' | |
for PROJECT in $PROJECTS; do | |
$SVNLOOK dirs-changed -t "$TXN" "$REPOS" | egrep "^$PROJECT/" > /dev/null | |
if [[ $? -eq 0 ]]; then | |
MATCHED_PROJECTS="$MATCHED_PROJECTS $PROJECT" | |
fi | |
done | |
[[ -z $MATCHED_PROJECTS ]] && exit 0 | |
$SVNLOOK log -t "$TXN" "$REPOS" | grep "TICKET-" > /dev/null | |
if [[ $? -ne 0 ]]; then | |
echo "Commit requires a TICKET issue for project$MATCHED_PROJECTS">&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment