** Subversionのインストール - バージョン管理システム [#nf5eca3d]

#setlinebreak();

CVSの諸問題を解決すべく開発されている。
ディレクトリの移動や削除のサポート、リビジョン番号のソースツリー全体に対して採番、などCVSにはない機能がある。

SVNクライアントとしては、TortoiseSVN が有名&使いやすい。(関わったプロジェクトのほとんどで利用されていた。)
ただ、EclipseプラグインのSVNクライアントと .svn下のファイル形式が違うのか、Eclipseでチェックアウトしたソースを、
TortoiseSVNでコミットしようとして、なんかおかしな事になった記憶がある。(逆だったかも。。あんまり覚えてない。)

ここでは svnserve形式(port:3690)でも、http形式でも動作するようにインストールを行う。

 ◆Apacheのリコンパイル(davを有効にする)
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
cd httpd-2.0.52
make distclean
./configure --enable-module="so ssl dav" --enable-dav --enable-rewrite=shared --enable-ssl --with-ssl=/usr/local/ssl
make
make install
#html(</td></tr></table>)

 ◆Subversionのインストール
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tar xzf subversion-1.4.4.tar.gz
cd subversion-1.4.4
./configure --prefix=/usr/local \
&#45;-disable-mod-activation \
&#45;-enable-swig-bindings=python \
&#45;-with-apr=/usr/local/apache2/bin/apr-config \
&#45;-with-apr-util=/usr/local/apache2/bin/apu-config  \
&#45;-with-apxs=/usr/local/apache2/bin/apxs \
&#45;-without-berkeley-db \
&#45;-with-zlib \
&#45;-with-swig=/usr/local

configure: error: invalid apr version found

と怒られる。aprのバージョンが低いらしい。

わざわざ Apacheのバージョン上げるのもメンドイので、別途、必要な依存モジュールを取得してインストールを続行する。
http&#58;//subversion.tigris.org/servlets/ProjectDocumentList?folderID=7495&expandFolder=7495&folderID=260 から
依存モジュール( subversion-deps-1.4.4.tar.gz ) をダウンロード、展開して再度 configure 

./configure --prefix=/usr/local \
&#45;-disable-mod-activation \
&#45;-enable-swig-bindings=python \
&#45;-with-apr=./apr/apr-config \
&#45;-with-apr-util=./apr-util/apu-config  \
&#45;-with-apxs=/usr/local/apache2/bin/apxs \
&#45;-without-berkeley-db \
&#45;-with-zlib \
&#45;-with-swig=/usr/local
make
make install

# mod_dav_svn と mod_authz_svn がないと怒られるので、
# ソースディレクトリからコピーして再度 make install
cp ./subversion/mod_dav_svn/.libs/mod_dav_svn.so /usr/local/apache2/modules
cp ./subversion/mod_authz_svn/.libs/mod_authz_svn.so /usr/local/apache2/modules/
make install

make swig-py
make install-swig-py
/sbin/ldconfig
#html(</td></tr></table>)

 ◆SVNリポジトリの作成
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
svnadmin create --fs-type=fsfs /path/to/svn_rep
#html(</td></tr></table>)

 ◆ /etc/services に下記を追加 ( svnserveで利用する場合 )
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
svnserve        3690/tcp
svnserve        3690/udp
#html(</td></tr></table>)

 ◆ /etc/xinetd.d/svnserve を作成 ( svnserveで利用する場合 )
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
# default: off
# description: An internal xinetd service, listing active servers.

service svnserve
{
&nbsp;   disable      = no
&nbsp;   socket_type  = stream
&nbsp;   protocol     = tcp
&nbsp;   wait         = no
&nbsp;   user         = root
&nbsp;   server       = /usr/bin/svnserve
&nbsp;   server_args  = -i
}
#html(</td></tr></table>)

 ◆httpd.confに設定を追加 ( httpで利用する場合 )
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
LoadModule dav_svn_module     modules/mod_dav_svn.so
・
・
・
&#35; SVNリポジトリ用の設定 ( httpで利用する場合 )
&lt;Location /svn/myproject&gt;
&nbsp;  DAV svn
&nbsp;  SVNPath /path/to/svn_repos

&nbsp;  #Basic認証の設定
&nbsp;  AuthType Basic
&nbsp;  AuthName "Subversion repository"
&nbsp;  AuthUserFile /path/to/.htpasswd
&nbsp;  Require valid-user
&lt;/Location&gt;
#html(</td></tr></table>)

 ◆SVNユーザの作成 ( httpで利用する場合 )
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
htpasswd -c /path/to/.htpasswd ユーザ名
#html(</td></tr></table>)

 ◆Apacheの再起動 ( httpで利用する場合 )
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
/etc/init.d/httpd restart
#html(</td></tr></table>)

 ◆SVNアクセス用のURL
 svn://ホスト名/path/to/svn_repos  ※svnserveの場合
 http://ホスト名/svn/myproject     ※httpの場合


 ◆SVNの使い方
 # リポジトリ作成
 svnadmin create path_to_rep
 svn mkdir -m "make" file:///path_to_rep/trunk
 svn mkdir -m "make" file:///path_to_rep/tags
 svn mkdir -m "make" file:///path_to_rep/branches

 # 空の作業コピーを作成
 cd /path_to_parent/
 svn co file:///path_to_rep/trunk example1

 # 作業
 cd /path_to_parent/example1
 .
 .

 # SVN管理下に追加
 svn add * --force

 # addを取り消すファイルの指定
 svn revert --depth infinity public_html/tmp

 # 除外するファイル/ディレクトリの設定
 svn propset svn:ignore 'tmp' ./public_html

 # 最新をtrunkへ
 svn commit -m "1st commit"

 # タグ/ブランチの作成
 svn copy -m "copy" file:///path_to_rep/trunk file:///path_to_rep/tags/1.0.1

 # trunkから別ディレクトリにチェックアウト
 cd ../
 svn co file:///path_to_rep/trunk example2

 # 作業コピーがどのタグやブランチのものか調べる
 svn info | grep URL

 # 作業コピーのブランチを切り替える(自動でupdateされる)
 svn switch file:///path_to_rep/tags/1.0.1

 # タグが作成されたリビジョンを見つける
 cd example2
 svn log --verbose --stop-on-copy file:///path_to_rep/tags/1.0.1



トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS