Project

General

Profile

Bazaar Version Control System

Introduction

Golden Code uses a distributed version control system called Bazaar. The command line program used to interact with Bazaar is bzr and the two terms will be used interchangeably.

Bazaar is designed to be a distributed source code management system, which means it accommodates the more complex requirements of teams of developers that work in geographically distributed locations and timezones. In other words, when work on a project is distributed across many systems, distributed systems like Bazaar more easily fit into the development processes than systems like CVS.

Bazaar is much simpler than CVS in many ways. It is also more flexible, having had the benefit of a design from scratch to support distributed version control. One of the best features of Bazaar is that the choice of access to a project is just the method by which the files themselves are accessed. The tool itself "thinks" in terms of file system access to the project. In other words, local access to a project is the same as remote access, the only difference is in the URL (and associated protocol) used to get access to the files. This means that one could use zip/unzip to backup and restore a project repository to some other place, and access to it with Bazaar is only different in the URL. That access can even be done through HTTPS or SFTP.

Bazaar also provides support for a centralized development model, where the repository is not distributed. This is not possible with VCS systems such as git (see Why Do We Use bzr Instead of git). The FWD development process is a combination of centralized and decentralized approaches, which makes bzr a good fit.

The FWD project stores multiple sub-projects inside bzr repositories. This includes the main FWD project itself as well as a Testcases Project.

Installation

Bazaar is a simple distributed version management system which has some unique properties that match our development process. It runs on any platform (it is written in Python).

The minimum version you should be using is Breezy 3.1.0. You can see the version using bzr --version. Installation instructions:

Ubuntu Windows
On Ubuntu, you would install it like this (no download needed): sudo apt-get install brz python3-paramiko. As of Ubuntu 20.04 and later, only Breezy is used. The older install of the sudo apt-get install bzr bzrtools python-paramiko was for the older bzr project which was Python 2.7 based. TODO: test Breezy and update the documentation here. Breezy is Python 3 based so it should be easier to implement on windows.

It is known to work on Windows using the Python bundle of Bazaar with Python 2.7 where one has installed a specific version of Paramiko (1.15.0). The latest versions of Paramiko didn't work with bazaar because of some function that was removed. The Paramiko version recommended on the Bazaar site didn't work with the sftp protocol (which is needed for use with FWD). As a result of this, as of June 7, 2019, the following process was needed:

