Table of Contents

Release cycle with subversion

Quick recipe/self-reminder of how I handle branching/merging on releases. Premises:

Legend: [x] $ marks directory from which to run –wcopy for working copy–, for $ directory doesn't matter

Cycle

Work on branch:

        $ svn co url://.../branches/BRANCH_X
[wcopy] $ svn ci

“Promote” branch to trunk:

[wcopy] $ svn ci -m "Last commit before merge"
[wcopy] $ svn log --verbose --stop-on-copy   # Identify branching revision, e.g. 1600
[wcopy] $ svn sw url://.../TRUNK             # Working copy changes to trunk
[wcopy] $ svn update                         # Get HEAD revision, e.g. 1700
[wcopy] $ svn merge -r1600:HEAD url://.../branches/BRANCH_X .
        (Fix conflicts, if any)
[wcopy] $ svn ci -m "Merge from branch X to trunk, r1600:1700" # Logging the revision range will be useful for future 'svn log'

Incremental merges: Subsequent merges from the same branch should skip revisions already merged (i.e. “-r 1701:HEAD”)

“Release”:

        $ svn copy url://.../TRUNK url://.../TAGS/RELEASE_X -m "Release X"
        $ svn rm url://.../BRANCHES/BRANCH_H -m "Delete merged branch"
        $ svn copy url://.../TRUNK url://.../BRANCHES/BRANCH_Y -m "Branch Y"
[wcopy] $ svn sw url://.../BRANCHES/BRANCH_Y              # Switch to new branch for development
       
        $ svn export url://.../TAGS/RELEASE_X X
   [X]   (package, etc. to actually release)

The tree will retain merge information (source branches and revisions), display with:

[wcopy] $ svn pg svn:mergeinfo

Unclean merge

When branching and merging hasn't been handled too well, this can help:

[trunk] $ svn merge --reintegrate url://.../BRANCHES/BRANCH_X .

Notes

Ref: http://svnbook.red-bean.com/en/1.0/ch04s04.html