subversion

インストール手順

### リポジトリの追加 ###
root@hostname:/home/shimizu# cd /etc/apt
root@hostname:/etc/apt# vi sources.list
=====
# subvesion
deb http://opensource.wandisco.com/debian wheezy svn18
=====
root@hostname:/etc/apt# aptitude update
...
W: GPG エラー: http://opensource.wandisco.com wheezy Release: 公開鍵を利用できないため、以下の署名は検証できませんでした: NO_PUBKEY E9F0E9223BBF077A

root@hostname:/etc/apt# wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | apt-key add --
OK
root@hostname:/etc/apt# aptitude update
...

### インストール ###
root@hostname:/etc/apt# aptitude install subversion
以下の新規パッケージがインストールされます:
  libserf1{a}
以下のパッケージが削除されます:
  libneon27-gnutls{u}
以下のパッケージが更新されます:
  libsvn1 subversion
更新: 2 個、新規インストール: 1 個、削除: 1 個、保留: 2 個。
3,072 k バイトのアーカイブを取得する必要があります。展開後に 1,629 k バイトのディスク領域が新たに消費されます。
先に進みますか? [Y/n/?] y
...

root@hostname:/etc/apt# svn --version
svn, version 1.8.10 (r1615264)
   compiled Aug  8 2014, 11:33:14 on x86_64-unknown-linux-gnu

Copyright (C) 2014 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/

以下のリポジトリアクセス (RA) モジュールが利用できます:

* ra_svn : svn ネットワークプロトコルを使ってリポジトリにアクセスするモジュール。
  - Cyrus SASL 認証を併用
  - 'svn' スキームを操作します
* ra_local : ローカルディスク上のリポジトリにアクセスするモジュール。
  - 'file' スキームを操作します
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - using serf 1.3.7
  - 'http' スキームを操作します
  - 'https' スキームを操作します

リポジトリ作成とhttpで公開する

### リポジトリを作成(www-dataでアクセスすることを想定) ###
root@hostname:/var# mkdir repository
root@hostname:/var# chown -R www-data:www-data repository/
root@hostname:/var/repository# sudo -u www-data svnadmin create test
root@hostname:/var/repository# ls -al test/
合計 32
drwxr-xr-x 6 www-data www-data 4096 11月 27 02:18 .
drwxr-xr-x 3 www-data www-data 4096 11月 27 02:18 ..
-rw-r--r-- 1 www-data www-data  246 11月 27 02:18 README.txt
drwxr-xr-x 2 www-data www-data 4096 11月 27 02:18 conf
drwxr-sr-x 6 www-data www-data 4096 11月 27 02:18 db
-r--r--r-- 1 www-data www-data    2 11月 27 02:18 format
drwxr-xr-x 2 www-data www-data 4096 11月 27 02:18 hooks
drwxr-xr-x 2 www-data www-data 4096 11月 27 02:18 locks

### リポジトリにアクセスできるか確認する ###
root@hostname:/var/repository# svn info file:///var/repository/test/
パス: test
URL: file:///var/repository/test
Relative URL: ^/
リポジトリのルート: file:///var/repository/test
リポジトリ UUID: 9dbb9021-36dc-441f-96f3-0c2482fe1499
リビジョン: 0
ノード種別: ディレクトリ
最終変更リビジョン: 0
最終変更日時: 2014-11-27 02:18:00 +0900 (2014年11月27日 (木))

### apacheの設定 ###
root@hostname:/etc/apache2/mods-available# aptitude install libapache2-mod-svn libapache2-svn
以下の新規パッケージがインストールされます:
  libapache2-mod-svn{b} libapache2-svn 
更新: 0 個、新規インストール: 2 個、削除: 0 個、保留: 16 個。
393 k バイトのアーカイブを取得する必要があります。展開後に 787 k バイトのディスク領域が新たに消費されます。
以下のパッケージには満たされていない依存関係があります:
 libapache2-mod-svn : 依存: libsvn1 (= 1.8.10-1~bpo70+1) [1.8.10-1+WANdisco が既にインストール済みです]
以下のアクションでこれらの依存関係の問題は解決されます:

     以下のパッケージを現在のバージョンに一時固定する:
1)     libapache2-mod-svn [インストールされていません]



この解決方法を受け入れますか? [Y/n/q/?]n
以下のアクションでこれらの依存関係の問題は解決されます:

     以下のパッケージをインストールする:                                                  
1)     libserf-1-1 [1.3.7-1~bpo70+1 (wheezy-backports)]                                   

     以下のパッケージをダウングレードする:                                                
