In broad terms, there are 3 steps involved in upgrading a new format:
Bazaar supports branches in earlier formats so the third step is strictly not required. However, when new default formats are introduced, they are more space efficient, faster on large projects and/or provide new features. So it is recommended that most projects migrate to it at a convenient time.
For most users, upgrading and migrating to the new format is straight forward. For projects with a large community of developers though, things become more complex. In these cases, careful planning and good communications become essential. This document provides general advice which aims to assist in this regard. If in doubt, please contact us on our mailing list or IRC channel with any questions or concerns you have.
The steps required to upgrade the core software vary from operating system to operating system. A brief outline of the steps is given below.
To upgrade Bazaar on Ubuntu:
To upgrade Bazaar on Windows:
To upgrade Bazaar on OS X (via the installer):
To upgrade Bazaar on OS X (via MacPorts):
For further information on installing and upgrading, see http://wiki.bazaar.canonical.com/Download.
Many plugins are not dependent on a particular Bazaar version so upgrading them is optional. Other plugins, notably bzrtools and bzr-svn, are more tightly associated with Bazaar’s APIs so these typically need to be upgraded in lockstep with the core software.
For Windows and OS X users, bzrtools and bzr-svn are typically included in the installer so no special steps are required to upgrade these. For Ubuntu and other GNU/Linux or Unix systems users, bztrools, bzr-svn and many other popular plugins can be installed and upgraded using your platform’s package manager, e.g. Synaptic on Ubuntu.
As mentioned earlier, the complexity of migrating to a new format depends on several factors, particularly project community size. It also depends on how data is currently stored, e.g. in a standalone branch, multiple branches in a shared repository, stacked branches on Launchpad, etc. These various scenarios are covered in the next chapter.
Before starting a migration, there are a few important things to do first:
A complete backup gives you a safety net in case anything goes wrong.
Purging obsolete branches reduces the amount of data that needs to be migrated. See Finding obsolete branches later for some tips on doing this.
To enable a smooth transition to the new format, you should:
This advance warning should be long enough for users to have time to upgrade Bazaar and any required plugins before the migration date.
For larger projects, allow some time for the migration itself. You should have a good idea of how long the migration will take after doing the test migration. It may make sense to do the migration on a weekend or a Friday, giving yourself some breathing space if things go wrong.
After the trunk is migrated, you’ll need to notify your community accordingly, giving them instructions as to how to migrate their local branches. Sample instructions are provided later in this document.
The steps are:
You have two options for upgrading your Launchpad branches. You can either upgrade them remotely or you can upgrade them locally and push the migrated branch to Launchpad. We recommend the latter. Upgrading remotely currently requires a fast, rock solid network connection to the Launchpad servers, and any interruption in that connection can leave you with a partially upgraded branch. The instructions below are the safest and often fastest way to upgrade your Launchpad branches.
To allow isolation between public and private branches, Launchpad uses stacked branches rather than shared repositories as the core technology for efficient branch storage. The process for migrating to a new format for projects using Launchpad code hosting is therefore different to migrating a personal or in-house project.
In Launchpad, a project can define a development series and associate a branch with that series. The branch then becomes the focus of development and gets special treatment and a shortcut URL. By default, if anybody branches your project’s focus of development and pushes changes back to Launchpad, their branch will be stacked on your development focus branch. Also, branches can be associated with other Launchpad artifacts such as bugs and merge proposals. All of these things mean that upgrading your focus of development branch is trickier.
Here are the steps to follow:
In summary, these steps mean that the old trunk is still available and existing branches stacked on it will continue to be so. However, the development focus has switched to the migrated trunk and any new branches pushed to Launchpad for your project will now stack on it.
You are now ready to tell your community that the new trunk is available and to give them instructions on migrating any local branches they have.
If you want your new migrated development focus branch to have the same name as your old pre-migration branch, you need to do a few extra things before you establish the new development focus.
To migrate a standalone branch:
To migrate branches in a shared repository:
- init an empty branch in the new repository and pull the revisions from the branch in the old repository across.
- In the new repository, branch from trunk to the new branch name then merge your changes from the matching branch in the old repository.
The first method will give you a branch which is identical (in terms of revision history) to the old branch, but it’s parent branch will be set to the old branch, not your new trunk. If you use this method, you’ll probably update the parent_location configuration variable in the branch.conf file with:
bzr config parent_location=XXX
XXX being the URL to your new trunk.
In contrast, the second approach sets up the parent branch correctly. However, it isn’t ideal if you’re not ready to include all the latest revisions from trunk into that branch yet.
If you use feature branching for developing each fix and enhancement separately, you may have several old branches that are no longer required. In many cases, the relevant changes may now be merged into trunk. In other cases, a branch may be obsolete thanks to another change made by yourself or others.
When checking for an obsolete branch, there are three things in particular to confirm:
After changing into the root of a branch, the commands to check these things respectively are:
bzr status
bzr shelve --list
bzr missing --mine-only
If your branches are stored in a shared repository locally, you may find the Local Changes tab in Bazaar Explorer’s repository view helpful here (revision 159 or later) as it shows a summary of these things, excluding the shelve information currently, for each branch as you select it.
Copyright 2009-2011 Canonical Ltd. Bazaar is free software, and you may use, modify and redistribute both Bazaar and this document under the terms of the GNU General Public License version 2 or later. See <http://www.gnu.org/licenses/>.