Different methods of accessing subversion (svn) repository
Introduction –
There are three different methods of accessing subversion repository…
1] Local filesystem or Network filesystem accessed by client directly
2] Apache HTTP using WebDAV module
3] svnserve tunneled over an SSH (svn + ssh)
First of all I am creating base directory for svn as “/var/repos_base”
root@arun:~# mkdir /var/repos_base
root@arun:~# ls -ld /var/repos_base
drwxr-xr-x 2 root root 4096 2006-12-26 16:32 /var/repos_base
root@arun:~#
How to get help ?
root@arun:~# svnadmin help
root@arun:~# svn help
root@arun:~# svnlook help
root@arun:~# svnsync help
root@arun:~# svnversion –help
root@arun:~# svnserve –help
1] How to create svn repository ?
“svnadmin” command is used to perform adminitrative task in subversion. Like creating, taking dump, hotcopy, recovering & verifying subversion repository.
root@arun:~# svnadmin create /var/repos_base/myrepository
Here “/var/repos_base/myrepository” is the physical location of repository….
root@arun:~# ls -l /var/repos_base/myrepository/
total 28
drwxr-xr-x 2 root root 4096 2006-12-26 16:34 conf
drwxr-xr-x 2 root root 4096 2006-12-26 16:34 dav
drwxr-sr-x 5 root root 4096 2006-12-26 16:34 db
-r–r–r– 1 root root 2 2006-12-26 16:34 format
drwxr-xr-x 2 root root 4096 2006-12-26 16:34 hooks
drwxr-xr-x 2 root root 4096 2006-12-26 16:34 locks
-rw-r–r– 1 root root 229 2006-12-26 16:34 README.txt
root@arun:~#
2] How to create trunk , branches etc directories in svn repository ?
method (1) ~ Local filesystem
root@arun:~# svn mkdir file:///var/repos_base/myrepository/trunk/
Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c
Committed revision 1.
root@arun:~# svn mkdir file:///var/repos_base/myrepository/branches
Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c
Committed revision 2.
root@arun:~#
root@arun:~# svn list file:///var/repos_base/myrepository/
branches/
trunk/
root@arun:~#
method (2) ~ Apache HTTP using WebDAV module
arunsb@arun:~$ svn mkdir http://192.168.0.1/myrepository/trunk/
Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c
Authentication realm: <http://192.168.0.1:80> || Welcome to Subversion Repository ||
Password for ‘arunsb’:
Committed revision 1.
arunsb@arun:~$ svn mkdir http://192.168.0.1/myrepository/branches/
Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c
Committed revision 2.
arunsb@arun:~$ svn list http://192.168.0.1/myrepository/
branches/
trunk/
arunsb@arun:~$
method (3) ~ svnserve tunneled over an SSH (svn + ssh)
arunsb@arun:~$ svn mkdir svn://192.168.0.1/myrepository/branches/
Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c
Authentication realm: <svn://192.168.0.1:3690> ” || Welcome to Subversion Repository ||”
Password for ‘arunsb’:
Committed revision 1.
arunsb@arun:~$ svn mkdir svn://192.168.0.1/myrepository/trunk/
Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c
Committed revision 2.
arunsb@arun:~$ svn list svn://192.168.0.1/myrepository/
branches/
trunk/
arunsb@arun:~$
3] How to import un-versioned data in svn ?
root@arun:~# ls -l /root/source_code/
total 12
-rwxr-xr-x 1 root root 3 2006-12-26 20:01 arun.html
-rw-r–r– 1 root root 2119 2006-12-26 20:03 License
-rwxr-xr-x 1 root root 64 2006-12-26 20:01 my.pl
root@arun:~#
* I wanted to import this data….
method (1)
root@arun:~# svn import /root/source_code/ file:///var/repos_base/myrepository/trunk/ -m “welcome to first import”
Adding /root/source_code/my.pl
Adding /root/source_code/License
Adding /root/source_code/arun.html
Committed revision 3.
root@arun:~#
List the imported data from svn repository –
arunsb@arun:~$ svn list file:///var/repos_base/myrepository/trunk/
License
arun.html
my.pl
arunsb@arun:~$
method (2)
arunsb@arun:~$ svn import /root/source_code/ http://192.168.0.1/myrepository/trunk/ -m “welcome to first import”
Authentication realm: <http://192.168.0.1:80> || Welcome to Subversion Repository ||
Password for ‘arunsb’:
Adding /root/source_code/my.pl
Adding /root/source_code/License
Adding /root/source_code/arun.html
Committed revision 3.
arunsb@arun:~$
method (3)
arunsb@arun:~$ svn import /root/source_code/ svn://192.168.0.1/myrepository/trunk/ -m “welcome to first import”
Authentication realm: <svn://192.168.0.1:3690> ” || Welcome to Subversion Repository ||”
Password for ‘arunsb’:
Adding /root/source_code/my.pl
Adding /root/source_code/License
Adding /root/source_code/arun.html
Committed revision 3.
arunsb@arun:~$
4] How to check out the svn repository ?
method (1)
arunsb@arun:~$ svn checkout file:///var/repos_base/myrepository/trunk/ /home/arunsb/mysource_code/
A /home/arunsb/mysource_code/my.pl
A /home/arunsb/mysource_code/License
A /home/arunsb/mysource_code/arun.html
Checked out revision 3.
arunsb@arun:~$
method (2)
arunsb@arun:~$ svn checkout http://192.168.0.1/myrepository/trunk/ /home/arunsb/mysource_code/
Authentication realm: <http://192.168.0.1:80> || Welcome to Subversion Repository ||
Password for ‘arunsb’:
Checked out revision 2.
arunsb@arun:~$
method (3)
arunsb@arun:~$ svn co svn://192.168.0.1/myrepository/trunk/ /home/arunsb/mysource_code/
Authentication realm: <svn://192.168.0.1:3690> ” || Welcome to Subversion Repository ||”
Password for ‘arunsb’:
Checked out revision 2.
arunsb@arun:~$
* Now check checked out data…
arunsb@arun:~$ ls -l /home/arunsb/mysource_code/
total 12
-rwxr-xr-x 1 arunsb oinstall 3 2006-12-26 20:42 arun.html
-rw-r–r– 1 arunsb oinstall 2119 2006-12-26 20:42 License
-rwxr-xr-x 1 arunsb oinstall 64 2006-12-26 20:42 my.pl
arunsb@arun:~$
** Now go to “/home/arunsb/mysource_code/”
arunsb@arun:~/mysource_code$ cd /home/arunsb/mysource_code/
arunsb@arun:~/mysource_code$ ls
arun.html License my.pl
arunsb@arun:~/mysource_code$
* How to get information about svn repository –
arunsb@arun:~/mysource_code$ svn info
Path: .
URL: file:///var/repos_base/myrepository/trunk
Repository Root: file:///var/repos_base/myrepository
Repository UUID: 361de285-9226-493b-aed7-a95619a457c0
Revision: 3
Node Kind: directory
Schedule: normal
Last Changed Author: root
Last Changed Rev: 3
Last Changed Date: 2006-12-26 20:38:14 +0530 (Fri, 26 Dec 2006)
arunsb@arun:~/mysource_code$
4] How to commit data ?
Now create new file “new_file.php” in modify the file…
arunsb@arun:~/mysource_code$ touch new_file.php
arunsb@arun:~/mysource_code$ ls
arun.html License my.pl new_file.php
arunsb@arun:~/mysource_code$ vi new_file.php
arunsb@arun:~/mysource_code$ mkdir new_dir
arunsb@arun:~/mysource_code$ ls
arun.html License my.pl new_dir new_file.php
arunsb@arun:~/mysource_code$
* Now check the status… ‘?’ means file or directory NOT in svn repository
arunsb@arun:~/mysource_code$ svn status
? new_dir
? new_file.php
arunsb@arun:~/mysource_code$
* Now add newly created files and directories…
arunsb@arun:~/mysource_code$ svn add new_dir
A new_dir
arunsb@arun:~/mysource_code$ svn add new_file.php
A new_file.php
arunsb@arun:~/mysource_code$
* Another method to add directory is…
arunsb@arun:~/mysource_code$ svn mkdir new_dir2
A new_dir2
arunsb@arun:~/mysource_code$
* Now check the status… ‘A’ means data is modified
arunsb@arun:~/mysource_code$ svn status
A new_dir
A new_dir2
A new_file.php
arunsb@arun:~/mysource_code$
* commit modified to svn repository…
arunsb@arun:~/mysource_code$ svn commit -m “committing data”
Adding new_dir
Adding new_dir2
Adding new_file.php
Transmitting file data .
Committed revision 4.
arunsb@arun:~/mysource_code$
5] How to check svn status (working copy) –
arunsb@arun:~/mysource_code$ svn status
arunsb@arun:~/mysource_code$
arunsb@arun:~/mysource_code$ svn status
A new_dir
A new_dir2
A new_file.php
arunsb@arun:~/mysource_code$
6] How to update svn working copy –
arunsb@arun:~/mysource_code$ svn update
At revision 4.
arunsb@arun:~/mysource_code$
* update working copy to specific revision….
arunsb@arun:~/mysource_code$ svn update -r20
7] How to check svn log (working copy) –
arunsb@arun:~/mysource_code$ svn log
————————————————————————
r1 | arunsb | 2008-12-26 21:53:04 +0530 (Fri, 26 Dec 2006) | 1 line
————————————————————————
arunsb@arun:~/mysource_code$
Thank you,
Arun Bagul
2 Replies to “Different methods of accessing subversion (svn) repository”
Hi!! Please update this post..