문제

사람들이 파일의 잠금을 먼저 소유하지 않으면 변경 사항을 커밋하지 못하게하는 Subversion Server Hook 스크립트를 만드는 방법은 무엇입니까?

SVN 서버는 Windows에 있습니다.

감사.

추신 :이 질문에 추가 정보

Subversion (svn + tortoisesvn) 커밋 잠금 파일이 아닙니다.

도움이 되었습니까?

해결책

사전 커밋 후크를 사용하십시오. 사전 커밋 후크는 2 개의 인수를받습니다.

#   [1] REPOS-PATH   (the path to this repository)
#   [2] TXN-NAME     (the name of the txn about to be committed)

사용해야합니다 svnlook SVN : 잠금되지 않은 Need-Lock 파일이 있는지 확인합니다.

이 커밋으로 변경된 경로를 결정합니다.

svnlook changed $1 --transaction $2

파일을 통해 루프 ($PATH 루프 항목)에서 '변경'에서 SVN : Needs-Lock을 결정하고 현재 잠긴 경우 :

svnlook propget $REPOS-PATH svn:needs-lock $PATH
svnlook lock $1 $PATH

Stderr에게 작성하고 필요할 때이 커밋을 중단하기 위해 0이 아닌 사람을 쓰십시오.

다른 팁

당신이 사용할 수있는 <your repos directory>/hooks/pre-commit 그리고 배치 스크립팅 (또는 실행 가능하는 한 완전한 블로우 프로그램)을 사용하십시오. 그것이 돌아 오면 0 커밋은 성공할 것입니다. 그렇지 않으면 실패합니다.

보다 post-lock.tmpl 예를 들어 같은 디렉토리에서.

# PRE-COMMIT HOOK
#
# The pre-commit hook is invoked before a Subversion txn is
# committed.  Subversion runs this hook by invoking a program
# (script, executable, binary, etc.) named 'pre-commit' (for which
# this file is a template), with the following ordered arguments:
#
#   [1] REPOS-PATH   (the path to this repository)
#   [2] TXN-NAME     (the name of the txn about to be committed)
#
# The default working directory for the invocation is undefined, so
# the program should set one explicitly if it cares.
#
# If the hook program exits with success, the txn is committed; but
# if it exits with failure (non-zero), the txn is aborted, no commit
# takes place, and STDERR is returned to the client.   The hook
# program can use the 'svnlook' utility to help it examine the txn.
#
# On a Unix system, the normal procedure is to have 'pre-commit'
# invoke other programs to do the real work, though it may do the
# work itself too.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top