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