VisualSVN 提交后挂钩与批处理文件
我在 Windows 服务器上运行 VisualSVN。
我正在尝试添加一个提交后挂钩,以便在提交发生时更新我们的暂存项目。
在 VisualSVN 中,如果我在挂钩/提交后对话框中键入命令,一切都会很好。
但是,如果我使用完全相同的命令创建批处理文件,则会收到一条错误,指出提交后挂钩失败。没有其他信息。
我的命令使用绝对路径。
我尝试将批处理文件放入 VisualSVN/bin 目录中,但出现相同的错误。
我已确保 VisualSVN 具有批处理文件所在目录的权限。
我唯一能想到的是我没有从 VisualSVN 正确调用它。我只是用批处理文件名(“c:\VisualSVN\bin\my-batch-file.bat”)替换钩子/提交后对话框中的 svn update 命令,我已经尝试过使用和不使用路径(如果没有路径,它根本找不到该文件)。
我是否需要在 SVNCommit 对话框中使用不同的语法来调用批处理文件?在批处理文件中怎么样(它只有我的 svn update 命令。如果我从命令行运行批处理文件,它就可以工作。)
最终我想使用批处理文件,因为我想在提交后做更多的事情。
I'm running VisualSVN on a Windows server.
I'm trying to add a post-commit hook to update our staging project whenever a commit happens.
In VisualSVN, if I type the command in the hook/post-commit dialog, everything works great.
However, if I make a batch file with the exact same command, I get an error that says the post-commit hook has failed. There is no additional information.
My command uses absolute paths.
I've tried putting the batch file in the VisualSVN/bin directory, I get the same error there.
I've made sure VisualSVN has permissions for the directories where the batch file is.
The only thing I can think of is I'm not calling it correctly from VisualSVN. I'm just replacing the svn update command in the hook/post-commit dialog with the batch file name ("c:\VisualSVN\bin\my-batch-file.bat") I've tried it with and without the path (without the path it doesn't find the file at all).
Do I need to use a different syntax in the SVNCommit dialog to call the batch file? What about within the batch file (It just has my svn update command. It works if I run the batch file from the command line.)
Ultimately I want to use a batch file because I want to do a few more things after the commit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 VisualSVN 时>选择存储库 >属性>挂钩>提交后挂钩。
我用于发送电子邮件然后运行脚本的代码在哪里,其中包含我想要自定义的命令
脚本文件位于 C:\ServerScripts\SVNScripts\
post-commit-wp.ps1 和我传入两个 VisualSVN 变量作为 %1 和 %2
该脚本文件是用 Windows PowerShell 编写的,
我添加了注释来解释每一行及其作用。简而言之,脚本:
这是将新提交的代码部署到网站的简单方法。
When using VisualSVN > Select the Repo > Properties > Hooks > Post-commit hook.
Where is the code I use for Sending an Email then running a script, which has commands I want to customize
The script file is located on C:\ServerScripts\SVNScripts\
post-commit-wp.ps1 and I pass in two VisualSVN variables as %1 and %2
The script file is written in Windows PowerShell
I added comments to explain each line and what it does. In a nutshell, the scripts:
Its a simple way of Deploying your newly committed code to a website.
您是否尝试使用“call”命令执行批处理文件?我是说:
Did you try to execute batch file using 'call' command? I mean:
我正在尝试同样的事情,发现你还必须在 hooks 文件夹中包含脚本..bat 文件。
I was trying the same thing and found that you also must have the script in the hooks folder.. the bat file that is.