良い一日!現在、会社の既存の SVN Edge と TortoiseSVN に取り組んでいます。pre-commit フックを使用することはありません。ここですべての Q&A を読んだ上で、コミット メッセージの要件を導入することにしました。まず、「pre-commit.tmpl」の名前を「pre-commit」に変更し、コードを次のように変更しましたが、常に次のエラーが発生します。
Error1:"/usr/bin/svnlook: not found" (つまり、SVNLOOK の値)
エラー 2:「ロックを解除する場合は、[変更の確認] ダイアログまたはリポジトリ ブラウザーを使用してください。」
SVNLOOK の値は何ですか? または、どの行を変更する必要がありますか。私が欠けているものを助けてください...私は本当に混乱しており、私は開発者ではありません。どうもありがとう!!!
最初の試み (SVN Edge オリジナル):
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);
3 回目の試行 ( 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);