SVN Setup & Configuration...

Softwares used for SVN setup

CollabNetSubversion-server

Subversion is the new standard for version control and Software Configuration Management (SCM) for globally distributed organizations. CollabNet Subversion is an enterprise-ready distribution of Subversion that includes certified binaries, platform-specific installers, certified plugins for other tools, and enterprise-ready add-ons.
You can download subversion www.collab.net/downloads/subversion

TortoiseSVN

TortoiseSVN is an excellent SVN client. It stores authentication details in an encrypted form which means it can be set to remember login details safely. If you would like to read up on the client, it comes with an inbuilt help system, or you can browse the vendor website at http://tortoisesvn.tigris.org

Python

Python is a remarkably powerful dynamic programming language that is used in a wide variety of application domains. Python is often compared to Tcl, Perl, Ruby, Scheme or Java
You can download Python www.python.org

svn-python

Python bindings for SVN

Apache-ant

Automation tool for repository backup and tagging

SVN Repository Information

Repository Access svn://10.99.146.67
Repository location: E:\Repository
Primary backup D:\RepoBackup
Secondary backup: 10.99.146.65/Repo_Backup/

SVN Repository Configuration

SVN admin is responsible for creating/configuring/maintaining the repository

User Configuration

Open the passwd file in the repository conf folder (e.g. E:\Repository\conf)
Add user and password
[users]
Use1 = password1
Use2 = password2
Use3 = password3

Repository Access Permission

Open the authz file in the repository conf folder (e.g. E:\Repository\conf)
Add the access permission details
[groups]
admins = User1
developers = User2,User3
[/]
* = r
@admins = rw
[/repository/Phase2/trunk]
@developers = rw

SVN Server Configuration

Open the svnserve.conf file in the repository conf folder (e.g. E:\Repository\conf)
Uncomment the following lines
[general]
auth-access = write
password-db = passwd
authz-db = authz
realm = Automation Project
Mailer Configuration
Mailer Configuration file is used by mailer.py script to send mails on commit
[general]
smtp_hostname = 10.99.2.134
[defaults]
diff = C:\diff %(from)s %(to)s
commit_subject_prefix = [SVN Repository Commit]
propchange_subject_prefix =
lock_subject_prefix = [SVN Repository Lock]
unlock_subject_prefix = [SVN Repository unLock]
from_addr = admin@SVN_.com
to_addr = user1@sv.com user2@sv.com
generate_diffs = add copy modify delete
show_nonmatching_paths = yes

Backup Configuration

Backup configuration file is used by backup.xml to backup the repository
Open the backup.conf file in the repository conf\adminscripts folder (e.g. E:\Repository\hooks\adminscripts)
Add the configuration details
#Tue Jun 16 16:42:30 GMT+05:30 2009
#Mail Details
mail.from=admin@SVN_.com
mail.message=SVN Repository Backup
mail.fail.subject=SVN Repository Backup Failed
mail.mailhost=10.99.2.134
mail.tolist=user1@sv.com
mail.success.subject=SVN Repository Backup successfully completed
# SVN Details
svn.home=C\:/ProgramFiles/CollabNetSubversionServer
repo.source=E\:/repository
backup.name=Repository_dump
backup.home=D\:/i_RepoBackup/
backup.back.secondary=/\/\10.99.146.65/\Repo_Backup/
backup.back.fileserver=//fileserver/GOCProjects/RepoBackup/

Tag Configuration

Tag configuration file is used by createtag.xml to create repository tag
Open the createtag.conf file in the repository conf\adminscripts folder (e.g. E:\Repository\hooks\adminscripts)
Add the configuration details
#Mail Details
mail.from=admin@SVN_.com
mail.message=SVN Repository tag
mail.fail.subject=SVN Repository tag Failed
mail.mailhost=10.99.2.134
mail.tolist=user1@sv.com
mail.success.subject=SVN Repository tag successfully completed
# SVN Details
svn.home=C\:/ProgramFiles/CollabNetSubversionServer
repo.source.url = svn://10.99.146.67/repository/Phase2/trunk
repo.target.url = svn://10.99.146.67/repository/Phase2/tags
repo.tag.message = Created Automated tag on

Schedule Task

There are 2 scheduled task one for daily repository backup at 3:00 am and the other for tagging the truck at 6:00 pm


