CentOS Stream 8
Sponsored Link

Subversion : Install
2021/06/18
 
Install Subversion which is the revision control System.
[1] Install Subversion.
[root@dlp ~]#
dnf module -y install subversion:1.14/common
[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-rw-r--. 1 cent cent  9 Jun 17 18:04 testfile.txt
-rw-rw-r--. 1 cent cent 13 Jun 17 18:04 testscript.py
-rw-rw-r--. 1 cent cent 10 Jun 17 18:04 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 reposityory [/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-rw-r--. 1 cent cent  9 Jun 17 18:06 testfile.txt
-rw-rw-r--. 1 cent cent 13 Jun 17 18:06 testscript.py
-rw-rw-r--. 1 cent cent 10 Jun 17 18:06 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 2021061801"

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: 12d67f24-e7fa-4f0c-ba86-211a8c63d890
Revision: 5
Node Kind: file
Schedule: normal
Last Changed Author: cent
Last Changed Rev: 5
Last Changed Date: 2021-06-17 18:08:55 -0500 (Thu, 17 Jun 2021)
Text Last Updated: 2021-06-17 18:08:33 -0500 (Thu, 17 Jun 2021)
Checksum: 863ddc2e9de62b86bca8b564adbb6e31123066f5

# if commit all files, simply run like follows

[cent@dlp ~]$
svn commit -m "update all 20210618"

[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 2021061801"

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