簡體   English   中英

SVN Edge的預提交掛鈎上的錯誤

[英]Errors on the Pre-commit hook of SVN Edge

美好的一天! 我目前正在研究公司現有的SVN Edge和TortoiseSVN。 我們從不使用預提交鈎子,在閱讀了所有問答之后,我決定將對提交消息的要求放到適當的位置。 首先,我將“ pre-commit.tmpl”重命名為“ pre-commit”,然后將代碼修改為以下內容,但我不斷收到以下錯誤:

錯誤1:“ / usr / bin / svnlook:未找到”(即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

第二次嘗試( http://www.wandisco.com/svnforum/forum/opensource-subversion-forums/scripts-contributions/9015-pre-commit-comment-hook-script ):

#!/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);

錯誤1:
是的, svnlook是一個文件。 任何bash程序都是一個文件,位於$PATH的目錄之一內(很抱歉,如果您聽起來已經很多余了,那聽起來就很多余了)。
最基本的“系統腳本”位於/bin ,而應用程序腳本位於/usr/bin
這意味着,如果您的svnlook安裝在其他目錄中,則可能需要查找它。
如果您正在運行Windows,則需要提供可執行文件的路徑。
錯誤2:
可能對您有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM