CentOS Stream 10
Sponsored Link

Subversion : Install2025/02/21

 

Install Subversion which is the revision control System.

[1] Install Subversion.
[root@dlp ~]#
dnf -y install subversion
[2] It's possible to create a repository with any common users.
For example, create a repository under the [/home/cent/repos/project].
[cent@dlp ~]$
mkdir -p /home/cent/repos/project

[cent@dlp ~]$
svnadmin create /home/cent/repos/project
# [-m "***"] ⇒ any comments that are logged

[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] To import working files to a new empty repository, do like follows.
For example, Import files under the [/home/cent/work] to the [trunk] directory of a new repository.
[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.

# verify
# possible to use [ls] instead of subcommand [list]

[cent@dlp ~]$
svn list file:///home/cent/repos/project/trunk

testfile.txt
testscript.py
testtool.sh
[4] To copy files in existing repository to local working directory, do like follows.
For example, Copy files in a repository [/home/cent/repos/project/trunk] to local working directory [/home/cent/work2].
[cent@dlp ~]$
mkdir ~/work2
# possible to use [co] instead of subcommand [checkout]

[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] When update files in local working directory and you'd like to upload them to repository, do like follows.
For example, upload local file [/home/cent/work2/testtool.sh] to repository.
[cent@dlp ~]$
cd ./work2
# possible to use [ci] instead of subcommand [commit]

[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

# if commit all files, simply run like follows

[cent@dlp work2]$
svn commit -m "update all 20250221"

[6] When creating a new file in local working directory and upload it to repository, do like follows.
For example, upload a local new file [/home/cent/work2/index.html] to repository.
[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] If a repository is shared by some people and you'd like to merge the latest update on the repository to your local working directory, use [update] subcommand like follows.
[cent@dlp work2]$
svn update

Updating '.':
U    testfile.txt
Updated to revision 12.
Matched Content