December 11, 2012

Data Mining Fun: How Much Work is Task Branching?

What's New

Are you using a task branching workflow? If so, merging is a routine part of your development workflow. Hopefully, those merges are fast and automated. The more often you merge, the smaller the merge is and the less chance you have a painful conflict to deal with.

If you're a release manager or branch guru, that's part of your consideration as you think about your branching model: how efficiently and easily are the changes flowing between branches?

I figured out a neat way to try to start answering that question with some hard numbers. Perforce's database has all the information I need. I can see, for any codeline or all the codelines in a project, how many merges were done and how they were resolved. That's pretty impressive: not many version management tools track that level of detail about how a merge is handled.

I decided to write a BIRT report to extract and present the information in a useful way.  I probably could've written a script to do it, but this sort of data mining is what report engines are made for. Here's an example output picture showing number of merges with different resolve actions per codeline:

This information is incredibly valuable. I can see at a glance how many merges are happening per codeline, a measure perhaps of how often contributions are being made and accepted. Then I can dig into how the merges are resolved. Automatic merges are good, while conflicts (a resolve action of edit from) are always more time consuming and difficult.  If I notice a lot of conflicts in a codeline, I might look at how often the merges are being run, whether the tasks are too big and need to be split up, and whether that codeline is a hot spot of tricky code.

I built this report using BIRT and P4toDB. I put more notes and the sample report design files up in a public space. If this sort of information is useful to you, let me know! I'd like to expand the selection of sample reports available to the Perforce community. There's a related project in the Perforce public depot as well.