views:

149

answers:

3

I work with a mid-sized team of developers all working on one product. Developers write the code to address a feature or bug fix ticket, then check it into our main development branch (in Subversion). Once the ticket has been tested and validated there by the QA folks, I merge it into the trunk. I normally do this manually, since a lot of the tickets span several revisions, which are not always sequential and may include fixes for several tickets at once.

One thing that I'm sure would help is encouraging developers to only checkin one ticket per revision. We use Jira to track our tasks, so every Subversion revision should have a Jira issue ID in the log - when I'm merging code, I go looking for revisions that include the issue I'm merging in.

Are there other ways I could manage this better? Do other teams branch off of the trunk for every ticket and issue? As I said, we have one main development branch, at least partly because we are building a lot of new functionality pretty quickly, and I imagine we would wind up with dozens of branches pretty quickly if we made one for each ticket.

A: 

This sounds like exactly the use case for a DVCS, like Mercurial or Git.

Is there a reason you need to use a VCS which doesn't natively support your workflow?

Ken
+4  A: 

This question has nothing to do with DVCS or not. It's a PROCESS issue, not a technology issue. Here's my take on what a lot of people are doing, and the process that ClearCase UCM promotes:

/project/trunk 
        /branches 
            /release-1.0-JIRA1023
            /release-1.0-darthcoder-JIRA1029 
            /darthcoder-JIRA1029

        /branches/release-1.0-tfix   <- This is the patch trunk.  Main trunk is future dev

When I fix my bug, I'll promote it back to trunk, or the to the specific release I'm trying to fix. I'll merge to release-1.0-tfix, and to trunk, because it needs to be fixed in several places. When I'm done, I delete the branch and move on to the next issue. So I have two branches of code with the JIRA fix in it while I'm testing it and working on issues (if the fix is wildly divergent).

But nothing gets promoted to trunk or the -tfix trees unless a successful build/test cycle is run, and it has a JIRA property for tracking. This way you can tie each individual fix back to a developer, a branch, and verify things get fixed properly. Also that issues don't get lost (oh did JIRA1029 make it into version 1.2? Well you can verify that by looking for JIRA1029 in your repository. You never have to GUESS, and that's what makes software development repeatable and gets us closers to bugs == 0.

Chris Kaminski
Interesting. Quick question - do you always create a branch for each Jira or are there any situations where you fix a set of Jira tickets at once in a single branch?
Otávio Décio
You could fix a number of bugs/jira's in one branch, but the IDEAL of UCM is to create the smallest changesets possible for each fix. Say you're working on the linux kernel, and you distribute patches. What do you want to provide to end users, one big chunk of fixes that may not apply to them (and possibly be detrimental), or small, focused, surgical fixes? There's arguments for both methods, but I'm a big proponent of 1 JIRA - 1 merge, wherever possible. With large JIRAs (like new features/enhancements), this can become less practical.
Chris Kaminski
A: 

Are you working on concurrent releases? For all of my projects that don't have much concurrent release development (usually < 10 devs), we work in trunk. A single checkin should only apply to a single ticket. If it just happens to fix another ticket the ticket is updated and marked for test.

Why are you merging? Is that your code review or your way of ensuring that the build isn't broken. I personally would set up some continuous integration and skip this step. You should be able to trust your developers not to break the build and have CI catch them if they do.

Gren
I think it's usually best for developers to work in their own branches and perform merges. trunk must be pristine and buildable at all times. I know as a developer I like to checkin broken stuff a lot, just because I know I'm about to make major changes to fix it and/or refactor. You don't want to do this in trunk. CI is great and you should be using it, but trunk is to build product from, not to do development in. IMHO. :-)
Chris Kaminski
I make my own branches when I'm going to make major changes and manually merge it to trunk myself. I do feel that for the most part, the team should share a branch for an entire release. If you create individual branches for each dev or for each ticket, I think you are going to run into more integration issues. So in short, shared branch with CI and only create once use branches for major changes.
Gren