Subversion branching and tagging with Eclipse

07th Mar, 2011 | svn unix

Branching to complete a task outside the trunk in Eclipse

Creating the branch
  • Select the trunk working copy
  • Team/Branch/tag…
  • Copy to URL: Use the select button if the branch already exists, otherwise specify new directory in branches
  • Specify copy to be either HEAD or specific revision
  • Specify message for the branch, probably task name
  • When checking out a freshly created branch may have to right click a repository and select refresh before it appears
svn copy {repos source} {repos new} -m "Create message"
Checkout the branch to a fresh working copy
  • Can either checkout a fresh copy or switch your current working copy to the branch
  • Checkout fresh copy with New/Project…/SVN/Checkout Projects from SVN
  • Switch a current working copy using Team/Switch to another branch/revision…
Merging any changes from the trunk into your branch
  • Select the branch project directory
  • Update to HEAD
  • Team/Merge…
  • Select 'Merge a range of revisions
  • Merge from: /trunk
  • Revisions: All eligible revisions
  • Default conflict options (safest)
  • Any conflicts are flagged and should be dealt with manually
  • Commit

Command line version is a bit more tricky, the revisions to merge must be found manually

#move to the trunk working copy

cd

#if a trunk working copy is not handy switch the old branch copy to the trunk

svn switch

#find the revision range of the branch

svn log  --stop-on-copy

#note the revisions in that branch

svn merge -r(first revision):(last revision)

#commit

svn commit -m "Branch x merged into trunk"

 

Branch task completed, merging branch back into the trunk
  • Select the trunk project directory
  • Update to HEAD
  • Team/Merge…
  • Select 'Reintegrate a branch
  • Here may get an error if the trunk hasn't been updated. Update to HEAD
  • Merge from:
  • Default conflict options (safest)
  • Any conflicts are flagged and should be dealt with manually
  • Commit
svn merge --reintegrate {repo url} /path/to/local/copy

 

Tagging a release in Eclipse

All final releases are tagged with name

All release candidates are tagged with name _rc

  • Select the trunk project directory
  • Team/Branch/tag…
  • Copy to URL: Use the select button if the tag already exists, otherwise specify new directory in tags
  • Specify copy to be either HEAD or specific revision
  • Specify message for the tag, probably version of release
  • When checking out a freshly created tag may have to right click a repository and select refresh
copy -rHEAD http://87.102.101.70/svn/test/trunk http://87.102.101.70/svn/test/tags/release1b