Monday, August 17, 2009

Merging branches with SVN

'Subversion' (SVN) is used to maintain the various branches of the TODB. As features and functionality are developed in one branch, is often necessary to propogate some of these changes to other branches.
Every time I do this, I seem to have to start from first principles, figuring out the correct svn commands and so on.
Here I have decided to blog on what actually worked!

Example: bringing the Divinity TODB branch largely up-to-date with Trunk (the main development = 'generic version' branch):
  1. Create a new (temp) working directory for Divinity: svn checkout https://source.caret.cam.ac.uk/TODB/branches/divinity
  2. Merge the differences between Divinity and Trunk into the local working directory: svn merge https://source.caret.cam.ac.uk/TODB/branches/divinity https://source.caret.cam.ac.uk/TODB/trunk
  3. Run 'svn status' to list changes (i.e. files that need attention, the ones that have changed)
  4. Run 'svn diff' for each of these files to get a list of the changes in that file (or using the TortoiseSVN Explorer contextual menu: SVN -> Diff)
  5. When the files have been edited to satisfaction, indicate that the conflicts are resolved (if possible, otherwise continue to the next step) (using the TortoiseSVN right-click command).
  6. When all file conflicts are resolved, commit (using the TortoiseSVN)
  7. Go back to the original branch working directory, and update (using Tortoise or the command prompt). This will update the usual Divinity working directory.
This only applies to the PHP files, of course - the database schema and data need to be updated manually.

No comments: