[root@v02-svn-online ~]# cat /svn/webtest/hooks/post-commit
REPOS="$1"
REV="$2"
SVN=/usr/bin/svn
WEB=/alidata/www/webtest
LOG=/alidata/log/svn/svn.log
export LANG=en_US.UTF-8
$SVN update $WEB --username user001 --password 123 >>$LOG
#mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf
(切忌防火墙不果没配的话,可以先关了!)
[root@v01-svn-test-server localsvn]# pwd
/alidata/www/localsvn
[root@v01-svn-test-server localsvn]# ls
default1.html default.html index.html index.php test.txt
[root@v01-svn-test-server localsvn]# svn status
? test.txt
[root@v01-svn-test-server localsvn]# cat test.txt
客服端提交代码到svn服务上
更新代码---》1
更新代码----》2
[root@v01-svn-test-server localsvn]# svn add test.txt
A test.txt
[root@v01-svn-test-server localsvn]# svn ci -m ”定时网线上发布代码“ test.txt
svn: Commit failed (details follow):
svn: Can't connect to host '192.168.1.65': No route to host(因为防火请端口没开)
[root@v01-svn-test-server localsvn]# svn ci -m ”定时网线上发布代码“ test.txt
Adding test.txt
Transmitting file data .
Committed revision 30.
[root@v02-svn-online webtest]# pwd
/alidata/www/webtest
[root@v02-svn-online webtest]# ls
default1.html default.html index.html index.php test.txt xxxzz.tar xxzz.zip
[root@v02-svn-online webtest]# cat test.txt
客服端提交代码到svn服务上
更新代码---》1
更新代码----》2
[root@v02-svn-online webtest]# 上线成功!
[root@v03-svn-client client_webtest]# echo "更新-----》3" > test.txt
[root@v03-svn-client client_webtest]# svn status
M test.txt
[root@v03-svn-client client_webtest]# cat test.txt
更新-----》3
[root@v03-svn-client client_webtest]#
[root@v03-svn-client client_webtest]# svn ci -m "echo "更新-----》3" > test.txt "
Sending test.txt
Transmitting file data .
Committed revision 47.
[root@v03-svn-client client_webtest]#
[root@v01-svn-test-server online]# svn status
[root@v01-svn-test-server online]# ls
default1.html default.html index.html index.php test.txt
[root@v01-svn-test-server online]# cat test.txt
更新-----》3
[root@v01-svn-test-server online]#
[root@v01-svn-test-server localsvn]# pwd
/alidata/www/localsvn
[root@v01-svn-test-server localsvn]# ls
default1.html default.html index.html index.php test.txt
[root@v01-svn-test-server localsvn]# svn status
M test.txt
[root@v01-svn-test-server localsvn]# cat test.txt
更新-----》3
[root@v01-svn-test-server localsvn]#
[root@v01-svn-test-server localsvn]# svn ci -m "更新-----》3 test.txt" test.txt
Sending test.txt
Transmitting file data .
Committed revision 31.
[root@v01-svn-test-server localsvn]#
[root@v02-svn-online webtest]# cat test.txt
更新-----》3
[root@v02-svn-online webtest]#
回滚代码:
[root@v01-svn-test-server localsvn]# svn diff -r 31:30
Index: test.txt
===================================================================
--- test.txt (revision 31)
+++ test.txt (revision 30)
@@ -1 +1,3 @@
-更新-----》3
+客服端提交代码到svn服务上
+更新代码---》1
+更新代码----》2
[root@v01-svn-test-server localsvn]# svn diff -r 31:30 test.txt
Index: test.txt
===================================================================
--- test.txt (revision 31)
+++ test.txt (revision 30)
@@ -1 +1,3 @@
-更新-----》3
+客服端提交代码到svn服务上
+更新代码---》1
+更新代码----》2
[root@v01-svn-test-server localsvn]# svn -r 31:30 "" test.txt
[root@v01-svn-test-server localsvn]# svn merge -r31:30 ""
svn: Cannot reverse-merge a range from a path's own future history; try updating first
[root@v01-svn-test-server localsvn]# svn up
At revision 31.
[root@v01-svn-test-server localsvn]# svn merge -r31:30 ""
--- Reverse-merging r31 into '.':
U test.txt
[root@v01-svn-test-server localsvn]# cat test.txt
客服端提交代码到svn服务上
更新代码---》1
更新代码----》2
[root@v01-svn-test-server localsvn]# svn log -v test.txt
------------------------------------------------------------------------
r31 | user001 | 2016-05-19 11:57:52 +0800 (Thu, 19 May 2016) | 1 line
Changed paths:
M /test.txt
更新-----》3 test.txt
------------------------------------------------------------------------
r30 | user001 | 2016-05-19 11:38:30 +0800 (Thu, 19 May 2016) | 1 line
Changed paths:
A /test.txt
”定时网线上发布代码“
------------------------------------------------------------------------
[root@v01-svn-test-server localsvn]#
[root@v01-svn-test-server localsvn]# svn ci -m "merge -r31:30" test.txt
Sending test.txt
Transmitting file data .
Committed revision 32.