views:

152

answers:

8

We use a JIRA as our ticket system. New bugs/tickets are submitted to that system. Once a bug is fixed, we create a new build and test it on our dev server. If everything is good we push it to the live server. Now I usually work on the trunk without any branching to fix the bugs. This is of course a problem. Because there can be many bugs in our system, but only certain ones get fixed at a time. However if I fix all of them in the trunk instead of a branch, then we are forced to test them all even if we did not had enough time to test them all. How do you usually fix bugs and branch etc..? (I am not sure if I explained it very well).

+6  A: 

Here is the strategy I use. I develop in the main trunk. When the software is released, I branch it (say v1.0). When bugs come in, fix in the branch trunk and then merge back to main trunk. Here is a good synopsis of strategies that are available: http://www.cmcrossroads.com/bradapp/acme/branching/branch-structs.html

Greg
Do you fix several bugs in the same branch?
vikasde
@vikasde: If the system have a testing environment (which is the case if it is a "serious" or a well done project), then yes. Every commit must just pass the regression before being committed.
Phong
All bugs related to a specific version should be fixed in the versioned branch and after successful QA, merged back to main so that the next version will not contain the same bugs.
Greg
@Greg: How do you decide what bugs go into what version? Lets say I just rolled out V1.0 and its live on the server. Do all new bugs go into V1.1?
vikasde
What we do here is fix bugs in v1.0 branch and after QA merge to main. When we decide it is time to roll out fixes to customer, we branch v1.1 from v1.0 and lockdown the v1.0 branch. We continue to do this until, say v2.0 goes out the door (branched from main, which contains all the bugfixes from v1.x and new features).
Greg
@Greg: What if the following happens: You have fixed bug 1, tested it and branched it. It all works fine etc.. Now management comes and says: "dude, we need to add this new feature, test it and roll out asap." Do you now create a new branch for this as well?
vikasde
+1  A: 

I'm not sure if it's the normal strategy but we do all work on the trunk and then backport bugfixes into release branches. Our main trunk is always 'unstable' and when we feel we have a trunk in a releasable state we branch it into a release branch. From then on buyfixes are ported back into the release branch and new functionality only gets added to the trunk. It means you can run your release branch through testing and focus on testing the bugfixes.

Russell Troywest
A: 

I wouldn't recommend branching on every reported bug. As you said, you may not decide to fix every bug that's reported, which would mean that you'd have a lot of dead branches to prune at some point.

If your tools & language support it, branching on every bug you decide to fix (and feature you decide to implement) isn't a bad idea. It allows you to develop and test each bugfix/feature when you have the budget and schedule to do so, and merge them back into trunk when you are ready.

BryCoBat
+1  A: 

One common mode of operations is that the deployed software lives in a separate branch which receives only bugfixes. Where you actually develop those fixes is mostly irrelevant; to avoid interference with the current development, it makes sense to develop the fix on top of the "live" branch, then test/commit/deploy to the live system and aftewards merge the fix back into the trunk.

David Schmitt
A: 

We split our branches into product versions / release, so that each release has its own branch. The release from the branch is tested, and so we only need to test the fixes applied to that branch.

Additionally each product version has a dev and a main branch. Developers are allowed to freely commit to the dev branch without fear of interfering with the Release (only other developers!)

Kragen
+1  A: 

We have the same problem (or almost), and I think every developer team has it. I can unfortunately not yet give you an answer by experience, but only a theoretical one.

In my opinion, as long as it's a bug fix, it should be deployed as soon as possible. What I am about to implement is a feature branch strategy, and a release branch. This means we have to differentiate features from bugs. and what is deployed is branched separately (or labeled, in our case)

Doing this, you can still work on the trunk for the bugs, and deploy them to your testing server, and once it's tested and approved branch it to the release branch and deploy it. you can also merge-in the bug fixes into your feature branch, or try to merge the feature later when you plan to deploy it to the testing server.

Anyway, the most important I think is to branch the long work that prevent you from deploying smaller bug fixes. If you branch too much, you will have a merging problem. If you don't branch enough, you will have a deployment flexibility issue.

Stephane
-0.5. I would suggest fixing your bugs on the release branch (as others have suggested) and do your testing there--you should be testing on the branch you're going to deploy.
Curt Nichols
Probably an easier solution, true :)
Stephane
A: 

Unless you're using a distributed SCM (Mercurial, Git, ...) where branching is basically free, branching on every bug sounds like an unreasonnable amount of work.

The usual strategy with central repository SCM is to note the revision that is supposed to fix the bug, and test against a build made with a later revision. You can then merge the concerned revision back into the release branch.

We are using mercurial, and branching to fix bugs and then merge changes back is quite doable in a distributed SCM

Axelle Ziegler
A: 

It depends on your version control system. If you're using git, where branches are cheap and merges are easy, then I would definitely create a new branch for each fix. This allows you to keep bug fixes independent of each other, allowing greater flexibility with respect to what gets merged into the master/trunk, and when.

On the other hand, if you're using Subversion, branches are more expensive (in terms of creating and switching/updating) and merging is more difficult. Often the cost/benefit ratio of a new branch isn't high enough (especially for small bugs) to make it worthwhile.

Craig Walker
We use subversion and I find it a pain to switch/merge/branch etc..
vikasde
Craig Walker