General Question

paulc's avatar

How do you manage your branches in Bazaar?

Asked by paulc (2919points) May 7th, 2008

We’re giving Bazaar a try today at work and we’re wondering how some people manage their branches in a project. We’ve decided to keep a pristine branch on our local development server and do our operations via sftp or rsync. Generally our projects are structured as such:


Our dilemma is that when we create our local branches off the trunk (with bzr branch) we’re not really sure if its kosher to push that back as /project/branches/paulcs_branch or just keep it locally and merge into the trunk when we’re done. We’d like to have eachothers’ branches available off the “pristine” copy if possible. Does this make sense? How then do you handle merges into the trunk when a branch is complete using this method.

Observing members: 0 Composing members: 0

4 Answers

ben's avatar

So, we’ve been really happy with our switch to Bazaar, especially once we polished a few scripts that further automate switching and creating branches.

Our setup is similar to the one you describe. You create a local branch from a pristine local mirror of the trunk. We share these local branches on an “as-needed” basis. If andrew wants to check out a branch I haven’t merged to trunk yet, I just push to repos/ben/feature and then he pulls it.

I think this setup works well because it further encourages very cheap branching without any pollution.

Reading your question again: whoever “owns” the branch will then merge it back locally through their pristine mirror. This has been working quite well for us—much better than svn.

Does that answer your question?

paulc's avatar

@ben, yes that answers my question perfectly, thanks very much! In the last little while we’ve basically come to that way of doing things too just by trial and error. So far we’re all quite impressed with this VCS.

andrew's avatar

One thing to note paulc:

We have “trunk” branch that’s hosted centrally (/project/trunk). Each dev has a checkout of that branch on their local machine. Then, to work on a feature, you do a local branch.

If you want to share your branch, you can push it to the central server under /project/andrew/featurebranch (this is also good for backing up).

When you’re done with a feature, you update your local mirror, then merge your changes locally, then check in to the central server.

The advantages:
* The central branch is always in sync (since you’re doing a checkout rather than a branch from the main mirror, you have to check in ALL your changes)
* Having a local mirror makes branching SUPER fast (since you don’t have to branch over sftp). Committing to the central server takes one more step, but that gives you time to think about what you’ve done.

Two more suggestions:
* I’d suggest using bzr+ssh:// rather than sftp://. It’s faster. You do have to have everyone set up rsa keys to the central server, but it’s worth it.
* Make sure you put your branch folders on the central server (where /trunk /billy /bobby live) in a shared-repo. It makes things much faster.
* Ditto on the folder on your local machine—place your local mirror and all your feature branches in a shared-repo.

If you have ANY questions, please PM me. I’m happy to help. Especially if you’re porting from SVN.

paulc's avatar

@andrew, excellent info! What we were doing so far was to mirror the trunk with a local branch then our features also as branches from the trunk. However, your way makes much more sense (using a checkout for the local trunk mirror). You guys have been a huge help, thanks so much. Expect some PMs in the days to come :)

Answer this question




to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
Knowledge Networking @ Fluther