Branching


I know one of the areas people find lacking in Source Safe has been in its branching features. We've put a lot of thought and effort into Hatteras to be more capable and more flexible when it comes to branching and merging (remember, we're building Hatteras from the ground up, so we're not forcing new capabilties on an old engine or anything like that).
 
Of course, me saying that isn't exactly reassuring by itself. I know people have a variety of approaches and motivations when it comes to branching, and I believe we have the features most of you will need to manage your codebase the way you *want* to, instead of being constrained by limitations of the tool. To help us all ascertain this, I'd like to hear a bit about how folks out there currently deal with change management - do you use a main branch with release branches? Do you have private branches for groups or even individual developers? Do you try to keep the "tip" of your repository in a buildable state, or do you mandate periodic (e.g. daily) checkins? Various people would answer "yes" to one or more of those questions, usually with a good reason, even if there's other reasons they WISH they could answer "no". And, of course, vice versa.
 
I want to take some specific examples of how people work today, and how they WISH they could work, and show how Hatteras will let you do it. In some cases, we may even have more than one valid approach. For example, maybe you have a private branch you check in to daily, so your work always stays recent on the server (and, presumably, backed up as a result). We'll support this, naturally. But we'll *also* let you solve the same problem with shelving, if you'd rather *shelve* your changes each day, and skip the "staging" branch. Either will (almost always) solve the problem, but one may appeal more to you than another, based on your own particular situation.
Comments (14)

  1. Vish says:

    Great to hear sourcesafe is being redeveloped from ground up. With regards to your branching question, the approach we take at my place of work is I guess pretty standard. We have a main release branch/trunk which is always in a buildable state, when we kick off a project, we create a branch. Every so often each branched project needs to reintegrate the changes from the trunk as it changes (ie. when a project gets released, code is reverse integrated into the trunk, before releasing). Our current SCM assists us alot in tracking code changes and automatically integrating those changes back onto trunk. Our SCM also provides us with private depots where we can branch code to and do personal testing/dev that may not fit into a project.

  2. ns says:

    I’m also pleased to hear the sourcesafe is being rebuilt. For our project (our companies website) we have two trees. One is a development tree that all developers access on a daily basis to work on. Code is checked in either daily or later if it’s not in a compilable form at the end of a day. Once the code has been approved in the test environment, we branch it over into the production tree. Compile against that tree, and re-test. If all is well, it’s checked into the production tree and taken into full production.

    I haven’t read the rest of your posts (I’m about to, so maybe this has already been ansered), but we have some in-house applications that interface with sourcesafe. Are you going to have an availible .NET API that can be accessed to use sourcesafe programmatically? Thanks for your time in posting this information!

  3. Chris says:

    Quick thing – I meant that Hatteras is a ground-up development. Source Safe, including the upcoming Source Safe 2005, is not a complete re-work. I’m sorry if I implied otherwise.

    Your scenario is definitely one we see a lot. In fact, "forward integration" and "reverse integration" are terms you’ll hear in Microsoft quite often (and even here, not without a certain amount of trepidation).

    You’ll be able to setup the exact same sort of topology in Hatteras. It will know who’s been branched from who, and merge both "up" (reverse integrate) and "down" (forward integrate) the branch tree, with a pretty good degree of automatic merge processing. You can also (if you’re either really brave or really REALLY careful) do "baseless" merges to go "across" the tree, skip a level, etc., but as you probably know, that’s not something you find yourself either willing or eager to do except under special (and hopefully limited) circumstances.

    You’ll also be able to create what amounts to private depots by creating branches and limiting Read and/or PendChange access to that branch to whatever subgroup you like — an individual dev, a feature team, whatever works for you.

  4. Chris says:

    ns:

    Your topology sounds a lot like Vish’s, organized around "lifecycle" (dev/test in preprod/test in production/checkin to production) rather than around individual projects. I’ve seen them more directly organized around releases (version X, beta 1, hotfix XYZ, etc.) as well. So once again, Hatteras definitely supports your branching approach.

    As to your second question, I think it’s yes and no. I’m not sure if you mean a Source Safe API, or a Hatteras API.

    I can’t actually speak to a Source Safe API – I’m not on the Source Safe team and thus just not enough ‘in the loop’ to know what features are coming in the ’05 version. If you hit the link to Korby’s page, he may have an answer to that specific question. Feel free to toss me an email if you don’t see an answer, and I’ll try to track down a specific answer.

    Hatteras will have an Object Model you can code against (in fact, last I heard, Team Foundation has a common OM, of which the Source Control client is just one component). Also, Hatteras’s server interface is a Web Services interface, so you can write a full client against that Web Services interface, if that’s a more appealing approach.

  5. Adam Hill says:

    One thing that would make branching more accessable and more "oops’ proof, would be a graphical view of the branching of the code, including pending shelved code (if possible).

    Often with complex branching.merge scenarios it has helped me to draw out what is happening. (Just go license Quick Graph from Jonathan de Halleux and get it over with)

    If a manager sees that all his leads have lots of shelved code, he might ask the reason why. Maybe it indicates some uncertainty of the impending changes. Many coders dont speak up about their true feelings about things, but the code does not lie.

    Thanks for all the great features, keep it up.

  6. Chris says:

    Adam:

    I don’t know if we’ll have any graphical visualization tools when we ship; however, we at least expose the necessary data to construct such views (you can view the branch and merge histories for a filespec as the source or the target, or for a specific source/target combination, and so on).

  7. Chris_S says:

    I’d second the suggestion of a graphical visualization. In the past I’ve seen branching (in several source control systems) avoided as people aren’t quite sure what’s going on behind the scenes and get worried that their code changes might end up in the ‘wrong place’. So I believe this is a really significant feature. Perhaps if there really isn’t any time for this, it could be done as a kind of powertoy on gotdotnet or some such place…

  8. Chris says:

    Chris_S:

    The "fear factor" is definitely something we’re concerned about. It’s at least partly justified – branching and merging are almost irreducibly complex, and you do have to trust that automatic merging will either do what you expect or tell you that it can’t. And as we know, trust is earned, not given, even for software.

    There’s now a feature request for a graphical branch/merge tool. I should be clear that it’s not likely to make v1, but it’s a possibility for a future version.

    Also, a powertoy-type solution should be possible. We’ll have a managed object model that will expose all of the data and methods you’d need to visualize and modify the branch model graphically.

  9. James Snape says:

    Hi Chris,

    I don’t know if trackbacks work correctly from dasBlog to dotText so just to let you know I’ve added a post to my site explaining how we use source control branching. You can find it at:

    http://www.jamessnape.me.uk/PermaLink,guid,e87908c7-2d31-428a-a4b2-dd5b905b66c9.aspx

    Regards,

    James.

  10. Chris says:

    James,

    I read your article, very impressive (how’d you make the graphics?).

    If you like Perforce, I think you’ll be very pleased with the way Team System is approaching Source Control. The branching and merging (we use "merge" where perforce uses "integrate") is very similar. The "big build" stuff that will come with Team System should also allow you to set up the same kind of scheduled merge, build, checkin on build success/undo on build failure. I say *should* because I’m not terribly familiar with the build system, but I know scheduling and extensibility are among its major goals.

    As you said, having changeset-based checkins is nice when you want that one branch to always be in a buildable state. Keeping the build unbroken is a priority with the Developer Division at Microsoft, as well. Team System’s source control (aka Hatteras) also uses atomic, transactioned checkins, and the changeset number each successful checkin gets can be tracked and used much as you would with Perforce. And, naturally, it plays a big role in integating source control with the build system, the work item (defect) tracking system, and so on.

  11. James Snape says:

    Chris,

    Thanks for the compliment. I used Visio for the graphics saved as a PNG and then shrunk by 75% in Paint Shop Pro… If you want to use it I can give you the original Visio file, just drop me a mail.

    One question I would have is about speed. As you probably know, Perforce is just about the fastest thing there is. This means it doesn’t get in the way when you’re working. Are you aiming for the same perf standards? Do you have any perf goals you can share with us?

    Regards,

    James.

  12. Chris says:

    James,

    I showed your perf questions to Sam Mullis (http://blogs.msdn.com/sammu), our resident perf and stress tester (he’s probably known to the backend as the "Master of Pain and Suffering"). Look for a blog post from him on our perf story in the near future…

  13. This was the most popular question asked at our booth (and perhaps all of the VSTS area) at Tech Ed Developers

Skip to main content