Merge bug fixes in release branches - svn switch to branch or get a separate working copy?

I am relatively new to Subversion, hoping to get some ideas from more experienced people. We take the approach to carry out the bulk of development work (new features and bug fixes) on the trunk and merge bug fixes in release branches as needed. With this approach, developers will not code directly against release branches at all, only merging with them.

My first thought was that perhaps the developers do not need a working copy of the release branches at all, and perhaps the changes in trunk can be merged into branches directly in the repository. But I quickly realized that not how Subversion works - you need a working copy to unite.

So, my next thought was that developers can still only store one copy of the code base locally, point it to the connecting line, and transition svn to the release branch when they need to merge. A couple of potential issues that I might see:

  • It may be too easy to forget to switch back to the trunk after the merger.
  • The developer may have had uncommitted changes in his working copy (something that they worked on for a future version before they interrupted to fix errors) that would still be present when they switched to svn, and accidentally merging these changes into release branches.

If I put together several scripts for this process, I could prevent # 1 from being a problem, but No. 2 concerns me a little more. I wonder if this is the gap for this approach.

In short, my question is: when merging bug fixes from the trunk to the release branch, where the developer does not yet have a working copy of the release branch, is it considered best practice for the developer to switch svn to merge, or check the working copy of the release branch in elsewhere locally? Thanks in advance!

+4
source share
4 answers

Currently, disk space is cheap, so there really is no reason to limit everything in one working copy - checking the branch separately gives the best of most worlds (regardless of the development of the trunk, there is less chance of forgetting where you are, it can easily switch back and forth from work with a branch before working on the highway, if necessary, no need to reload the trunk when this is done).

+5
source

I would not use the svn switch, except in accidental circumstances (as described in the documents), when you start coding a solution against one branch (for example, trunk), and then conclude that it would be better in your branch (svn copy trunk newbranch; svn switch newbranch).

You should always merge to a local working copy, so that you can diff for your changes before you commit them (which you should always get used to doing before commit, any commit), and also check that the code compiles.

If the release branch is large and cumbersome to maintain a local working copy (this can especially be the case if you have many release branches on the go), consider using the branch / patch manager - specify one of your senior programmers to manage the release branches, and he / she can select certain trunk changes to merge with the release branches. Most people keep striking their use on disk, and you keep stable release branches under great control.

+5
source

This is a rather philosophical question. To avoid problem # 2, I would probably go with a separate merge check. This may take a little longer, but it is definitely more flexible.

+1
source

I use SVN a rare check function a lot. If I check the repository, I check the trunk / tags / releases folders non-recursively (immediate children, including folders). Then I go to each of them and update so that their immediate children are also taken out. That way I have a complete overview of the entire repository without spending too much disk space.

Then I go and completely recursively update everything I want to work on. If I ended up with something that will not be deleted in the repository, but which I no longer need on my drive, I just update it for immediate children.

This has the obvious advantage of mirroring the actual location of the repository on your disk. Easy to navigate in any industry. Another advantage of this approach is that a simple update will tell you about new tags and branches.

I have yet to meet a repository where the number of tags or branches is so vastly overwhelming that they simply check folders that do not recursively lose space.

+1
source

All Articles