subversion
■ subversionとは
バージョン管理ツールの一種です。バージョン管理とは、ファイルを世代管理します。
プログラムソースやドキュメントなどの、常に変更が加わるようなファイルの差分を保持します。
■ インストール
yumでインストール
[root@example ~]# yum install subversion
■ subversion用のアカウントの作成
user:svn,group:svnで作成します。
グループの作成
[root@example ~]# groupadd svn
■ サンプルプロジェクトのインポート
試しに、プロジェクトをsvnで管理してみます。
慣例として、trunk・branches・tagsディレクトリを作成して、それぞれをサンプルプロジェクトにインポートします。
ここからの操作はsvnユーザで行います。
リポジトリの作成
[svn@example ~]$ mkdir -p /home/svn/repos/sampleproject
[svn@example ~]$ svnadmin create /home/svn/repos/sampleprojectリポジトリにインポートするディレクトリを作成
[svn@example ~]$ mkdir -p /tmp/sampleproject/trunk
[svn@example ~]$ mkdir -p /tmp/sampleproject/branches
[svn@example ~]$ mkdir -p /tmp/sampleproject/tagsインポート
[svn@example ~]$ svn import /tmp/sampleproject file://localhost/home/svn/repos/sampleproject -m "import"インポートに使用したディレクトリを削除
[svn@example ~]$ rm -rf /tmp/sampleprojectrootで権限の変更
[root@example ~]# chmod -R 755 /home/svn/repos
■ チェックアウト/コミット
クライアントからチェックアウト/コミットをしてみます。
テストユーザの作成
[root@example ~]# useradd testuser -g svnユーザの変更
[root@example ~]# su testuserチェックアウト
[testuser@example ~]$ svn checkout file://localhost/home/svn/repos/sampleproject sampleproject
A sampleproject/trunk
A sampleproject/branches
A sampleproject/tags
リビジョン 1 をチェックアウトしました。trunkに移動
[testuser@example ~]$ cd /home/testuser/sampleproject/trunk適当なファイルを作成
[testuser@example trunk]$ vi test.html
hogeリポジトリに追加
[testuser@example trunk]$ svn add test.html
A test.htmltest.htmlを適当に編集
[testuser@example trunk]$ vi test.html
hogehoge差分の確認
[testuser@example trunk]$ svn diff test.html
Index: test.html
===================================================================
-
-
- test.html (リビジョン 0)
- test.html (リビジョン 0)
-
@@ -0,0 +1 @@
- hogehoge
コミット
[testuser@example ~]$ svn commit -m "test commit" test.html
追加しています test.html
ファイルのデータを送信しています .
リビジョン 2 をコミットしました。
※ 2009/06/07更新