美好的一天!我目前正在研究我公司的現有SVN Edge和TortoiseSVN。我們從來沒有使用預先提交的鉤子,並且在讀完所有的Q後,我決定放置提交消息的需求。 首先,我將'pre-commit.tmpl'重命名爲'pre-commit',然後將代碼修改爲以下內容,但我不斷收到以下錯誤:SVN Edge預掛鉤錯誤
Error1:「/ usr/bin/svnlook:not找到「(即SVNLOOK的值)
錯誤2:」如果您想中斷鎖定,請使用'檢查修改'對話框或存儲庫瀏覽器。「
SVNLOOK的價值應該是什麼?或者我需要修改哪一行。 請幫我看看我錯過了什麼......我真的很困惑,我不是開發者。 非常感謝!
第一嘗試(SVN邊緣原始):
REPOS="$1"
TXN="$2"
# Make sure that the log message contains some text.
SVNLOOK=/opt/CollabNet_Subversion/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | \
grep "[a-zA-Z0-9]" > /dev/null || exit 1
# Check that the author of this commit has the rights to perform
# the commit on the files and directories being modified.
commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1
# All checks passed, so allow the commit.
exit 0
#!/usr/bin/perl
# config section
$minchars = 5;
$svnlook = '/usr/bin/svnlook';
#--------------------------------------------
$repos = $ARGV[0];
$txn = $ARGV[1];
$comment = `$svnlook log -t "$txn" "$repos" | grep "[A-Z][A-Z][A-Z]-*"`;
chomp($comment);
if (length($comment) == 0) {
print STDERR "Your commit has been blocked as you did not input a Product reference id. Please input an id in the form of ABC-123!";
exit(1);
}
elsif (length($comment) < $minchars) {
print STDERR "Comment must be at least $minchars characters.";
exit(1);
}
exit(0);
第三嘗試(http://www.stillnetstudios.com/require-subversion-comments-minimum/):
#!/usr/bin/perl
# config section
$minchars = 4;
$svnlook = '/usr/bin/svnlook';
#--------------------------------------------
$repos = $ARGV[0];
$txn = $ARGV[1];
$comment = `$svnlook log -t "$txn" "$repos"`;
chomp($comment);
if (length($comment) == 0) {
print STDERR "A comment is required!";
exit(1);
}
elsif (length($comment) < $minchars) {
print STDERR "Comment must be at least $minchars characters.";
exit(1);
}
exit(0);
我不知道你的svnlook可能在哪裏......你可以嘗試'find/usr | grep「svnlook」'找到路徑。 – Majora320
SVNLOOK是一個文件?那麼,我需要找到它的位置在哪裏?......謝謝Majora! – nova