Our team works off the feature branch concept and because of this the various teams need to do a source-to-branch merge on a consistent interval. Doing this process is not difficult, but it is reparative and could become error prone if you are not paying attention. Because of this we have created a simple .bat script which will aid in automating most of the repetitive tasks which should reduce the amount of errors we encounter.
The script (this is v1 of the script so there may be improvements we could make) is as follows:
CLS
ECHO OFF
REM -- These values may need to change, but not all that often
SET TortoiseSvnLocation="C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe"
REM -- Make sure to change these values
SET /p TrunkHead=Please Enter the latest revision for the Trunk (should be HEAD):
SET /p BranchHead=Please Enter the latest revision for the Branch (should be HEAD):
SET /p TrunkStartRevision=Please Enter the Start Revision:
SET /p TrunkEndRevision=Please Enter the End Revision:
REM -- Make sure you have the physical locations correct
SET TrunkLocationOnDisk="C:\Source\Trunk"
SET BranchLocationOnDisk="C:\Source\\Branch"
REM -- Make sure you have the Url's pointing to the correct location on disk
SET TrunkUrl=https://URL_TO_ROOT_SOURCE
SET BranchUrl=https:/URL_TO_BRANCH_SOURCE
ECHO Chaning To Trunk Location
CD %TrunkLocationOnDisk%
ECHO /* About to update the trunk to the %TrunkHead% */
%TortoiseSvnLocation% /command:update /rev:%TrunkHead% /path:%TrunkLocationOnDisk% /closeonend:1
ECHO Chaning To Branch Location
CD %BranchLocationOnDisk%
ECHO /* About to update the branch to the %BranchHead% */
%TortoiseSvnLocation% /command:update /rev:%BranchHead% /path:%BranchLocationOnDisk% /closeonend:1
%TortoiseSvnLocation% /command:merge /path:%BranchLocationOnDisk% /fromurl:%TrunkUrl% /revrange:%TrunkStartRevision%-%TrunkEndRevision%
pause
The intent of the script is do perform the following actions
- CD into the folder for the trunk
- Pull latest of the trunk (SVN path provided in TrunkURL)
- CD into the folder for the branch
- Pull latest of the branch (SVN path provided in BranchURL)
- Run the merge command and provide the start-stop revisions (which are provided via user imput)
As you can see the script is not rocket science, but it does work and it does save you having to perform the same repetitive steps over and over again.
Till next time,
Posted
05-13-2010 5:31 AM
by
Derik Whittaker