1,前言:
假设你服务器上有个开发版本的项目,这个项目是你CheckOut出来的。然后你刚好把这个项目CheckOut到你的本地目录在开发,你想提交后顺便更新服务器上的版本,这就是这篇文章的目的;
2,解决问题:
很简单,我们只要配置你的仓库下的的 post-commit 文件就可以了,下面是步骤:
1)进入到你的目录里面:
cd hooks/
看到:
post-commit.tmpl post-unlock.tmpl pre-revprop-change.tmpl
post-lock.tmpl pre-commit.tmpl pre-unlock.tmpl
post-revprop-change.tmpl pre-lock.tmpl start-commit.tmpl
2)配置一份post-commit:
mv post-commit.tmpl post-commit
看到:
post-commit post-unlock.tmpl pre-revprop-change.tmpl
post-lock.tmpl pre-commit.tmpl pre-unlock.tmpl
post-revprop-change.tmpl pre-lock.tmpl start-commit.tmpl
3)打开post-commit:
vi post-commit
看到:
# 省略 *******
REPOS="$1"
REV="$2"
TXN_NAME="$3"
"$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
4)添加如下信息:
# 省略 *******
REPOS="$1"
REV="$2"
TXN_NAME="$3"
export LANG=zh_CN.UTF-8
svn update yourserverpath --username svnname --password
svnpassword --no-auth-cache
"$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
5)给post-commit分配权限:
chmod +x post-commit
3,完成:
这样就解决问题了,试试看提交会不会更新服务器吧!