Subversion (SVN) Tutorial Version control with Subversion & its Administration how to set it up, use it, and save your sanity how to set it up, use it, and save your sanity By Gopinath Karangula E-mail : email@example.com
Use “svn add” to mark files to include in the repository
Use “svn commit” to send the files to the repository
Modify files, “svn commit” as needed until your deliverable is complete
svn commit (don’t forget the final commit!)
SVN Administration : Trunk : Updated and major code of the project Tag : Showcase of Release versions and ready to pack Branches : Contain Total source code, which was divided and distributed to the workforce, where a source code commits happens on the branches for development and merged to test branch to bug fix, and add patches to stabilize the code ( Quality analysis), merged to release branch and deployed to production safely.
Project Repository Creation using Visual Svn server : Using Visual SVN Server : we can perform: 1. Fresh creation of Repository with default structure of the Project 2. Creation of the Project Folder with out default Project structure. 3.User management and manging the privileges on branches, trees and tags. 4. Hook scripts management – post-commit scripts for E-mail notification to the testing team Precommit hook – To block the developers with empty log message commits, using command line also we can manage the repository by installing the subversion package, but for easy administration we use this visual svn server.
SVN Repository Backup: Backs up are available of three types in svn : 1. svndump : Dumping ( taking backup of the entire repository). 2. Hotbackup : It is a kind of backup where the entire project repository can be imported in very less time compared to the restroing the repository from svn dump. 3. Incremental Backup : Taking a range of versions backup
Commands to take the Project Repository Backup: Commands : 1. Svn dump : Entire repository : 1. c:/ProgramFiles/Visualsvn/bin/svnadmin dump C:/Repository/Repo_name > [Target Folder].dump 2. Svn Hot-copy : c:/ProgramFiles/Visualsvn/bin/svnadmin hot copy C:/Repository/Repo_name [Target Folder].dump
SVN Repository Backup: 3. Incremental Backup : c:/ProgramFiles/Visualsvn/bin/svnadmin dump -r:15:30 C:/Repository/Repo_name > [Target Folder].dump Here 15 indicated the starting version and 30 indicates the end version.
SVN Repository Backup: Backs up are available of two types in svn : 1. svndump : Dumping ( taking backup of the entire repository). 2. Hot backup : It is a kind of backup where the entire project repository can be imported in very less time compared to the restoring the repository from svn dump.
SVN Repository Restore: Commands : 1. Svn load : Entire repository : 1. c:/ProgramFiles/Visualsvn/bin/svnadmin load C:/Repositories/repositoryname < repobackup.dump This command leads to restore of the entire repository. 2. The second way of restoring the hot copy backup dump file : Open the visual svn server and create a repository folder and select the import tab and browse to the location where the dump file located and press ok, the hot copy backup repository wil be restored.
Hook Scripts to manage the Project repositories : What is Hook: Hook is a group of policies for a effective management of the project repository. There are serveral Hooks scripts available in the subversion ( SVN) 1. Pre-Commit Hook ( Check the policy before the commit happen to the repository) Eg: Empty log messages can be blocked using this pre commit hook 2. Post Commit Hook ( Check the policy after the happen to the repository) Eg: Email notifications to each commit to testing team for quality analysis.
Hook Scripts : Pre Commit Hook to block the Empty Log Messages : "C:Program FilesVisualSVN Serverbinsvnlook.exe" log -t %2 %1 | FindStr [a-zA-Z0-9] IF %ERRORLEVEL% EQU 0 GOTO OK echo "Commit Comments are Required, Dear developer please give the task details in detail for this commit" >&2 exit 1 :OK exit 0
Post Commit Hook for Email Notifications to testing team : "C:Program FilesVisualSVN ServerbinVisualSVNServerHooks.exe" ^ commit-notification "%1" -r %2 ^ --from firstname.lastname@example.org --to email@example.com,firstname.lastname@example.org,email@example.com ^ --smtp-server smtpout.secureserver.net ^ --smtp-user XXXXXXX@domain.com ^ --smtp-password XXXXXXXX