标签归档:Revision control

Subversion pre-commit hooks


pre-commit内容如下

#!/bin/sh

REPOS="$1"
TXN="$2"

# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | wc -c`

if [ "$LOGMSG" -lt 5 ];
then
  echo -e "***** Comment must be at least 5 characters. *****" 1>&2
  exit 1
fi# All checks passed, so allow the commit.
exit 0

添加完成之后需要修改文件具备执行权限,否则会提示

svn: Commit blocked by pre-commit hook (exit code 255) with no output.