我的post-commit挂钩永远不会触发,我认为这是因为 我需要设置一些文件系统权限。
我安装了VisualSVN-Server-2.5.2并使用Subversion插件运行eclipse。
除了VisualSVN钩子触发之外,一切都按预期工作。
这是我的post-commit.cmd文件,名称为“post-commit.cmd”
C:\PROGRA~2\VISUAL~1\bin\myScript.cmd
exit 0
更新1
当我把这样的“开始”文本时,提交窗口冻结了一个脉动进度绿色条,就像它等待钩子触发或者某些东西。我不能
取消提交操作,但我可以关闭eclipse,然后硬杀死提交窗口。
start C:\PROGRA~2\VISUAL~1\bin\post-commit.cmd
exit 0
更新2
如果将存储库保存到本地硬盘,它可以正常工作。当保存路径用于网络驱动器时它不起作用。好的,这是一个前进的步骤。浴室文件可能需要一些用户/密码
这是将存储库保存到本地硬盘的bat文件(感谢Christopher C. Simmons(CCS))
@ECHO OFF
CLS
:: =================== COPYRIGHT =========================================
:: File: svn_backup.bat
:: Author: Christopher C. Simmons (CCS)
:: Date: 05.01.2008
:: Purpose: To make backups ("hot copies") of multiple SVN repos
:: History: 0.1 Initial Release
:: Assumes: Your path contains: C:\Program Files\Subversion\bin
:: Your repodir contains only repos
:: Copyright: 2008 csimmons.net
::
:: NOTICE!!!
:: csimmons.net, LLC supplies this software AS IS and makes no guarantees
:: for your use of it. csimmons.net, LLC is not responsible for any damage
:: or pain the use of this product may cause you. Please give credit if
:: you use this or create a derivative work.
:: =================== COPYRIGHT =========================================
:: =================== CONFIG ============================================
:: Path of the dir containing your repos [Note Trailing slash]
SET repodir=F:\Repositories\
:: Path of the dir in which to create you hotcopies [Note Trailing slash]
SET repodirhot=f:\druidBACKUP\SVN\
:: Path for log file [Note Trailing slash]
SET logdir=f:\druidBACKUP\SVN\
:: Path for svnadmin [Note Trailing slash]
::SET svnpath=C:\PROGRA~2\VISUAL~1\bin\svnadmin.exe
:: User mode - 1=Interactive | 0=NonInteractive
SET imode=1
:: =================== CONFIG ============================================
:: =================== SCRIPT ============================================
:: !!! NO NEED TO EDIT BEYOND THIS POINT !!!
:: Make a date_time stamp like 030902_134200
SET hh=%time:~0,2%
:: Add a zero when this is run before 10 am.
IF "%time:~0,1%"==" " set hh=0%hh:~1,1%
SET yymmdd_hhmmss=%date:~12,2%%date:~4,2%%date:~7,2%_%hh%%time:~3,2%%time:~6,2%
:: Make a name for the log file
SET repolog=%logdir%%yymmdd_hhmmss%repobackup.log
:: Start log
ECHO START %date% %time% >> %repolog%
:: IF a hotcopy exists delete it first ELSE
:: Create directories and svn hotcopy repos to them
FOR /F %%G IN ('dir /b /ad %repodir%') DO ^
IF EXIST %repodirhot%%%G (rmdir /S /Q %repodirhot%%%G & mkdir %repodirhot%%%G >> %repolog% & ^
ECHO Starting SVN backup for %%G... >> %repolog% & ^
C:\PROGRA~2\VISUAL~1\bin\svnadmin hotcopy %repodir%%%G %repodirhot%%%G --clean-logs >> %repolog% & ^
IF %imode%== 1 ECHO FINISHED...%%G) ^
ELSE (mkdir %repodirhot%%%G >> %repolog% & ^
ECHO Starting SVN backup for %%G... >> %repolog% & ^
C:\PROGRA~2\VISUAL~1\bin\svnadmin hotcopy %repodir%%%G %repodirhot%%%G --clean-logs >> %repolog% & ^
IF %imode%== 1 ECHO FINISHED...%%G)
:: Finish log
ECHO END %date% %time% >> %repolog%
:: Display log message if interactive mode otherwise EXIT
ECHO Done... Logs available here: %repolog%
if %imode%== 1 pause
:: =================== SCRIPT ============================================
EXIT
这个想法是启动一个更大的脚本myScript.cmd女巫正在进行的热门复制 我的存储库。如果我手动启动post-commit.cmd
,这是有效的在这里阅读手册 visualsvn.com
我无法理解下面这篇文章的实际内容。
“Subversion作为拥有正在访问Subversion存储库的进程的同一用户执行挂钩。在大多数情况下,存储库是通过Subversion服务器访问的,因此该用户与服务器在其上运行的用户相同钩子本身需要配置操作系统级权限,允许该用户执行它们。此外,这意味着钩子直接或间接访问的任何程序或文件(包括Subversion存储库)都将被访问。相同的用户。换句话说,要警惕潜在的权限相关问题,这些问题可能会阻止钩子执行它设计要执行的任务。“
更新
答案 0 :(得分:4)
VisualSVN服务器服务在Network Service
帐户下运行
默认或在专用自定义帐户下(应创建
手动地)。
Subversion挂钩在VisualSVN服务器服务下执行
帐户(Network Service
或专用帐户)
如果钩子脚本在手动启动时正常工作,我建议您检查服务帐户的权限。它应该可以访问'C:\ PROGRA~2 \ VISUAL~1 \ bin \ myScript.cmd'以及所有其他涉及的文件。
请注意,在Subversion调用钩子脚本之前,它会从环境中删除所有变量 - 包括Windows上的%PATH%。因此,如果您拼出该程序的绝对名称,您的脚本只能运行另一个程序。