Bazaar

Bazaar

 




Wiki Tools

  • Find Page
  • Recent Changes
  • Page History
  • Attachments

Introduction

Just about everyone is familiar with how branches work. In the case of standalone branches, one gets a working tree that has some RCS data hidden off in the .bzr directory. And then as you make new changes, you commit them and it updates the local .bzr directory. But then later on, you have to publish your changes with something like bzr push. Also, when you have multiple developers working on a shared branch, they all have to keep pushing and pulling to make sure that they stay in sync with each other.

Wait no longer, because checkouts are now a supported feature of Bazaar!

Difference between a Branch and a Checkout

Let's start by saying there is nothing you can do with a Checkout that you can't do with plain Branches. A Checkout just enables different defaults and workflow helpers.

When would I want a checkout?

  • You have several developers working on their own machines, but you don't want to have to follow all of them around making sure that they publish their changes to a central locations.

    Teaching them all to run bzr push when they are done is just one more step that they will forget.

  • You want multiple developers working on the same branch. And in SVN/CVS mode, if someone has committed changes, they must update their copy before they can commit new changes.
  • You are a single developer, but you work on several different machines, and want to keep them in sync.

What does Checkout do

With a Checkout, whenever you create new entries in a local Branch, it also creates them in a remote Branch. This corresponds to commands like bzr commit and bzr pull. If you attempt to commit a new changes, and the remote Branch has a different state than the local one, it will prevent you, and let you know that you are out of date. You can use bzr update to apply the remote changes locally.

You've sold me! How do I do a checkout?

  1. Find a branch that you want a checkout for
  2. run $ bzr checkout branchdir/  newcheckoutdir/ 

Lightweight versus Heavyweight Checkout

A LightweightCheckout is a Checkout where there is no local Branch or Repository. In a HeavyweightCheckout you still have a copy of all of the RCS information.

Both types of checkouts enable the same basic behavior (you must be up-to-date to commit, and a commit updates a remote location). So when would you want to use a light versus heavy checkout?

Less to Download

With a LightweightCheckout, you don't have to copy the entire history to the local machine. This makes getting a new LightweightCheckout somewhat faster than a HeavyweightCheckout. However, this advantage is mostly diminished by using a SharedRepository. Since HeavyweightCheckouts can share their RCS information in the SharedRepository, getting a new Checkout only needs to download revisions not already present.

Offline Commit

However, with a LightweightCheckout, because no data is downloaded, if your connection to the remote location goes away, most operations will not work. (commit, log, etc).

With a HeavyweightCheckout, it can be turned into a standalone branch with a simple bzr unbind and you can later restore its Checkout status with a bzr bind. Or, if you know the disconnect will only be temporary, you can use bzr commit --local to let bzr know that you don't want to update the remote Branch at this time.