在 Tortoise SVN 中禁用 Break Lock 的 Hook 脚本
我需要对用户禁用 tortoiseSVN 中的中断锁定选项。我已经有一个 Pre-lock.BAT HOOK 可以阻止窃取锁定选项。任何人都可以向我提供一个阻止窃取锁定和打破锁定选项的脚本。请回复...
我现在拥有的 Hook 脚本是(它只阻止窃取锁定而不是破坏锁定)
@echo off
set SVN_REPOS=%1
set SVN_PATH=%2
set SVN_USER=%3
set lock_owner = ""
set lock_message = ""
REM Skip one row of output, take second token, and delimiter is " "
for /f "skip=1 tokens=2" %%U in ('svnlook lock %SVN_REPOS% %SVN_PATH%') do (
set lock_owner=%%U
goto :check_owner
)
:check_owner
if "%lock_owner%" == "" exit 0
if "%SVN_USER%" == "ADMIN" exit 0
for /f "skip=5 tokens=*" %%U in ('svnlook lock %SVN_REPOS% %SVN_PATH%') do (
set lock_message=%%U
)
@echo on
if not "%lock_message%" == "" echo Lock message: %lock_message% 1>&2
echo Sorry %SVN_USER%. Error: %SVN_PATH% locked by %lock_owner%. 1>&2
exit 1
I need to disable the break lock option in tortoiseSVN to the Users. I already have a Pre-lock.BAT HOOK that blocks the steal lock option. CAn anyone provide me a script that blocks both steal lock and break lock option. Kindly reply...
The Hook script that i have now is ( It blocks only steal lock and not break lock)
@echo off
set SVN_REPOS=%1
set SVN_PATH=%2
set SVN_USER=%3
set lock_owner = ""
set lock_message = ""
REM Skip one row of output, take second token, and delimiter is " "
for /f "skip=1 tokens=2" %%U in ('svnlook lock %SVN_REPOS% %SVN_PATH%') do (
set lock_owner=%%U
goto :check_owner
)
:check_owner
if "%lock_owner%" == "" exit 0
if "%SVN_USER%" == "ADMIN" exit 0
for /f "skip=5 tokens=*" %%U in ('svnlook lock %SVN_REPOS% %SVN_PATH%') do (
set lock_message=%%U
)
@echo on
if not "%lock_message%" == "" echo Lock message: %lock_message% 1>&2
echo Sorry %SVN_USER%. Error: %SVN_PATH% locked by %lock_owner%. 1>&2
exit 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以防万一,如果有人需要此信息,则中断锁会使用另一个钩子(预解锁)。您可以使用相同的脚本来禁用中断锁定。
干杯,
阿米尼奥
Just in case that if someone needs this information there is another hook (pre-unlock) used by the break lock. You could use the same script to disable the break lock.
Cheers,
Arminio
这是一个较短的版本,基于 ljzforever 已经发布的内容:
禁用窃取锁定(pre-lock.bat):
禁用释放锁定(pre-unlock.bat):
Here is a shorter version, based on what ljzforever already posted:
Disable steal lock (pre-lock.bat):
Disable release lock (pre-unlock.bat):