/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to doc/en/user-guide/plugins.txt

  • Committer: Ian Clatworthy
  • Date: 2007-11-14 03:50:56 UTC
  • mto: (3054.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3055.
  • Revision ID: ian.clatworthy@internode.on.net-20071114035056-72l6odzpby4bcmub
First cut at new look User Guide including chapters 1 and 2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
==============
2
 
Bazaar plugins
3
 
==============
4
 
 
5
 
Information on how to use plugins in Bazaar.
6
 
 
7
 
What is a Plugin
8
 
================
 
1
Using plugins
 
2
=============
 
3
 
 
4
.. Information on how to use plugins in Bazaar.
 
5
 
 
6
What is a plugin?
 
7
-----------------
 
8
 
9
9
A plugin is an external component for Bazaar that is typically made by
10
10
third parties. A plugin is capable of augmenting Bazaar by adding new
11
11
functionality.  A plugin can also change current Bazaar behavior by
16
16
transports, or customizing log output. The sky is the limit for the
17
17
customization that can be done through plugins.
18
18
 
19
 
Where to find Plugins 
20
 
=====================
 
19
Where to find plugins 
 
20
---------------------
 
21
 
21
22
We keep our list of plugins on the http://bazaar-vcs.org/BzrPlugins page.
22
23
 
23
 
How to Install a plugin 
24
 
=======================
 
24
How to install a plugin 
 
25
-----------------------
 
26
 
25
27
Installing a plugin is very easy! One can either install a plugin
26
28
system-wide or on a per user basis. Both methods involve creating a
27
29
``plugins`` directory. Within this directory one can place plugins in
51
53
than installing ``bzr-gtk`` to ``~/.bazaar/plugins/bzr-gtk``, install it
52
54
to ``~/.bazaar/plugins/gtk``.
53
55
 
54
 
Writing a plugin
55
 
================
56
 
Plugins are very similar to bzr core functionality.  They can import
57
 
anything in bzrlib.  A plugin may simply override standard functionality,
58
 
but most plugins supply new commands.
59
 
 
60
 
To create a command, make a new object that derives from
61
 
``bzrlib.commands.Command``, and name it ``cmd_foo``, where foo is the name of
62
 
your command.  If you create a command whose name contains an underscore,
63
 
it will appear in the UI with the underscore turned into a hyphen.  For
64
 
example, `cmd_baz_import` will appear as `baz-import`.  For examples of how
65
 
to write commands, please see ``builtins.py``.
66
 
 
67
 
Once you've created a command you must register the command with
68
 
``bzrlib.commands.register_command(cmd_foo)``.  You must register the
69
 
command when your file is imported, otherwise bzr will not see it.
70
 
 
71
 
Bzr will scan ``bzrlib/plugins`` and ``~/.bazaar/plugins`` for plugins
72
 
by default.  You can override this with ``BZR_PLUGIN_PATH``.  Plugins
73
 
may be either modules or packages.  If your plugin is a single file,
74
 
you can structure it as a module.  If it has multiple files, or if you
75
 
want to distribute it as a bzr branch, you should structure it as a
76
 
package, i.e. a directory with an ``__init__.py`` file.
77
 
 
78
 
Please feel free to contribute your plugin to BzrTools, if you think it
79
 
would be useful to other people.
80
 
 
 
56
Listing the installed plugins
 
57
-----------------------------
 
58
 
 
59
To do this, use the plugins command like this::
 
60
 
 
61
    bzr plugins
 
62
 
 
63
The name, location and version of each plugin installed will be displayed.
 
64
 
 
65
Popular plugins
 
66
---------------
 
67
 
 
68
Here is a sample of some of the more popular plugins:
 
69
 
 
70
* TODO ...
 
71
 
 
72
If you wish to write your own plugins, it is not difficult to do.
 
73
See `Writing a plugin`_ in the appendices to get started.