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
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
When branching and merging hasn't been handled too well, this can help:
[trunk] $ svn merge --reintegrate url://.../BRANCHES/BRANCH_X .
svn merge
acts as a normal diff.svn merge -r R1:R2
acts as a three-way diff.merge
lines