Subversion : インストール2025/10/08 |
|
バージョン管理システム Subversion のインストールと設定です。 |
|
| [1] | Subversion をインストールします。 |
|
root@dlp:~# apt -y install subversion
|
| [2] | 任意の一般ユーザーでリポジトリを作成可能です。 例として [/home/debian/repos/project] を作成します。 |
|
debian@dlp:~$
mkdir -p /home/debian/repos/project debian@dlp:~$ svnadmin create /home/debian/repos/project
# [-m "***"] ⇒ 任意のロギングするメッセージを入力 debian@dlp:~$ svn mkdir file:///home/debian/repos/project/trunk -m "create" Committing transaction... Committed revision 1. debian@dlp:~$ svn mkdir file:///home/debian/repos/project/branches -m "create" Committing transaction... Committed revision 2. debian@dlp:~$ svn mkdir file:///home/debian/repos/project/tags -m "create" Committing transaction... Committed revision 3. |
| [3] | 作成したリポジトリに、すでに別のディレクトリに作成している作業ファイルをインポートする場合は、以下のように実行します。 例として [/home/debian/work] 配下にある作業ファイルを、作成したリポジトリの [trunk] へインポートします。 |
|
debian@dlp:~$ ll ~/work total 28 -rw-rw-r-- 1 debian debian 20 Oct 8 10:44 testfile1.txt -rw-r--r-- 1 debian debian 12990 Oct 8 10:44 testfile2.txt -rwx------ 1 debian debian 29 Oct 8 10:45 testscript.py -rwx------ 1 debian debian 39 Oct 8 10:45 testtool.shdebian@dlp:~$ svn import /home/debian/work file:///home/debian/repos/project/trunk -m "initial import" Adding work/testfile1.txt Adding work/testfile2.txt Adding work/testscript.py Adding work/testtool.sh Committing transaction... Committed revision 4. # 確認 # [list] サブコマンド は省略系 [ls] で代替可 debian@dlp:~$ svn list file:///home/debian/repos/project/trunk testfile1.txt testfile2.txt testscript.py testtool.sh |
| [4] | リポジトリ内にすでに存在しているファイルを、自身の作業ディレクトリにコピーする場合は、以下のように実行します。 例として、リポジトリ [/home/debian/repos/project/trunk] にあるファイルを、自身の作業ディレクトリ [/home/debian/work2] へコピーします。 |
|
debian@dlp:~$
mkdir ~/work2
# [checkout] サブコマンド は省略系 [co] で代替可 debian@dlp:~$ svn checkout file:///home/debian/repos/project/trunk /home/debian/work2 A work2/testfile1.txt A work2/testfile2.txt A work2/testscript.py A work2/testtool.sh Checked out revision 4.debian@dlp:~$ ll ~/work2 total 28 -rw-rw-r-- 1 debian debian 20 Oct 8 10:46 testfile1.txt -rw-rw-r-- 1 debian debian 12990 Oct 8 10:46 testfile2.txt -rwxrwxr-x 1 debian debian 29 Oct 8 10:46 testscript.py -rwxrwxr-x 1 debian debian 39 Oct 8 10:46 testtool.sh |
| [5] | 自身の作業ディレクトリにあるファイルを更新し、リポジトリへ更新を反映する場合は、以下のように実行します。 例として、更新した [/home/debian/work2/testtool.sh] を、リポジトリへ反映します。 |
|
debian@dlp:~$
cd ./work2
# [commit] サブコマンド は省略系 [ci] で代替可 debian@dlp:~/work2$ svn commit testtool.sh -m "update testtool.sh 2025100801" Sending testtool.sh Transmitting file data .done Committing transaction... Committed revision 5.debian@dlp:~/work2$ svn info testtool.sh Path: testtool.sh Name: testtool.sh Working Copy Root Path: /home/debian/work2 URL: file:///home/debian/repos/project/trunk/testtool.sh Relative URL: ^/trunk/testtool.sh Repository Root: file:///home/debian/repos/project Repository UUID: 6230a3e5-a1aa-4dfa-b70a-7c43764f1450 Revision: 5 Node Kind: file Schedule: normal Last Changed Author: debian Last Changed Rev: 5 Last Changed Date: 2025-10-08 10:47:45 +0900 (Wed, 08 Oct 2025) Text Last Updated: 2025-10-08 10:47:23 +0900 (Wed, 08 Oct 2025) Checksum: e63abab436c39b6d7f8be3085995c818b33c084e # ファイル単位ではなく全ファイルを [commit] する場合は以下 debian@dlp:~/work2$ svn commit -m "update all 2025100801" |
| [6] | 自身の作業ディレクトリに新規ファイルを作成し、それをリポジトリにも新規で反映する場合は、以下のように実行します。 例として、更新した [/home/debian/work2/index.html] を、リポジトリへ反映します。 |
|
debian@dlp:~/work2$ svn add index.html A index.htmldebian@dlp:~/work2$ svn commit index.html -m "add new index.html 2025100801" Adding index.html Transmitting file data .done Committing transaction... Committed revision 6.debian@dlp:~/work2$ svn update debian@dlp:~/work2$ svn list index.html testfile1.txt testfile2.txt testscript.py testtool.sh |
| [7] | 複数人でリポジトリを共有して利用している場合に、他人が更新したリポジトリ上のファイルを、自身のワーキングディレクトリにマージする場合は以下のように実行します。 |
|
debian@dlp:~/work2$ svn update Updating '.': U testfile.txt Updated to revision 12. |
| Sponsored Link |
|
|