FreeBSD 14
Sponsored Link

Subversion : Install2024/09/13

 

Install Subversion which is the revision control System.

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

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

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

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

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

total 38
-rw-r--r--  1 freebsd freebsd   966 Sep 13 08:50 testfile1.txt
-rw-r--r--  1 freebsd freebsd 72588 Sep 13 08:49 testfile2.txt
-rw-r--r--  1 freebsd freebsd    21 Sep 13 08:50 testfile3.txt

freebsd@dlp:~ $
svn import /home/freebsd/work file:///home/freebsd/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]

freebsd@dlp:~ $
svn list file:///home/freebsd/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/freebsd/repos/project/trunk] to local working directory [/home/freebsd/work2].
freebsd@dlp:~ $
mkdir ~/work2
# possible to use [co] instead of subcommand [checkout]

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

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

freebsd@dlp:~ $
ls -la ~/work2

total 55
drwxr-xr-x  3 freebsd freebsd     6 Sep 13 08:53 .
drwxr-xr-x  6 freebsd freebsd    15 Sep 13 08:53 ..
drwxr-xr-x  4 freebsd freebsd     8 Sep 13 08:53 .svn
-rw-r--r--  1 freebsd freebsd   966 Sep 13 08:53 testfile1.txt
-rw-r--r--  1 freebsd freebsd 72588 Sep 13 08:53 testfile2.txt
-rw-r--r--  1 freebsd freebsd    21 Sep 13 08:53 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/freebsd/work2/testfile3.txt] to repository.
freebsd@dlp:~ $
cd ./work2
# possible to use [ci] instead of subcommand [commit]

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

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

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

Path: testfile3.txt
Name: testfile3.txt
Working Copy Root Path: /home/freebsd/work2
URL: file:///home/freebsd/repos/project/trunk/testfile3.txt
Relative URL: ^/trunk/testfile3.txt
Repository Root: file:///home/freebsd/repos/project
Repository UUID: d5ea888d-6171-ef11-b1e8-df8f47688296
Revision: 5
Node Kind: file
Schedule: normal
Last Changed Author: freebsd
Last Changed Rev: 5
Last Changed Date: 2024-09-13 08:56:10 +0900 (Fri, 13 Sep 2024)
Text Last Updated: 2024-09-13 08:56:05 +0900 (Fri, 13 Sep 2024)
Checksum: 6c476967d89157b1ceb0fe44dcae41d6a4efadf2

# if commit all files, simply run like follows

freebsd@dlp:~/work2 $
svn commit -m "update all 2024091301"

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

A         index.html

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

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

freebsd@dlp:~/work2 $
svn update

freebsd@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.
freebsd@dlp:~/work2 $
svn update

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