SVN is Version controlling system and predates git, It was one of the most widely used version control system and served the community and still going on.. It had its own share advantages and shortcomings.
In this tutorial we will shed some light on practical usecases of SVN and day-to-day activities.
How to take a dump of live svn repo by loading it to another Repo on the fly.
# svnadmin dump /opt/svn/ProjectCode | svnadmin load /opt/svn/ProjectCode
SVN commands to take the dump from repo to a .dump file
# svnadmin dump /opt/svn/PST > test.dump
Using svn comands svnadmin to take the dump for specific revision number range from commandline.
# svnadmin dump -r 41:3601 /opt/svn/ProjectCode > test.dump
SVN Commands to split svn directories to respective svn repositories:
We have the folder structure of the ProjectCode and want to create a individual repository of all the folders with their own SVN repos, We can use the svndumpfilter to achieve the task.
$ cat projectslist ./project1./project2 ./project3 ./project4
$ for i in `cat projectslist`; do sudo svndumpfilter --drop-empty-revs --renumber-revs exclude `cat projectslist | grep -v $i` < SVN.dump > `echo $i | sed -e 's/\///g'`.dump; done
How to setup up a SVN repo from linux commandline.
Creating Dir for new SVN
# mkdir /opt/svn/ProjectCode
Initialize a repo in the newly created directory
#svnadmin create /opt/svn/ProjectCode
Load the repo from dump
#svnadmin load --force-uuid /opt/svn/ProjectCode < newProjectCode.dump
Loading repo from dump and redirecting output to file
#svnadmin load --force-uuid /opt/svn/ProjectCode < newProjectCode.dump >> /root/pst.out &
Linux Commands To delete a repo; Make sure the svnserve process is in stopper state and not active while removing the repo.
# rm -rf /opt/svn/PST
While taking SVN repo dump How to Exclude some paths from existing dump and create a new dump
We will be using the exclude option and passing the exclude pattern
# svndumpfilter exclude `cat ProjectCode-exclude-somerolders` < ProjectCode.dump > new-exclude.dump
Below is a sample exclude file with specific file names and directory paths
# cat ProjectCode-excludelist /path/to/code/not/required /Some/more/paths/and/specific-filenames.css /code/static/test/
How to check the logs from SVN repo from commandline
# svn log
How to setup SVN repository with configuration ?
# svnadmin create /opt/svn
Below is the example snippet from svnserve.conf
[general] anon-access = none auth-access = write password-db = /opt/svn/conf/passwd authz-db = /opt/svn/conf/authz
Here is the sample config snipet from authz
[/] svamshi = rw
How to start SVN server from linux commandline
# svnserve --listen-host ip-address/project-repo -r /opt/svn/my-projectcode/ -d
How to checkout a SVN repo from linux commandline
# svn co --username=svamshi --password=mypassword svn://ip-address/project-repo
Adding the new created files to svn and then commit to svn.
# svn add linuxcent.html
# svn commit -am "updated with linuxcent.html"
How to serve the SVN repository through Apache Httpd server.
Example [/code]/opt/svn[/code]The svn module has to be downloaded
Below is the sample configuration of virtualhost informantion