Backup Activity files [e.g E:\Repository\hooks\adminscripts]
Backup.config : holds the configuration information
Backup.xml : ant script to take backup
backup_trigger.bat : batch file to trigger the ant script backup.xml which is added in the windows scheduler
Tagging Activity files [e.g E:\Repository\hooks\adminscripts]
createtag.config : holds the configuration information
createtag.xml: ant script to create tag
createtag_trigger.bat : batch file to trigger the ant script createtag.xml which is added in the windows scheduler

Hook Scripts
Following are the hook scripts used for repository [e.g E:\Repository\hooks]

Precommit [Pre-commit.bat]
Pre-commit.bat batch file is used to check empty comments and delete permission
@echo off
setlocal
set REPOS=%1
set TXN=%2
set SVNLOOK=C:\svnserver\svnlook
REM to check for empty log
: Log msg part
for /f "tokens=*" %%a in ('%SVNLOOK% author --transaction %TXN% %REPOS%') do set USER=%%a
for /f "tokens=*" %%i in ('%SVNLOOK% log --transaction %TXN% %REPOS%') do set LOGMSG="%%i"
IF DEFINED LOGMSG goto EndAll
echo %USER% ! please enter a descriptive log message and then try to commit again 1>&2
exit 1
:EndAll
REM to check for delete access
: Delete part
for /f "tokens=1,2" %%b in ('%SVNLOOK% changed --transaction %TXN% %REPOS%') do (
if "%%b" == "D" (
REM command to find the user access rights
FIND /i "%USER%" E:\Repository\conf\svndelete
IF NOT ERRORLEVEL 1 GOTO NORIGHTS
: NORIGHTS
echo %USER%! you are not allowed to delete the files/folders from the i Repository 1>&2
echo please contact your administrators. 1>&2
exit 1
)
)

Postcommit [post-commit.bat]
post-commit.bat batch file is used to send mails after successful commit by the users

SET REPOS="%1"
SET REV=%2
rem setup paths
SET PYTHON_DIR=C:\Python26
SET HOOKS_DIR=E:\Repository\hooks
SET PYTHON=%PYTHON_DIR%\python.exe
rem run script
"%PYTHON%" "%HOOKS_DIR%\mailer.py" commit %REPOS% %REV% "E:\Repository\conf\mailer.conf"

Variable name should start with the type of variable
Ex. String variable should have str prefixed like “strName”.
Integer variables should have num prefixed like “numCount”.
Boolean variables should have bln prefixed like “blnStatus”

Best Practices

Know when to create branches
Inform the team on which branch the team members should work
Have a look at the emails from the SVN system
Make sure the branches are up-to-date
Tag\lock the branch if finalized for release
Do not deliver the release by copying the folders/files directly from repository
Export the folders and files from the repository and deliver
Maintain a separate area for backups and staging
Monitor the backups and staging area
Ensure team members enters a understandable comments
Monitor locks and checkouts

Comments

If you need any other Subversion related information, read the documentation on the Subversion website, or the Wikipedia entry.Alternatively, a good (though somewhat lengthy) exhaustive guide is "Version Control with Subversion". This document (sometimes called "The Red-Bean Subversion Book", owing to its origin at http://svnbook.red-bean.com) should get you started on the right track with good SVN practice and give you a good introduction to the concepts.

About the author

My name is Xavier Dilip Kumar Jayaraj having 16+ years of IT experience which includes solid experience and depth Knowledge in Application Life Cycle Management, Configuration Management, Implementation and Support using TFS on-premises and Azure DevOps. I have invested in gaining DevOps knowledege to expertise with Cloud Computing providers namely Microsoft Azure and Amazon Web Services in recent years. I am very positive to learn and adapt emerging technologies to client’s environment.

Microsoft Certified: Azure Administrator Associate

Microsoft Certified: Azure DevOps Engineer Expert

DevOps Engineer Certificate Program | Transcript 

OTP-AWSD5: AWS IoT: Developing and Deploying an Internet of Things

[PCEP-30-01] PCEP – Certified Entry-Level Python Programmer

Quotes I Like

"Failure will never overtake me if my determination to succeed is strong enough."  - Dr. APJ. Abdul Kalam

"Always be yourself, express yourself, have faith in yourself, do not go out and look for a successful personality and duplicate it." - Bruce Lee

"Technology is just a tool. In terms of getting the kids working together and motivating them, the teacher is the most important." - Bill Gates

"Innovation distinguishes between a leader and a follower." - Steve Jobs

CategoryList

Disclaimer

The information provided here is based on my expreriences, troubleshooting and online/offline findings. It can be used as is on your own risk without any warranties and I impose no rights.