WARNING: All of this is empirical as many combinations were tried which didn't work and the author is not sure whether or not any of those might have affected the process nor if there aren't any (better) combinations that could work. :(

* Install Python 2.7 since Bazaar seems to be built using that, 2.7.16 is the last stable 2.7 version (https://www.python.org/downloads/release/python-2716/). Bazaar is compiled against the x86 version so download that even if you have a 64-bit OS - Windows x86 MSI installer .
* Install Bazaar for Python (http://wiki.bazaar.canonical.com/WindowsDownloads), pick the latest version built for Python 2.7 (2.6b1).
* Install Microsoft Visual C++ Compiler for Python (https://www.microsoft.com/en-us/download/details.aspx?id=44266). This is required for compiling additional Python packages.
* To install Python packages it is best to use `pip` which is the default package manager for Python (https://www.liquidweb.com/kb/install-pip-windows/).
* Install the following additional Python packages:
* pycrypto, this seems to be a dependency that is not always resolved so make sure it is installed. The version tried is 2.6.1 but the author doesn't remember specifying an exact version for this one. To install, use the command pip install pycrypto.
* paramiko, this actually adds support for secure protocols, the version the author has found to work is 1.15.0. More recent versions don't work with Bazaar because of some incompatible changes introduced in paramiko by removing some method exposed by the library which apparently is being used by Bazaar so the author started from the last version and went backward (from major version to previous one) until finding the one that works. Older versions don't have sftp support so don't go too far back in time either. To install, use the command pip install paramiko==1.15.0.

With that Bazaar should work from the command line with stfp protocol. Optionally, since many may work with Eclipse (PSDOE), you can install an Eclipse plugin for Bazaar (https://launchpad.net/bzr-eclipse). This only worked for two out of three users, one keeps on saying xmloutput package is not available although the plugin does have that bundled in and installing it with Python package manager (pip install xmloutput) didn't change anything. Even more, after a failed update one of the other Eclipse plugins stopped working and keeps throwing some 'invalid xml' errors so probably better to just stick to the command line interface for time being.

Docs and downloads (including Windows):

https://bazaar.canonical.com/en/

Why Do We Use bzr Instead of git?

bzr was chosen several years before git was the most popular decentralized source management system.

Here are some reasons bzr was chosen over git:

  1. It has simple and clean approach. There are fewer commands involved to achieve the same results.
  2. It can support both centralized and decentralized modes of operation very easily. git is exclusively decentralized. The original FWD development process was heavily centralized and even today it takes advantage of the benefits of centralized repositories. The 2nd point meant that we could shift our process to decentralized over time, with less effort and less risk. This is what has been happening. Feature branching is used heavily but it is used in a check-out mode where a local copy of the branch is linked to a shared central branch. Multiple people can have check-outs (a.k.a. linked or "bound" branches) of this same central branch. This is a powerful mechanism for code reviews and collaborative working which minimizes merging conflicts. It also leads to a much more stable history/revision hierarchy which cannot be achieved with git.
  3. It uses revision numbers (and hierarchical nesting) instead of commit hashes. This make projects easier to manage because one does not need to treat a particular branch as a set of hashes. In a highly decentralized model, the hash approach makes sense. But in projects with modest team size, it is an unnecessary complication. As an example, in FWD one can say they are using revision 11302 of trunk and it tells everyone exactly what point in the linear development "stream" is being referenced. One can try to simulate this by only having a git repo that is the single source of truth for the development stream. The problem is that any random commit hash is hard to conceptually place in this stream. You must look at the larger history of the repo to understand where things are and what changes are included. Tagging is much more important in git to try to make specific named points that have conceptual meaning. With bzr this is trivial and you don't have to constantly tag things.
  4. There are some other functional reasons.
    • You can rename files in bzr but not in git. This means you don't "delete and add" to rename, and the result keeps its revision history. DTZ: git now has the mv command which provides the same feature (see https://git-scm.com/docs/git-mv).
    • bzr supports remote access over sftp which is very useful for providing remote secure access to a repository. git doesn't have this nor does it have an easy equivalent.
    • At one time git was weak in handling binary files. GES: It seems git has improved binary file support over the recent years, especially if you mark a given file with the binary attribute.

Items 2 and 3 above were the real drivers of the decision. In the end, the choice of bzr has worked well. If we could make up for the deficiencies in git, we would move to it.

git has at least 2 advantages over bzr:

  • It is more popular. More people know it and may even have it already installed.
  • It is designed for projects that handle thousands of remote developers, so it can probably handle extreme levels of decentralization better than bzr. For the foreseeable future, the FWD project will not have thousands of developers, so this is not really a consideration.

Some external references:

http://doc.bazaar.canonical.com/migration/en/survival/bzr-for-git-users.html
http://doc.bazaar.canonical.com/migration/en/why-switch-to-bazaar.html

What is the Future for Bazaar?

In recent years, the bzr project has gone dormant. Although the tool itself is quite reliable/stable, this is not a preferred situation for any software environment. Since the scope of the functionality in a version control system is limited, this has not been a problem for us in the recent past. As of January 1, 2020, Python 2.7 has reached its end of life. bzr does not work on Python 3 which is the only supported Python platform going forward. Although it will continue working for some time, it won't receive fixes and will probably be dropped (e.g. from pip) at some point.

This means that we do need to make plans to shift away from bzr to an alternative.

git

Moving to git is one option. Its popularity and level of ubiquity conveys the big advantage of being a "safe" choice. Unfortunately, the advantages of bzr over git remain.

At this time we aren't changing away from Bazaar.

Breezy

There is a fork of the bzr project which is called Breezy (with the command line program renamed to brz instead of bzr). This is a community project that picked up the development of Bazaar and moved it to Python 3, added fixes and cleaned up some cruft that was left behind. It seems quite healthy but the authors do not suggest that it is a strategic VCS platform. They recommend git as the best VCS for open source projects. Even so, we don't see an alternative to easily move to git.

Using brz is the approach we will take for the forseeable future. Breezy works on newer Linux systems as a drop-in replacement for bzr. When the project is installed it creates an alias from bzr to brz. Since the command lines are compatible, you can continue working with Bazaar without any issues. There is likewise no issue with repository formats. Everything just works as before, but with fixes and a better maintained project.

We need to test this on Windows but it may be much easier than bzr since it is Python 3 based.

Some links:

Bazaar-NG: 7 years of hacking on a distributed version control system
Breezy: Forking Bazaar
Breezy Project Home
Breezy User Guide
Breezy Download/Install
Breezy 3.0.0 Release Notes
Rebase will be added to the Breezy core.


© 2010-2022 Golden Code Development Corporation. ALL RIGHTS RESERVED.