我知道这个问题已经在SO上被要求回答,但答案只是为了消除钩子。我需要修复钩子而不是删除它。SVN锁定挂钩错误:预计opaquelocktoken
我们使用Win 7客户端在Windows 2012上运行VisualSVN Server。我的任务是禁用锁的窃取(我知道这不是使用SVN的最佳实践,但老板需要它)。这里是.bat文件我目前已经制定我们的预锁钩(在网络上找到):
@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set rev_path=%2
set userName=%3
:: If a lock exists and is owned by a different person, don't allow it
:: to be stolen (e.g., with 'svn lock --force ...').
FOR /F "delims=: tokens=1*" %%a IN ('svnlook lock "%repository%" "%rev_path%"') DO if %%a==Owner (set LOCK_OWNER=%%b)
:: If we get no result from svnlook, there's no lock, allow the lock to
:: happen:
if "%LOCK_OWNER%"=="" (
exit /b 0
)
:: If the person locking matches the lock's owner, allow the lock to
:: happen:
if "%LOCK_OWNER%" = " %username%" (
exit /b 0
)
:: Otherwise, we've got an owner mismatch, so return failure:
echo "Error: %rev_path% already locked by %LOCK_OWNER%." >&2
exit /b 1
我也试着写的用SharpSVN一个应用程序(我用的是创建一个职位 - 之前提交挂钩)。无论是.bat文件和我的SharpSVN脚本返回同样的错误:
Lock token URI '
C:\Program Files\VisualSVN Server>"C:\Program Files\VisualSVN
Server\bin\VisualSVNServerHooks.exe" case-insensitive
-tC:\Repositories\DIT_TEST /go-home.txt Jeremy.Coulson
C:\Program Files\VisualSVN Server>C:\SVNAdmin\SVNPreLockHook.bat
C:\Repositories\DIT_TEST /go-home.txt Jeremy.Coulson
' has bad scheme; expected 'opaquelocktoken'
If you want to break the lock, use the 'Check For Modifications' dialog or the repository browser.
下面是我们的视觉SVN服务器设置:
我在想,我必须以某种方式提供这opaquelocktoken
到钩子脚本,但我不知道如何。