CentOS Stream 9
Sponsored Link

Subversion : Install2022/07/20

 
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 19 Jul 20 11:27 testfile.txt
-rw-r--r--. 1 cent cent 29 Jul 20 11:27 testscript.py
-rw-r--r--. 1 cent cent 29 Jul 20 11:28 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 19 Jul 20 11:29 testfile.txt
-rw-r--r--. 1 cent cent 29 Jul 20 11:29 testscript.py
-rw-r--r--. 1 cent cent 29 Jul 20 11:29 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 2022072001"

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: 673268bd-6223-49d0-857b-c9aabd8e3b16
Revision: 5
Node Kind: file
Schedule: normal
Last Changed Author: cent
Last Changed Rev: 5
Last Changed Date: 2022-07-20 11:31:03 +0900 (Wed, 20 Jul 2022)
Text Last Updated: 2022-07-20 11:30:39 +0900 (Wed, 20 Jul 2022)
Checksum: 3b6a2b2cb01a47d482f48934f40d6a6a8ac9a8cc

# if commit all files, simply run like follows

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

[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]$
svn add index.html

A         index.html

[cent@dlp work2]$
svn commit index.html -m "add new index.html 2022072001"

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