Tagging a list of projects in SVN

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.

Myproject1

Myproject2

Myproject3

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

@echo off
setLocal EnableDelayedExpansion

SET /P USERNAME=Username:
SET /P PASSWORD=Password:
SET /P VERSION=Version:
SET PROJECTLIST=

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
SET PROJECTLIST=!PROJECTLIST!%%i,

REM Clean up exported directories
REM rmdir /S /Q %%iSCA-INF 2> nul
rmdir /S /Q %%ideploy 2> nul
rmdir /S /Q %%i.designer 2> nul
rmdir /S /Q %%ithumbnail 2> nul
)

)

endLocal

PAUSE

 

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

Post Tagged with , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *