3
A plugin is an external component for Bazaar-NG that is typically made by
4
third parties. A plugin is capable of augmenting Bazaar-NG by adding or
5
replacing new or current functionality in Bazaar-NG. Plugins often work as
6
a way for developers to test new features for Bazaar-NG prior to inclusion
7
in the official codebase. Plugins can do a variety of things, including
8
overriding commands, adding new commands, providing additional network
9
transports, customizing log output. The sky is the limit for the
10
customization that can be done through plugins.
14
We keep our list of plugins on the http://bazaar-vcs.org/PluginRegistry page.
18
Plugins are very similar to bzr core functionality. They can import
19
anything in bzrlib. A plugin may simply override standard functionality,
20
but most plugins supply new commands.
22
To create a command, make a new object that derives from
23
`bzrlib.commands.Command`, and name it cmd_foo, where foo is the name of
24
your command. If you create a command whose name contains an underscore,
25
it will appear in the UI with the underscore turned into a hyphen. For
26
example, "cmd_baz_import" will appear as "baz-import". For examples of how
27
to write commands, please see builtins.py.
29
Once you've created a command you must register the command with
30
`bzrlib.commands.register_command(cmd_foo)`. You must register the command
31
when your file is imported, otherwise bzr will not see it.
33
Bzr will scan **bzrlib/plugins** and **~/.bazaar/plugins** for plugins by
34
default. You can override this with **BZR_PLUGIN_PATH**. Plugins may be
35
either modules or packages. If your plugin is a single file, you can
36
structure it as a module. If it has multiple files, or if you want to
37
distribute it as a bzr branch, you should structure it as a package, i.e. a
38
directory with an **__init__.py** file.
40
Please feel free to contribute your plugin to BzrTools, if you think it
41
would be useful to other people.
43
How to Install a plugin
44
=======================
45
Installing a plugin is very easy! One can either install a plugin
46
systemwide or on a user by user basis. Both methods involve create a
47
"plugins" directory. Within this directory one can place plugins in
48
subdirectories. For example, "plugins/bzrtools/".
50
Two locations are currently checked; the bzrlib/plugins directory
51
(typically found in /usr/lib/python2.4/site-packages/bzrlib/plugins/) and
52
$HOME/.bazaar/plugins/.
54
One can additionally override the home plugins by setting the environment
55
variable BZR_PLUGIN_PATH to a directory that contains plugins. The
56
installation of a plugin can be checked by running **bzr plugins** at
57
any time. New commands can be seen by running **bzr help commands**.
59
Plugins work particularly well with Bazaar-NG branches. For example, to
60
install the bzrtools plugins for your main user account, one can perform
4
.. Information on how to use plugins in Bazaar.
9
A plugin is an external component for Bazaar that is typically made by
10
third parties. A plugin is capable of augmenting Bazaar by adding new
11
functionality. A plugin can also change current Bazaar behavior by
12
replacing current functionality. Sample applications of plugins are:
16
* providing additional network transports
17
* customizing log output.
19
The sky is the limit for the customization that can be done through plugins.
20
In fact, plugins often work as a way for developers to test new features for
21
Bazaar prior to inclusion in the official codebase. Plugins are helpful
22
at feature retirement time as well, e.g. deprecated file formats may one
23
day be removed from the Bazaar core and be made available as a plugin instead.
25
Plugins are good for users, good for external developers and good for
31
We keep our list of plugins on the http://bazaar-vcs.org/BzrPlugins page.
33
How to install a plugin
34
-----------------------
36
Installing a plugin is very easy! If not already created, create a
37
``plugins`` directory under your Bazaar configuration directory,
38
``~/.bazaar/`` on Linux and
39
``C:\Documents and Settings\<username>\Application Data\Bazaar\2.0\``
40
on Windows. Within this directory (referred to as $BZR_HOME below),
41
each plugin is placed in its own subdirectory.
43
Plugins work particularly well with Bazaar branches. For example, to
44
install the bzrtools plugins for your main user account on Linux,
45
one can perform the following::
63
47
bzr branch http://panoramicfeedback.com/opensource/bzr/bzrtools
64
48
~/.bazaar/plugins/bzrtools
50
When installing plugins, the directories that you install them in must
51
be valid python identifiers. This means that they can only contain
52
certain characters, notably they cannot contain hyphens (``-``). Rather
53
than installing ``bzr-gtk`` to ``$BZR_HOME/plugins/bzr-gtk``, install it
54
to ``$BZR_HOME/plugins/gtk``.
56
Alternative plugin locations
57
----------------------------
59
If you have the necessary permissions, plugins can also be installed on a
60
system-wide basis. One can additionally override the personal plugins
61
location by setting the environment variable ``BZR_PLUGIN_PATH`` (see `User
62
Reference <../user-reference/bzr_man.html#bzr-plugin-path>`_ for a detailed
65
Listing the installed plugins
66
-----------------------------
68
To do this, use the plugins command like this::
72
The name, location and version of each plugin installed will be displayed.
74
New commands added by plugins can be seen by running ``bzr help commands``.
75
The commands provided by a plugin are shown followed by the name of the
81
Here is a sample of some of the more popular plugins.
83
================ ================= ==================================
84
Category Name Description
85
================ ================= ==================================
86
GUI QBzr Qt-based GUI tools
87
GUI bzr-gtk GTK-based GUI tools
88
GUI bzr-eclipse Eclipse integration
89
General bzrtools misc. enhancements including shelf
90
General difftools external diff tool helper
91
General extmerge external merge tool helper
92
Integration bzr-svn use Subversion as a repository
93
Migration cvsps migrate CVS patch-sets
94
================ ================= ==================================
96
If you wish to write your own plugins, it is not difficult to do.
97
See `Writing a plugin <writing a plugin.html>`_ in the appendices to get