svn comments validation at commit

Here we are going to put validation on svn comments while doing commit. At the time of commit if logs are not given then commit will failed giving errors.

Step1: Go to folder svn_repository/hook. Copy pre-commit.tmpl to pre-commit

Step2: Now Add following line into it.

set -e

/Location/to/svn/repository/hooks/checkCommentNotEmpty.sh "$1" "$2"

Step3: Now create checkCommentNotEmpty.sh file into hook directory. Add following content into that file.

#!/bin/bash

REPOS="$1"

TXN="$2"

SVNLOOK=/usr/bin/svnlook



if [`$SVNLOOK log -t $TXN $REPOS` != ""]; then

echo "" 1>&2

echo "*** Your commit has been blocked because you did not give any log message or your log message was too short." 1>&2

echo "Please write a log message describing the purpose of your changes and then try committing again." 1>&2

exit 1

else

exit 0

fi

Step 4: now give execute permission on both file then try commit without /with giving comments.

No comments:

Post a Comment