Ubuntu 24.04
Sponsored Link

Subversion : Install2024/07/24

 

Install Subversion which is the revision control System.

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

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

ubuntu@dlp:~$
svn mkdir file:///home/ubuntu/repos/project/trunk -m "create"

Committing transaction...
Committed revision 1.
ubuntu@dlp:~$
svn mkdir file:///home/ubuntu/repos/project/branches -m "create"

Committing transaction...
Committed revision 2.
ubuntu@dlp:~$
svn mkdir file:///home/ubuntu/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/ubuntu/work] to the [trunk] directory of a new repository.
ubuntu@dlp:~$
ll ~/work

total 32
drwxrwxr-x  2 ubuntu ubuntu  4096 Jul 24 03:31 ./
drwxr-xr-x 11 ubuntu ubuntu  4096 Jul 24 03:31 ../
-rw-rw-r--  1 ubuntu ubuntu     9 Jul 23 23:53 testfile1.txt
-rw-rw-r--  1 ubuntu ubuntu    45 Jul 24 03:31 testfile2.txt
-rw-r--r--  1 ubuntu ubuntu 12813 Jul 24 03:30 testfile3.txt

ubuntu@dlp:~$
svn import /home/ubuntu/work file:///home/ubuntu/repos/project/trunk -m "initial import"

Adding         work/testfile1.txt
Adding         work/testfile2.txt
Adding         work/testfile3.txt
Committing transaction...
Committed revision 4.

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

ubuntu@dlp:~$
svn list file:///home/ubuntu/repos/project/trunk

testfile1.txt
testfile2.txt
testfile3.txt
[4] To copy files in existing repository to local working directory, do like follows.
For example, Copy files in a repository [/home/ubuntu/repos/project/trunk] to local working directory [/home/ubuntu/work2].
ubuntu@dlp:~$
mkdir ~/work2
# possible to use [co] instead of subcommand [checkout]

ubuntu@dlp:~$
svn checkout file:///home/ubuntu/repos/project/trunk /home/ubuntu/work2

A    work2/testfile1.txt
A    work2/testfile2.txt
A    work2/testfile3.txt
Checked out revision 4.

ubuntu@dlp:~$
ll ~/work2

total 36
drwxrwxr-x  3 ubuntu ubuntu  4096 Jul 24 03:33 ./
drwxr-xr-x 12 ubuntu ubuntu  4096 Jul 24 03:32 ../
drwxrwxr-x  4 ubuntu ubuntu  4096 Jul 24 03:33 .svn/
-rw-rw-r--  1 ubuntu ubuntu     9 Jul 24 03:33 testfile1.txt
-rw-rw-r--  1 ubuntu ubuntu    45 Jul 24 03:33 testfile2.txt
-rw-rw-r--  1 ubuntu ubuntu 12813 Jul 24 03:33 testfile3.txt
[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/ubuntu/work2/testfile3.txt] to repository.
ubuntu@dlp:~$
cd ./work2
# possible to use [ci] instead of subcommand [commit]

ubuntu@dlp:~/work2$
svn commit testfile3.txt -m "update testfile3.txt 2024072401"

Sending        testfile3.txt
Transmitting file data .done
Committing transaction...
Committed revision 5.

ubuntu@dlp:~/work2$
svn info testfile3.txt

Path: testfile3.txt
Name: testfile3.txt
Working Copy Root Path: /home/ubuntu/work2
URL: file:///home/ubuntu/repos/project/trunk/testfile3.txt
Relative URL: ^/trunk/testfile3.txt
Repository Root: file:///home/ubuntu/repos/project
Repository UUID: fe74c57c-0399-4f88-8e3e-54bfa9d7817f
Revision: 5
Node Kind: file
Schedule: normal
Last Changed Author: ubuntu
Last Changed Rev: 5
Last Changed Date: 2024-07-24 03:36:14 +0000 (Wed, 24 Jul 2024)
Text Last Updated: 2024-07-24 03:36:12 +0000 (Wed, 24 Jul 2024)
Checksum: ffa2ed9aac67f6aa6af60efc9e1147e6e94f4749

# if commit all files, simply run like follows

ubuntu@dlp:~/work2$
svn commit -m "update all 2024072401"

[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/ubuntu/work2/index.html] to repository.
ubuntu@dlp:~/work2$
svn add index.html

A         index.html

ubuntu@dlp:~/work2$
svn commit index.html -m "add new index.html 2024072401"

Adding         index.html
Transmitting file data .done
Committing transaction...
Committed revision 6.

ubuntu@dlp:~/work2$
svn update

ubuntu@dlp:~/work2$
svn list

index.html
testfile1.txt
testfile2.txt
testfile3.txt
[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.
ubuntu@dlp:~/work2$
svn update

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