====== Release cycle with subversion ====== Quick recipe/self-reminder of how I handle branching/merging on releases. Premises: * Trunk contains last release * All development goes in branches * Upon release, branch gets merged to trunk and then removed * Each release has a corresponding tag * Tags are never modified 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 ===== * ''svn merge'' acts as a normal diff. * ''svn merge -r R1:R2'' acts as a three-way diff. * Notice the dot at the end of ''merge'' lines * FIXME: Backporting still untested Ref: http://svnbook.red-bean.com/en/1.0/ch04s04.html