使用 Subversion 來代替 CVS

參考文獻:

http://davinci.csie.ntu.edu.tw/brent/space/Subversion
http://www.juee.com.tw/bartender/svn-present/svn-wsad.htm
http://www.juee.com.tw/bartender/svn-present/svn-share-forder.htm
http://www.zdnet.com.cn/developer/tech/story/0,2000081602,39210880,00.htm
http://svn.webdav.org/repos/projects/subwiki/trunk/INSTALL.html

相關教程:

http://freebsd.sinica.edu.tw/~plasma/svnbook/book.html
http://svnbook.red-bean.com/svnbook/book.html

多年來,併發版本系統(CVS)一直是在Linux上管理代碼或者文本的標準。作為基於RCS上建立但卻允許多用戶協作的系統而言,CVS記錄所有檔的修改資訊。這對於程式開發者、網路設計者和系統管理員而言,是非常有用的。

然而,CVS逐漸顯示出它的衰老,出現了相似的源代碼管理軟體。然而大多這種東西都是以牟利為主要目的的。

Subversion就是一種相對新鮮的源代碼管理系統。雖然事實上它還在不斷的反展之中,但是Subversion已經是一個非常穩定而且成熟的產品。它是一個全新的系統,其功能可以和CVS媲美,同時,它要比CVS更直觀,更容易操作。

你可以通過多種方法來查閱Subversion的知識庫:通過本地檔、svn協議、Apache2 WebDAV。我們建議使用Apache2WebDAV來安裝,這樣,多用戶就可以訪問並修改資料。

為了創建一個Subversion 的知識庫,使用svnadmin,如下所示:

$ svnadmin /usr/local/subversion

你可以在Subversion 中導入檔,這個操作和在CVS中的一樣,如下所示:

$ svn import -m "log msg" /home/user/import file:///usr/local/subversion

這條語句將把路徑/home/user/import下找到的檔導入到你開始創建的Subversion 知識庫中去。如果你已經在CVS中操作過,你可以從Subversion的主頁上(Subversion home page)下載一個開發腳本,叫做cvs2svn.py,然後把它導入到Subversion中,並保留它的歷史記錄。

環境Redhat linux 9.0

下載地址

http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/

[root@linux root]# cd /usr/local/src/
[root@linux src]# mkdir subversion
[root@linux src]# cd subversion
[root@linux subversion]#

wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/apr-0.9.5-0.2.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/apr-devel-0.9.5-0.2.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/apr-util-0.9.5-0.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/apr-util-devel-0.9.5-0.1.i386.rpm

wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/neon-0.24.6-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/neon-debuginfo-0.24.6-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/neon-devel-0.24.6-1.i386.rpm

wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/swig-1.3.19-1.1.i386.rpm

wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/httpd-2.0.48-3.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/httpd-devel-2.0.48-3.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/httpd-manual-2.0.48-3.i386.rpm

wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/mod_perl-1.99_09-10.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/mod_perl-devel-1.99_09-10.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/mod_python-3.0.3-3.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/mod_ssl-2.0.48-3.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-devel-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-domxml-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-imap-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-ldap-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-mysql-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-odbc-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-pgsql-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-snmp-4.3.4-1.1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/php-xmlrpc-4.3.4-1.1.i386.rpm

wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/rapidsvn-0.5.0-7013.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/rapidsvn-debuginfo-0.5.0-7013.i386.rpm

wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/wxGTK-2.4.2-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/wxGTK-debuginfo-2.4.2-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/wxGTK-devel-2.4.2-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/wxGTK-gl-2.4.2-1.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/wxGTK-static-2.4.2-1.i386.rpm


wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-debuginfo-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-devel-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-perl-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-python-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-server-1.0.3-1.rh90.i386.rpm
wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/subversion-tools-1.0.3-1.rh90.i386.rpm

wget -b http://summersoft.fay.ar.us/pub/subversion/latest/redhat-9.0/bin/cvs2svn-0.1-821.noarch.rpm

安裝RPM包:

[root@linux subversion]# rpm -Uvh apr-*
Preparing... ########################################### [100%]
1:apr ########################################### [ 25%]
2:apr-devel ########################################### [ 50%]
3:apr-util ########################################### [ 75%]
4:apr-util-devel ########################################### [100%]
[root@linux subversion]#

