Merging SVN branches with Beanstalk
This article discusses common issues when merging SVN branches on Beanstalk.
What is the difference between (sync) merge and reintegrate merge?
Reintegrate merge is used when you want to merge a feature branch into the originating branch. This is normally used when you're ready to deploy a new feature and you want to merge your work back into the stable branch.
Sync merge is used when you want to fetch all of the latest changes made on your parent branch (e.g. trunk). Using this will keep your feature branch up-to-date with the parent branch.
Things to keep in mind when merging on Beanstalk
- By default, your base branch (as shown in the branches page) will always be the trunk. That is, unless you change it to be something else. Changing your base branch to be something else is a temporary change, not a permanent one. See note below.
- To change your change your default branch you have to configure it in your repository settings. First, create the branch in your repository. Then go to Repository > Settings and change the “trunk path” to your new branch.
Note: The base branch is not the same as your repository's default branch (trunk/master). When you change the base branch on the Branches page it doesn't update repository settings or affect other users. This means that if you leave the branches page and go to another part of Beanstalk, when you return to the branches page your base branch will revert to the default branch. If you need a visual of how this works, please view the video clip here.
Common questions when merging SVN branches on Beanstalk
I reintegrated a branch into the trunk, but the branch commit history of the changed files is no longer visible in the trunk history. What just happened?
To add some context, consider this scenario:
- You’re working on a file called hello.php in the trunk directory.
- You create a new branch called “develop A”.
- You commit a few changes to the hello.php file and write your commit message as “added X”.
- Now you check the commit history of the hello.php file in the branch to confirm that the “added X” change is there.
- Then you go to the branches page and reintegrate the branch into the trunk. But when you check the commit history for hello.php it now says “merged branch/develop A into trunk” and not “added X”.
Solution: This is not an SVN issue, but it’s how Beanstalk works with SVN. When you reintegrate a branch into the trunk, the branch is deleted. But the changes are visible in the Beanstalk Activity page. While Beanstalk replicates some functionality of a VCS, it doesn’t do everything. If you want to see your full history we recommend using the SVN log command. This can be used locally and will give you the full commit history.
The compare view feature does not work on my SVN branches. I don’t have any conflicts. What’s going on?
Solution: This happens sometimes if you’re working with a large repository. If your repo has a lot of revisions (let’s say 12k in total) it’s likely those revisions will not process. Our SVN performance is quite constrained and limited in this area. In this light, we recommend comparing changes locally. Here are a few ways to do that using an SVN client or the command line.
I want to update my branch with the latest version of my trunk. But instead of updating my branch with the modifications in the trunk, Beanstalk updated my trunk with the modifications done in my branch. Is this a bug?
Solution: No. This is not a bug. But it’s a lot to wrap your head around. If you want to merge the changes from the trunk into your feature branch then you need to change the feature branch to be the base branch. Otherwise, the changes will get merged into the trunk which is not the result you want. The “merge” button will always merge your branch into the base branch that is selected. That's why we made it possible to switch your Base branch to anything you want.