发布提交挂钩问题 [英] Post commit hook problem for

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

问题描述

我想更新由于SVN大小为20GB而更改的文件.

我的SVN存储库位于:/media/disk3/velsvn/projects
我的Checkout文件夹位于:/media/disk2/www/htdocs

My SVN Repo is located at: /media/disk3/velsvn/projects
My Checkout Folder is at: /media/disk2/www/htdocs

(参考:使用SVN后提交挂钩仅更新已提​​交的文件)

我的提交后文件如下:

#!/bin/bash
REPOS="$1"  
REV="$2"  
cd /media/disk2/www/htdocs  
svnlook dirs-changed /media/disk3/velsvn/projects | xargs /usr/bin/svn up -N

(我正在使用REPOS和REV,但是它们给出了错误,所以我删除了它们.使用REV时,它曾经说未定义REV.在使用REPOS时,它曾经说过[REPOS]/format不是文件或不会退出.)

(I was using REPOS and REV but they were giving error so I removed them. While using REV it used to say the REV is not defined. While using REPOS it used to say [REPOS]/format is not a file or does not exit.)

尝试执行此文件时出现以下错误-
已跳过"PHP/htdocs/supporter" 跳过了"PHP/htdocs/campus"

I am getting the following error when trying to execute this file -
Skipped 'PHP/htdocs/supporter' Skipped 'PHP/htdocs/campus'

在这方面,谁能帮助我.我已经花了2天的时间进行此工作,但没有找到任何解决方案.

Can anyone help me in this regard. I have wasted 2 days working on this and yet did not find any solution.

关于

尼丁

推荐答案

我可以通过更改程序来解决此问题.将其列出在这里,因为它可能会对其他人有所帮助.可能不是一个完美的解决方案,但至少可以奏效.

I could resolve the issue by changing my procedure. Listing it down here as it may help someone else. May be its not a perfect solution, but atleast it works.

POST_COMMIT

#!/bin/sh
wget http://localhost/update_svn.php

update_svn.php

<?php
$output = shell_exec('/media/disk3/velsvn/projects/hooks/svn_update_step1.sh');
echo "<pre>$output</pre>";
?>

svn_update_step1.sh

ssh -i /media/d/mykey/id_rsa velsvnuser@localhost /media/disk3/velsvn/projects/hooks/svn_update_step2.sh

svn_update_step2.sh

#!/bin/sh
cd /media/disk3/velsvn/projects/hooks
rm -f filelist
rm -f log
whoami >> log

    svnlook dirs-changed /media/disk3/velsvn/projects/  | sed "s/^..//" | awk '{ print substr( $0, 9 ) }' >> /media/disk3/velsvn/projects/hooks/filelist; sed -i -e 's#^#/media/disk2/www/htdocs#' filelist; cat /media/disk3/velsvn/projects/hooks/filelist | xargs /usr/bin/svn up -N >> /media/disk3/velsvn/projects/hooks/log

注意: 1./media/d/mykey/id_rsa是为SSH访问生成的密钥.这样可以确保系统不会等待用户提供密码以连接到SVN并执行Shell脚本. 2. POST-COMMIT文件和shell文件sh1和sh2被赋予了+ x mod,以便可以执行.

Note: 1. /media/d/mykey/id_rsa is the key which was generated for SSH access. This ensures that the system does not waits for the user to provide password to connect to SVN as well as execute shell scripts. 2. POST-COMMIT file and the shell files sh1 and sh2 were given +x mod so that they can be executed.

请随时对此帖子发表评论,并提供外观更好的解决方案.我现在所知道的是,此解决方案有效:)

Please feel free to comment on this post and provide a better looking solution. All I know right now is, this solution works :)

这篇关于发布提交挂钩问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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