[root@linux subversion]# rpm -Uvh neon-*
Preparing... ########################################### [100%]
1:neon-devel ########################################### [ 33%]
2:neon ########################################### [ 67%]
3:neon-debuginfo ########################################### [100%]
[root@linux subversion]#

[root@linux subversion]# rpm -Uvh swig-1.3.19-1.1.i386.rpm
Preparing... ########################################### [100%]
warning: user david does not exist - using root

1:swig ########################################### [100%]
[root@linux subversion]#

[root@linux subversion]# rpm -e php-mysql-4.2.2-17 php-pgsql-4.2.2-17 php-odbc-4.2.2-17
[root@linux subversion]# rpm --erase mod_perl-1.99_07-5 mod_python-3.0.1-3 php-4.2.2-17 mod_auth_mysql-1.11-12 mod_auth_pgsql-0.9.12-14 php-imap-4.2.2-17 php-ldap-4.2.2-17
[root@linux subversion]# rpm -e mod_ssl-2.0.40-21
[root@linux subversion]# rpm -Uvh httpd-*
Preparing... ########################################### [100%]
1:httpd warning: /etc/httpd/conf/httpd.conf created as /etc/httpd/conf/httpd.conf.rpmnew
########################################### [ 33%]
2:httpd-devel ########################################### [ 67%]
3:httpd-manual ########################################### [100%]
[root@linux subversion]#

[root@linux subversion]# cd /etc/httpd/conf/
[root@linux conf]# ls
httpd.conf httpd.conf.rpmnew magic Makefile ssl.crl ssl.crt ssl.csr ssl.key ssl.prm
[root@linux conf]# mv httpd.conf httpd.conf.OFF
httpd.conf.OFF httpd.conf.rpmnew magic Makefile ssl.crl ssl.crt ssl.csr ssl.key ssl.prm
[root@linux conf]# cp httpd.conf.rpmnew httpd.conf
[root@linux conf]# cd -

[root@linux subversion]# rpm -Uvh mod_*
Preparing... ########################################### [100%]
1:mod_perl ########################################### [ 25%]
2:mod_perl-devel ########################################### [ 50%]
3:mod_python ########################################### [ 75%]
4:mod_ssl ########################################### [100%]
[root@linux subversion]#

[root@linux subversion]# rpm -Uvh php-*
Preparing... ########################################### [100%]
1:php ########################################### [ 10%]
2:php-devel ########################################### [ 20%]
3:php-domxml ########################################### [ 30%]
4:php-imap ########################################### [ 40%]
5:php-ldap ########################################### [ 50%]
6:php-mysql ########################################### [ 60%]
7:php-odbc ########################################### [ 70%]
8:php-pgsql ########################################### [ 80%]
9:php-snmp ########################################### [ 90%]
10:php-xmlrpc ########################################### [100%]
[root@linux subversion]#

[root@linux subversion]# rpm -Uvh wxGTK-*
Preparing... ########################################### [100%]
1:wxGTK ########################################### [ 20%]
2:wxGTK-debuginfo ########################################### [ 40%]
3:wxGTK-devel ########################################### [ 60%]
4:wxGTK-gl ########################################### [ 80%]
5:wxGTK-static ########################################### [100%]
[root@linux subversion]#

[root@linux subversion]# rpm -Uvh subversion-*
Preparing... ########################################### [100%]
1:subversion ########################################### [ 14%]
2:subversion-debuginfo ########################################### [ 29%]
3:subversion-devel ########################################### [ 43%]
4:subversion-perl ########################################### [ 57%]
5:subversion-python ########################################### [ 71%]
6:subversion-server ########################################### [ 86%]
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
7:subversion-tools ########################################### [100%]
[root@linux subversion]#

[root@linux subversion]# rpm -Uvh rapidsvn-*
Preparing... ########################################### [100%]
1:rapidsvn-debuginfo ########################################### [ 50%]
2:rapidsvn ########################################### [100%]
[root@linux subversion]#

大功告成。

測試

