Tagging a list of projects in SVN

In every project we do before we release the projects its quite important to create a snapshot for each service/subproject.

In SVN terms we call this a tag.

One can use any SVN clients available in the market like Tortoise, sliksvn etc.and create this tag but when we are dealing with a large set of services it could be bit time consuming and error prone before you get it right.

I created this small script which takes in parameters like username password and tag version as input and reads the list of projects on which u want to version from another file projectlist.txt (this should exist in the same directory or provide full path) and creates the tag version in the corresponding tags directory .

projectlist.txt is a simple text file with list of your projects that you want to versio sample text would be.




Also this assumes that the directory structure is the standard SVN structure i.e.

@echo off
 setLocal EnableDelayedExpansion

 SET /P PASSWORD=Password:
 SET /P VERSION=Version:

for /f "tokens=* delims= " %%i in (projectlist.txt) do (

REM Tag the project
 svn copy https://nysolutionsltd.com:8443/svn/nysolutionsltd/src/sca/soa/%%i/trunk/  https://nysolutionsltd.com:8443/svn/nysolutionsltd/src/sca/soa/%%i/tags/%Version% -m "Tagging the %Version% release of the project to go for Preprod"

REM Export the project
 svn export --non-interactive --username %USERNAME% --password %PASSWORD%  https://nysolutionsltd.com:8443/svn/nysolutionsltd/src/sca/soa/%%i/tags/%Version% .\%%i

REM Append to the project list

REM Clean up exported directories
 REM rmdir /S /Q %%i\SCA-INF 2> nul
 rmdir /S /Q %%i\deploy 2> nul
 rmdir /S /Q %%i\.designer 2> nul
 rmdir /S /Q %%i\thumbnail 2> nul




In addition this will export all the versioned projects into your local directory.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s