2)     libsvn1 [1.8.10-1+WANdisco (now, wheezy) -> 1.8.10-1~bpo70+1 (wheezy-backports)]   
3)     subversion [1.8.10-1+WANdisco (now, wheezy) -> 1.8.10-1~bpo70+1 (wheezy-backports)]



この解決方法を受け入れますか? [Y/n/q/?]y
...

root@hostname:/etc/apache2/mods-available# a2enmod authz_svn dav_svn
Considering dependency dav_svn for authz_svn:
Considering dependency dav for dav_svn:
Module dav already enabled
Module dav_svn already enabled
Enabling module authz_svn.
Considering dependency dav for dav_svn:
Module dav already enabled
Module dav_svn already enabled
To activate the new configuration, you need to run:
  service apache2 restart
root@hostname:/etc/apache2/mods-available# vi ../sites-enabled/000-default
### 以下を追記する ###
<Location /svn>
        DAV svn
        SVNParentpath "/var/repository/test/"
        SVNListParentPath On
</Location>
######################
root@hostname:/etc/apache2/mods-available# apache2ctl configtest
Syntax OK
root@hostname:/etc/apache2/mods-available# /etc/init.d/apache2 restart
[ ok ] Restarting web server: apache2 ... waiting .

閲覧することができた
Screenshot 2014-11-27 at 02.35.59

http越しの利用した操作

file:///を利用した操作

### 初回インポート ###
root@hostname:/var/www# svn import htdocs file:///var/repository/test/ -m "first import"
追加しています              htdocs/1.php
...
Committed revision 1.

root@hostname:/var/www# svn info file:///var/repository/test/
パス: test
URL: file:///var/repository/test
Relative URL: ^/
リポジトリのルート: file:///var/repository/test
リポジトリ UUID: 27f0f433-08ad-438f-bc7a-df2c5275a7eb
リビジョン: 1
ノード種別: ディレクトリ
最終変更者: root
最終変更リビジョン: 1
最終変更日時: 2014-11-27 23:17:52 +0900 (2014年11月27日 (木))

### checkout(リポジトリからソースをダウンロード) ###
root@hostname:/var/www# svn co file:///var/repository/test/
A    test/access.log
...
リビジョン 1 をチェックアウトしました。

### commit ###
root@hostname:/var/www# cd test
root@hostname:/var/www/test# touch add.file
root@hostname:/var/www/test# svn status
?       add.file
root@hostname:/var/www/test# svn add add.file 
A         add.file
root@hostname:/var/www/test# svn commit -m "first commit"
追加しています              add.file
ファイルのデータを送信しています .
Committed revision 2.
root@hostname:/var/www/test# svn update
Updating '.':
リビジョン 2 です。
root@hostname:/var/www/test# svn info
パス: .
Working Copy Root Path: /var/www/test
URL: file:///var/repository/test
Relative URL: ^/
リポジトリのルート: file:///var/repository/test
リポジトリ UUID: 27f0f433-08ad-438f-bc7a-df2c5275a7eb
リビジョン: 2
ノード種別: ディレクトリ
準備中の処理: 特になし
最終変更者: root
最終変更リビジョン: 2
最終変更日時: 2014-11-27 23:59:59 +0900 (2014年11月27日 (木))

root@hostname:/var/www/test# vi add.file
root@hostname:/var/www/test# svn commit -m "second commit"
送信しています              add.file
ファイルのデータを送信しています .
Committed revision 3.

root@hostname:/var/www/test# svn update
Updating '.':
リビジョン 3 です。
root@hostname:/var/www/test# svn info
パス: .
Working Copy Root Path: /var/www/test
URL: file:///var/repository/test
Relative URL: ^/
リポジトリのルート: file:///var/repository/test
リポジトリ UUID: 27f0f433-08ad-438f-bc7a-df2c5275a7eb
リビジョン: 3
ノード種別: ディレクトリ
準備中の処理: 特になし
最終変更者: root
最終変更リビジョン: 3
最終変更日時: 2014-11-28 00:04:39 +0900 (2014年11月28日 (金))

### 特定のファイルを取り出す ###
root@hostname:/var/www/test# svn update -r 2 add.file 
Updating 'add.file':
U    add.file
リビジョン 2 に更新しました。

参考URL

http://www.mori-soft.com/2008-08-15-01-36-37/2008-12-07-09-39-26/119-ec2-subversionredmine-25
WebSVN Admin なるものも存在する
http://www.ksknet.net/cat14/subversion.html