本文介绍了尝试写subversion post-commit脚本导出PHP tu一个公用文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用subversion和post-commit脚本部署一个PHP应用程序。我一直在寻找如何写入提交脚本,但是我无法让它工作。



配置:我的服务器上安装了一个svn文件夹OVC) homeX.XX / svn / test /



我的post-commit脚本应该EXPORT到 homeX.XX / dev /



使用

$ b时,我不知道如何写正确的路径
$ b

 #!/ bin / bash 
mkdir dev
chmod 777 dev
svn export svn + ssh:// XXXXX @ www.xxxx.com / homeX.XX / XXX / svn / test dev

在我的POST- COMMIT脚本。我一直在寻找答案,但没有找到任何...

解决方案

从SVN文档():

我已经被这个问题困扰了几次。基本上,编写SVN提交钩子的最简单方法虽然不是很干净,但是将所有需要的文件和目录作为绝对路径进行硬编码。



所以在这种情况下,你的脚本将如下所示:

 #!/ bin / bash 

#SVN相关变量
svnuser = XXXXX
svnhost = www.xxxx.com
svnpath = / homeX.XX / XXX / svn / test

#本地路径
exportpath = /homeX.XX/dev

#如果不存在,导出目录
如果[! -e$ exportpath]
然后
mkdir $ exportpath
fi

#这些权限非常宽松!你确定要这样吗?
chmod 777 $ exportpath

#执行SVN导出
导出svn + ssh:// $ svnuser @ $ svnhost $ svnpath $ exportpath


I am trying to deploy a PHP application using subversion and post-commit script. I've been looking for how to write post-commit script but i can't get it to work.

Configuration : I have a svn folder installed on my server (OVH) in homeX.XX/svn/test/

My post-commit script should EXPORT to homeX.XX/dev/

I don't know how to write the proper path when using

#!/bin/bash
mkdir dev
chmod 777 dev
svn export svn+ssh://XXXXX@www.xxxx.com/homeX.XX/XXX/svn/test dev

in my POST-COMMIT script. I've been looking for answers but did not find any...

解决方案

From the SVN documentation (here):

I've been stung by this problem a few times. Basically the easiest way to write SVN commit hooks, although not very clean, is to hardcode all files and directories that you need as absolute paths.

So in this case, your script would look something like:

#!/bin/bash

# SVN-related variables
svnuser=XXXXX
svnhost=www.xxxx.com
svnpath=/homeX.XX/XXX/svn/test

# Local paths
exportpath=/homeX.XX/dev

# Make export dir if it does not exist
if [ ! -e "$exportpath" ]
then
    mkdir $exportpath
fi

# These permissions are very lenient! Are you sure you want this?
chmod 777 $exportpath

# Do the SVN export
export svn+ssh://$svnuser@$svnhost$svnpath $exportpath

这篇关于尝试写subversion post-commit脚本导出PHP tu一个公用文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 23:43