/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
1
Writing a plugin
2
================
3
4
Introduction
5
------------
6
6622.1.24 by Jelmer Vernooij
More doc renames.
7
Plugins are very similar to brz core functionality.  They can import
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
8
anything in breezy.  A plugin may simply override standard functionality,
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
9
but most plugins supply new commands.
10
11
Creating a new command
12
----------------------
13
14
To create a command, make a new object that derives from
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
15
``breezy.commands.Command``, and name it ``cmd_foo``, where foo is the name of
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
16
your command.  If you create a command whose name contains an underscore,
17
it will appear in the UI with the underscore turned into a hyphen.  For
18
example, `cmd_baz_import` will appear as `baz-import`.  For examples of how
19
to write commands, please see ``builtins.py``.
20
21
Once you've created a command you must register the command with
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
22
``breezy.commands.register_command(cmd_foo)``.  You must register the
6622.1.24 by Jelmer Vernooij
More doc renames.
23
command when your file is imported, otherwise brz will not see it.
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
24
5168.2.1 by Andrew Bennetts
Add example merge_file_content hook based on my answer to <https://answers.edge.launchpad.net/bzr/+question/103163>.
25
Installing a hook
26
-----------------
27
28
See `Using hooks`_.
29
30
 .. _Using hooks: hooks.txt
31
32
3777.6.2 by Marius Kruger
Give an indication of how to specify a plugin version number
33
Specifying a plugin version number
34
----------------------------------
35
Simply define ``version_info`` to be a tuple defining the current version
36
number of your plugin. eg.
37
``version_info = (0, 9, 0)``
38
``version_info = (0, 9, 0, 'dev', 0)``
39
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
40
Plugin searching rules
41
----------------------
42
7204.1.4 by Jelmer Vernooij
Fix plugin description.
43
Breezy will scan ``~/.config/breezy/plugins``  and ``breezy/plugins`` for
44
plugins by default.  You can override this with  ``BRZ_PLUGIN_PATH``
5050.38.2 by Alexander Belchenko
Change links to user-reference/bzr_man.html to corresponding pages everywhere in the User Guide
45
(see `User Reference 
6622.1.24 by Jelmer Vernooij
More doc renames.
46
<../user-reference/configuration-help.html#brz-plugin-path>`_ for details).
4628.2.3 by Vincent Ladeuil
Update doc and add NEWS entry.
47
48
Plugins may be either modules or packages.  If your plugin is a single
49
file, you can structure it as a module.  If it has multiple files, or if
6622.1.24 by Jelmer Vernooij
More doc renames.
50
you want to distribute it as a brz branch, you should structure it as a
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
51
package, i.e. a directory with an ``__init__.py`` file.
52
53
More information
54
----------------
55
7204.1.4 by Jelmer Vernooij
Fix plugin description.
56
Please feel free to contribute your plugin to Breezy, if you think it
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
57
would be useful to other people.
58
6622.1.24 by Jelmer Vernooij
More doc renames.
59
See the `Breezy Developer Guide`_ for details on Breezy's development
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
60
guidelines and policies.
61
6622.1.24 by Jelmer Vernooij
More doc renames.
62
.. _Breezy Developer Guide: ../developer-guide/HACKING.html