SVNMUCC: Co-tagging and Co-branching

In a previous post, I mentioned co-tagging.

Here are a couple of scripts, one Bash shell script, and the equivalent DOS Batch file, to assist with co-tagging and similarly with co-branching.

The bash:

#!/bin/bash

#svnmucc --help

REPOS_PATH="http://server/repos"

PROJECT1="proj1"
PROJECT2="proj2"

### *** co-tag project trunks ***
function svnmucc_tag
{
    TAG_REVISION=$1
    TAG_NAME="$2"
    TAG_COMMENT="Tag version ${TAG_NAME} of ${PROJECT1} and ${PROJECT2}."

    svnmucc \
        -U "${REPOS_PATH}" \
        cp ${TAG_REVISION} "${PROJECT1}/trunk" "${PROJECT1}/tags/${TAG_NAME}" \
        cp ${TAG_REVISION} "${PROJECT2}/trunk" "${PROJECT2}/tags/${TAG_NAME}" \
        -m"${TAG_COMMENT}"
}

### *** co-branch trunks ***
function svnmucc_branch
{
    BRANCH_REVISION=$1
    BRANCH_NAME="$2"
    BRANCH_COMMENT="Created ${BRANCH_NAME} branches for ${PROJECT1} and ${PROJECT2}."
    svnmucc \
        -U "${REPOS_PATH}" \
        cp ${BRANCH_REVISION} "${PROJECT1}/trunk" "${PROJECT1}/branches/${BRANCH_NAME}" \
        cp ${BRANCH_REVISION} "${PROJECT2}/trunk" "${PROJECT2}/branches/${BRANCH_NAME}" \
        -m"${BRANCH_COMMENT}"
}

#svnmucc_tag 1234 "1.0"
#svnmucc_branch 2345 "feature_name"

The batch:

@echo off

setlocal

rem svnmucc --help

set REPOS_PATH=http://server/repos

set PROJECT1=proj1
set PROJECT2=proj2

goto :main

REM *** co-tag project trunks ***
:svnmucc_tag
    set TAG_REVISION=%1
    set TAG_NAME=%~2
    set TAG_COMMENT="Tag version %TAG_NAME% of %PROJECT1% and %PROJECT2%."

    rem echo !!! first to test
    echo !!! svnmucc ^
        -U %REPOS_PATH% ^
        cp %TAG_REVISION% "%PROJECT1%/trunk" "%PROJECT1%/tags/%TAG_NAME%" ^
        cp %TAG_REVISION% "%PROJECT2%/trunk" "%PROJECT2%/tags/%TAG_NAME%" ^
        -m%TAG_COMMENT%
goto :EOF

REM *** co-branch trunks ***
:svnmucc_branch
    set BRANCH_REVISION=%1
    set BRANCH_NAME=%~2
    set BRANCH_COMMENT="Created %BRANCH_NAME% branches for %PROJECT1% and %PROJECT2%."

    rem echo !!! first to test
    echo !!! svnmucc ^
        -U %REPOS_PATH% ^
        cp %BRANCH_REVISION% "%PROJECT1%/trunk" "%PROJECT1%/branches/%BRANCH_NAME%" ^
        cp %BRANCH_REVISION% "%PROJECT2%/trunk" "%PROJECT2%/branches/%BRANCH_NAME%" ^
        -m%BRANCH_COMMENT%
goto :EOF

:main

rem call :svnmucc_tag 1234 "1.0"
rem call :svnmucc_branch 2345 "feature_name"
Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s


%d bloggers like this: