提交后SVN提交后钩子将无法运行 [英] SVN post-commit hook won't run after a commit

查看:104
本文介绍了提交后SVN提交后钩子将无法运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在服务器上设置了SVN存储库,并且存在提交后的问题.我在iMac上使用SmartSVN作为客户端.我通过SmartSVN的ssh + svn连接.我能够成功连接到SVN并对其进行更改,但是从SVN客户端提交后,提交后脚本无法正常工作.

I have an SVN repo set up on my server and am having post-commit issues. I am using SmartSVN as my client on my iMac. I connect through ssh+svn from SmartSVN. I am able to successfully connect to the SVN and make changes to it, but my post-commit script is not working after I commit from my SVN client.

我创建了一个名为post-commit.sh的提交后的外壳脚本,并将其放在hooks目录中,认为这是使它工作所需要做的全部工作.基本上,脚本执行的操作是将SVN签出到临时工作区,然后将必要的文件上传到服务器上的开发子域中.我这样做是为了为用户对Web应用程序所做的所有更改提供一个测试环境.该文件最初看起来像这样.

I created my post-commit shell script named post-commit.sh and put it in the hooks directory thinking this was all you had to do in order to get it working. Basically what the script does is SVN checkout to a temporary workspace, then upload the necessary files to my development subdomain on my server. I do this so that I can have a testing environment for all changes that users make for my web application. The file originally looked liked this.

rm -rf /home/modionzc/tempworkspace/artistcondevspace/*
cd /home/modionzc/tempworkspace/artistcondevspace
svn checkout file:///home/modionzc/svnrepos/artistcondevrep
rm -rf /home/modionzc/public_html/devsuper/application/*
rm -rf /home/modionzc/public_html/devsuper/css/*
rm -rf /home/modionzc/public_html/devsuper/js/*
rm -rf /home/modionzc/public_html/devsuper/images/*
cp -r /home/modionzc/tempworkspace/artistcondevspace/artistcondevrep/trunk/application/* /home/modionzc/public_html/devsuper/application/
cp -r /home/modionzc/tempworkspace/artistcondevspace/artistcondevrep/trunk/css/* /home/modionzc/public_html/devsuper/css/
cp -r /home/modionzc/tempworkspace/artistcondevspace/artistcondevrep/trunk/js/* /home/modionzc/public_html/devsuper/js/
cp -r /home/modionzc/tempworkspace/artistcondevspace/artistcondevrep/trunk/images/* /home/modionzc/public_html/devsuper/images/
cp /home/modionzc/artistconconfig/appconfigfiles/config.php /home/modionzc/public_html/devsuper/application/config/config.php
cp /home/modionzc/artistconconfig/appconfigfiles/database.php /home/modionzc/public_html/devsuper/application/config/database.php
cd /home/modionzc/public_html/devsuper
chmod -R 755 *
chmod 644 $(find *.* ! -type d)

当我从命令行手动运行并更新必要的文件时,它可以正常正常运行.现在由于某种原因,无论何时我从SmartSVN提交时都不会调用它.更改是通过存储库进行的,如果我手动运行脚本,则可以看到实际上已进行了更新.我进行了一些研究,发现可能是权限问题,或者我没有使用绝对路径.我在整个脚本中使用绝对路径.该文件的权限设置为755.我唯一想到的是实际SVN用户没有权限,这些用户是在conf文件中创建的用户.我浏览了SVN手册,并通过Internet进行了修复,但收效甚微.

It runs perfectly normally when I run it manually from the command line and updates the necessary files. Now for some reason it is not being called whenever I commit from my SmartSVN. The changes are made through the repository and if I run the script manually I can see that the updates were actually made. I did some research and found out that it could be permission issues or that I'm not using absolute paths. I am using absolute paths throughout the script. The permissions to the file is set to 755. The only thing that I can think of is the actual SVN user doesn't have permission which are the users created in the conf file. I have looked through the SVN manual and over the internet for a fix without much success.

一个建议是制作一个日志文件,以查看调用脚本时引起的任何错误.因此,现在我的提交后脚本会调用另一个具有上述命令的文件,并将输出的命令行返回到名为svna.log的文件. post-commit.sh文件现在看起来像这样.

One suggestion was to to make a log file to see any errors that are caused when the script is called. So now my post-commit script calls another file that has the commands above and outputs the command line returns to a file called svna.log. The post-commit.sh file looks like this now.

cd /home/modionzc/hooktest/
/home/modionzc/hooktest/ac_post_commit.sh &> svna.log

ac_post_commit.sh具有上面的原始代码. 同样,如果我手动调用它,则所有响应都会根据需要发送到该文件,但是如果我从SmartSVN提交工作,则日志文件实际上为空.

Where ac_post_commit.sh has the original code above. Again if I call it manually all the responses go to the file as necessary, but if I commit my work from SmartSVN the log file is actually empty.

仅供参考-由于某种原因,我的post-commit.sh在其末尾有一个*,当我在hooks目录中添加文件时,其列为post-commit.sh *.

FYI - for some reason my post-commit.sh has a * at the end of it and is listed as post-commit.sh* when I ls the files in the hooks directory.

拜托,对此的任何帮助将不胜感激.

Please, any help with this would be greatly appreciated.

推荐答案

我在svn论坛上发现了一个问题,同时看着另一个人在这里发帖

I found out that the issue on the svn forums while looking at another persons post here http://www.svnforum.org/threads/40951-How-repository-hooks-works?highlight=post-commit . The problem lies with the fact that the post-commit file cannot have a .sh appended to the end of it. It needs to be named just "post-commit". This does need to have the path to the type of script that you are writing in the first line which was mentioned by Mensi above but was not the problem with the script. Thanks for your help anyway.

这篇关于提交后SVN提交后钩子将无法运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