This is an old revision of the document! Table of ContentsWorking with branchesIf you would like to play in developing something new, which may potentially break the software, create a new branch to play with. 1 Creating a new branchCreate a new branch by copying the trunk. For example, for a branch called my_branch, do the following (as a single one-line command): svn copy https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/trunk/rosegarden \ https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/<my_branch> You can see what branches already exist (so as to get ideas for a new name, perhaps) using svn ls https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/ Note: Replace <user> with your sforge username and <my_branch> with the branch you are working. 2 Checking out a branchsvn co https://rosegarden.svn.sourceforge.net:/svnroot/rosegarden/branches/<my_branch> The full command to checkout <my_branch> using username is: svn checkout https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/<my_branch> <my_branch> Note: Replace Replace <user> with your sforge username and <my_branch> with your branch name. After the checkout completes, take note of the revision number for later, so you don't have to dig it back up when it comes time to merge. The last message from Subversion will tell you this piece of information, for example: Checked out revision 10745. 3 Committing changes to the branchWorking with branches is as easy as working with the trunk. Commit the changes from the root directory of the branch. cd my_branch svn commit -m "Text which describes the updates." 4 Merging changes from a branch to trunkFor most branches, you want to keep the merge as simple as possible, and only do this once. Chris Cannam recommends ignoring trunk/ until you are ready to merge, and then doing the merge starting by taking a temporary working copy of trunk/ to get started: $ svn co https://rosegarden.svn.sourceforge.net:/svnroot/rosegarden/trunk/rosegarden \ tmp-working-copy Then change into tmp-working-copy/, and using the revision at which you branched (which you took note of earlier) and the name of your branch, do something like: $ cd tmp-working-copy $ svn merge -r<10208>:HEAD https://rosegarden.svn.sourceforge.net:/svnroot/rosegarden/branches/<my_branch> Note: Replace <my_branch> with your branch and and <10208> with revision number of the branch noted earlier. Resolve conflicts, build, test… Then run svn diff to make sure what you're about to commit looks sane. Then fire away with svn commit 5 Merging changes from trunk to the branchIf you are going to be working on the branch for a long time, you may wish to reduce the number of conflicts you may eventually have to resolve by periodically merging from trunk/ into your branch, and then merging the branch back at the end of its lifecycle. You may check the Last Changed revision of the branch with command svn info Let us suppose that the last changed svn version was 8114. Then you would like to merge all changes since svn version 8115. You may do it with command svn merge -r 8115:HEAD https://rosegarden.svn.sourceforge.net/svnroot/rosegarden/trunk/rosegarden If there are no conflicts, you may continue by committing the changes to the branch. svn commit -m "merge from trunk" Note that such a committing does not work if you had conflicts, therefore, resolve conflicts before committing changes. 6 Resolving conflictsIn the case of a conflict, there will be 'C' in the place of the file which contained conflicts. C foo.c Such a file will be split into several parts. foo.c foo.c.r8115 foo.c.r8119 foo.c.working After you have resolved conflicts, remove the extra files and commit the changes. rm foo.c.* svn commit -m "merge from trunk" 7 Closing a branchWhen a branch is finished with, we usually either delete it if it was very short-lived and uninteresting, svn rm https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/uninteresting or else move it to the branches/obsolete directory on the Subversion server. If in doubt, do the latter: svn mv https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/my_branch \ https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/obsolete/ |