Bazaar-NG Tags

From The Linux Foundation
Jump to: navigation, search

Tags in Bazaar-NG

Officially, Bazaar-NG did not support tags for a long time. Tag support made its first appearance in 0.15; see the tag pages on the Bazaar wiki.

Before native tags were available, we relied on a simplistic tag system made available as a plugin. Our official branch of this plugin is at, branched from the original developer's repository at Our main contribution is to rename the commands in the plugin to "otag" and "otags", so it can be used with bzr 0.15 and not conflict with native tag support. (We also have some bug fixes.)

At the moment, the LSB official repositories use this plugin. We do not yet recommend using native tags, as we do not want to break compatibility with slightly older versions of bzr. Thus, the plugin is required for developers who want to work with tags. It is safe to develop without the plugin if you don't use tags; the tag information will be preserved on commits, merges, etc.

In the near future, we will migrate the old-style tags to native tags, and remove support for the old tags.


The bzr web site has instructions for installing plugins. Basically, the two files that make up this plugin have to be installed into their own directory in a place where bzr can find them.

For the impatient, here are quick and dirty instructions:

bzr branch bzr-tags
cd bzr-tags
mkdir -p $HOME/.bazaar/plugins/tags
cp $HOME/.bazaar/plugins/tags

To verify that the installation worked, run "bzr help commands". You should see two new commands: otag and otags.


You can now get a list of tags in a branch with the command "bzr otags", and you can add a tag with "bzr otag". Newly-added tags are visible immediately, but must be committed, just like revisions to files. You can tell if you have uncommitted tags with "bzr status"; if a file called ".bzrtags" shows up as modified, you have uncommitted tags.

Tags propagate to branches, and are integrated through merges. So, to tag an official FSG project, branch it first, tag the branch, and merge it through the Bazaar-NG Patch Queue Manager.

To use tags with other commands, pass the tag to the -r argument, prefixed with "otag:". For example, to see the differences in a project between LSB 1.2 and 1.3, you can do this:

bzr diff -r otag:LSB_1_2..otag:LSB_1_3

Implementation Details

The plugin stores tag data in a file called ".bzrtags" in the root of the project. This file is versioned just like a regular file, although the plugin takes care of adding the file with the first tag.

Because of this, it's possible to move and delete tags, and get the old information back by looking at the history of the .bzrtags file.

Local (non-propagating) tags are not officially supported. You can create effectively local tags if you're careful to exclude .bzrtags from your commits.