开发者

Post commit hook problem for

开发者 https://www.devze.com 2023-03-24 01:18 出处:网络
I want to update the files which were changed as my SVN size is 20GB. My SVN Repo is located at:/media/disk3/velsvn/projects

I want to update the files which were changed as my SVN size is 20GB.

My SVN Repo is located at: /media/disk3/velsvn/projects

My Checkout Folder is at: /media/disk2/www/htdocs


(Reference: Using SVN post-commit hook to update only files that have been committed)

My post-commit file looks like:

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

(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.)

I am getting the following error when trying to execute this file -

Skipped 'PHP/htdocs/supporter' Skipped 'PHP/htdocs/campus'


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

Regards,

Nitin


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

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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号