用于更新“暂存”的 Subversion 提交后挂钩版本不工作

发布于 2024-08-04 15:44:40 字数 1313 浏览 14 评论 0原文

我们有一个 Web 应用程序的暂存版本(它基本上是一个没有人工作的颠覆工作副本),位于“/apps/software”中。每个开发人员在“~/apps/software”中都有自己的工作副本。我想利用一个简单的提交后挂钩脚本在开发人员每次向存储库提交更改时更新暂存副本。

听起来很简单吧?好吧,我在这件事上用头撞砖墙的时间比我应该的要长。挂钩脚本(称为“post-commit”,位于 /svn/software/hooks,permissions=777,user:group=apache:dev)如下(暂时忽略注释掉的位):

#!/bin/sh

/usr/bin/svn update /apps/software >> /var/log/svn/software.log

# REPOS="$1"
# REV="$2"
# AUTHOR=`/usr/bin/svnlook author -r "$REV" "$REPOS"`
# LOG=`/usr/bin/svnlook log -r "$REV" "$REPOS"`
# EMAIL="[email protected]"

# echo "Commit log message as follows:-
#
# \"${LOG}\"
#
# The staging version has automatically been updated.
#
# See http://trac/projects/software/changeset/${REV} for more details." | /bin/mail -s "SVN : software : revision ${REV} committed by ${AUTHOR}" ${EMAIL}

就是这样。日志文件具有与提交后脚本相同的权限和用户:组,我什至为暂存副本提供了相同的用户:组和权限。 Apache 本身(我们使用 apache subversion 扩展)也在 apache:dev 下运行。我知道挂钩正在执行,因为上面注释掉的发送电子邮件的内容工作正常 - 只是更新命令没有。

我还可以使用以下命令执行没有环境变量的提交后挂钩脚本:

$ env - /svn/software/hooks/post-commit /svn/software <changeset>

并且它运行良好,执行“svn update”没有问题。我什至尝试删除“>>”记录文件,但这没有什么区别。

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

We have a staging version of our web application (it is basically a subversion working copy that no-one works on) that lives in '/apps/software'. Each developer has their own working copy in '~/apps/software'. I would like to utilise a simple post-commit hook script to update the staging copy every time a developer commits a change to the repository.

Sounds simple right? Well I've been banging my head against a brick wall on this for longer than I should. The hook script (called 'post-commit', located in /svn/software/hooks, permissions=777, user:group=apache:dev) is as follows (ignore the commented out bits for now):

#!/bin/sh

/usr/bin/svn update /apps/software >> /var/log/svn/software.log

# REPOS="$1"
# REV="$2"
# AUTHOR=`/usr/bin/svnlook author -r "$REV" "$REPOS"`
# LOG=`/usr/bin/svnlook log -r "$REV" "$REPOS"`
# EMAIL="[email protected]"

# echo "Commit log message as follows:-
#
# \"${LOG}\"
#
# The staging version has automatically been updated.
#
# See http://trac/projects/software/changeset/${REV} for more details." | /bin/mail -s "SVN : software : revision ${REV} committed by ${AUTHOR}" ${EMAIL}

That's it. The log file has the same permissions and user:group as the post-commit script and I have even given the staging copy the same user:group and permissions. Apache itself (we're using the apache subversion extension) is running under apache:dev as well. I know the hook is being executed, because the stuff that's commented out above sending an email works fine - it's just the update command that isn't.

I can also execute the post-commit hook script without environment variables using:

$ env - /svn/software/hooks/post-commit /svn/software <changeset>

and it runs fine, performing the 'svn update' no problems. I have even tried removing the '>>' to log file, but it doesn't make a difference.

Any help on this would be most appreciated...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乄_柒ぐ汐 2024-08-11 15:44:40

您仅将标准输出发送到此处的日志,而不是错误输出:

/usr/bin/svn update /apps/software >> /var/log/svn/software.log

请执行此操作以查看出了什么问题:

/usr/bin/svn update /apps/software >> /var/log/svn/software.log 2>&1

Your only sending standard output to the log here, not error output:

/usr/bin/svn update /apps/software >> /var/log/svn/software.log

Do this instead to see what is going wrong:

/usr/bin/svn update /apps/software >> /var/log/svn/software.log 2>&1
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文