[root@linux subversion]# mkdir test
[root@linux subversion]# cd test/
[root@linux test]# svn checkout http://svn.webdav.org/repos/projects/subwiki/trunk subwiki
A subwiki/install-subwiki
A subwiki/plugins
A subwiki/plugins/ext
A subwiki/plugins/ext/history.py
A subwiki/plugins/ext/interwiki.py
A subwiki/plugins/std
A subwiki/plugins/std/view.py
A subwiki/plugins/std/patterns.py
A subwiki/plugins/std/macros.py
A subwiki/plugins/std/change.py
A subwiki/plugins/std/_stdutil.py
A subwiki/tests
A subwiki/tests/README
A subwiki/tests/dev
A subwiki/tests/dev/test-db.py
A subwiki/tests/dev/README
A subwiki/conf
A subwiki/conf/subwiki.conf.dist
A subwiki/conf/layouts.conf
A subwiki/LICENSE.html
A subwiki/lib
A subwiki/lib/ezt.py
A subwiki/lib/subwiki
A subwiki/lib/subwiki/wikiize.py
A subwiki/lib/subwiki/util.py
A subwiki/lib/subwiki/indexer.py
A subwiki/lib/subwiki/__init__.py
A subwiki/lib/subwiki/setup.py
A subwiki/lib/subwiki/install.conf
A subwiki/lib/subwiki/main.py
A subwiki/lib/subwiki/config.py
A subwiki/lib/subwiki/handler
A subwiki/lib/subwiki/handler/h_cgi.py
A subwiki/lib/subwiki/handler/base.py
A subwiki/lib/subwiki/handler/cmdline.py
A subwiki/lib/subwiki/handler/__init__.py
A subwiki/COMMITTERS
A subwiki/scripts
A subwiki/scripts/cmdline.py
A subwiki/scripts/make-release.sh
A subwiki/scripts/run-indexer.py
A subwiki/scripts/subwiki
A subwiki/scripts/subwiki.cgi
A subwiki/INSTALL.html
A subwiki/templates
A subwiki/templates/runtime
A subwiki/templates/runtime/footer.ezt
A subwiki/templates/runtime/history.ezt
A subwiki/templates/runtime/edit.ezt
A subwiki/templates/runtime/header.ezt
A subwiki/templates/runtime/add.ezt
A subwiki/templates/runtime/view.ezt
A subwiki/templates/on-disk
A subwiki/templates/in-repos
A subwiki/templates/in-repos/pages
Checked out revision 164.
[root@linux test]#

創建svn倉庫:

[root@linux test]# svnadmin create /home/chen/subversion
[root@linux test]# cd /home/chen/subversion

配置 subversion 伺服器

[root@linux test]# vi /home/chen/subversion/conf/svnserve.conf

[general]
anon-access = read
auth-access = write
### [users]
### USERNAME = PASSWORD
# password-db = passwd
realm = /home/chen/subverson

啟動守護進程

[root@linux test]# svnserve -d -r /home/chen/subversion

[root@linux test]# ps ax |grep svnserve
2736 ? S 0:00 svnserve -d -r /home/chen/subversion
2741 pts/1 S 0:00 grep svnserve
[root@linux test]#

Checkout 文檔

Schema 存取方法
file:///
直接存取檔案庫 (位於本地端磁碟上)
http://
經由 WebDAV 通訊協定, 連接到知曉 Subversion Apache 伺服器.
https://
http:// 相同, 但是有 SSL 加密.
svn://
經由自訂通訊協定的未授權 TCP/IP 連線, 連接到svnserve 伺服器.
svn+ssh://
經由自訂通訊協定的已認證加密 TCP/IP 連線, 連接到 svnserve 伺服器

svn://主機/目錄

[root@linux test]# svn checkout svn://localhost/

Apache WebDAV 的配置

[root@linux root]# cd /etc/httpd/conf.d/
[root@linux conf.d]#
[root@linux conf.d]# vi subversion.conf

[root@linux conf.d]# cat subversion.conf
LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so
<Location /svn/repos>
DAV svn
SVNPath /home/svnroot
#
# # Limit write permission to list of valid users.
<LimitExcept GET PROPFIND OPTIONS REPORT>
# # Require SSL connection for password protection.
# # SSLRequireSSL
#
# AuthType Basic
# AuthName "Authorization Realm"
# AuthUserFile /absolute/path/to/passwdfile
# Require valid-user
</LimitExcept>
</Location>
[root@linux conf.d]#

重新啟動Aapche

[root@linux conf.d]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@linux conf.d]#

測試

[root@linux conf.d]# cd /tmp/
[root@linux tmp]#

[root@linux httpd]# svn checkout http://192.168.0.1/svn

http://192.168.0.1/svn/

arrow
arrow
    全站熱搜

    Bluelove1968 發表在 痞客邦 留言(0) 人氣()