Merge lp:~jelmer/brz/yet-more-docs into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/yet-more-docs
Merge into: lp:brz
Diff against target: 415 lines (+275/-44)
8 files modified
doc/developers/index-plain.txt (+2/-2)
doc/developers/index.txt (+1/-1)
doc/developers/plugin-api.txt (+2/-2)
doc/developers/plugin-development.txt (+264/-0)
doc/en/_templates/index.html (+2/-2)
doc/en/tutorials/using_breezy_with_launchpad.txt (+0/-33)
doc/en/user-guide/hooks.txt (+1/-1)
doc/en/user-guide/writing_a_plugin.txt (+3/-3)
To merge this branch: bzr merge lp:~jelmer/brz/yet-more-docs
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+359087@code.launchpad.net

Commit message

Some more minor improvements to the docs.

Description of the change

Some more minor improvements to the docs:

 * Fix links to glossary and developer docs
 * Drop canonical-specific blurb from Launchpad tutorial

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Thanks! Am aware this is mostly ported over text, but have left some inline comments for things that seem not quite right.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'doc/developers/index-plain.txt'
--- doc/developers/index-plain.txt 2018-11-18 14:23:08 +0000
+++ doc/developers/index-plain.txt 2018-11-22 02:24:44 +0000
@@ -28,8 +28,8 @@
2828
29* `Breezy Code Style Guide <code-style.html>`_.29* `Breezy Code Style Guide <code-style.html>`_.
3030
31* `Writing plugins <http://doc.bazaar.canonical.com/plugins/en/plugin-development.html>`_31* `Writing plugins <plugin-development.html>`_
32 |--| specific advice on writing Breezy plugins. (web link)32 |--| specific advice on writing Breezy plugins.
3333
34* `Documenting changes <documenting-changes.html>`_.34* `Documenting changes <documenting-changes.html>`_.
3535
3636
=== modified file 'doc/developers/index.txt'
--- doc/developers/index.txt 2018-11-18 14:23:08 +0000
+++ doc/developers/index.txt 2018-11-22 02:24:44 +0000
@@ -60,7 +60,7 @@
60 overview60 overview
61 integration61 integration
6262
63* `Writing plugins for Breezy <http://doc.bazaar.canonical.com/plugins/en/plugin-development.html>`_ (web link)63* `Writing plugins for Breezy <plugin-development.txt>`_
6464
65* `breezy API reference <api/index.txt>`_65* `breezy API reference <api/index.txt>`_
6666
6767
=== modified file 'doc/developers/plugin-api.txt'
--- doc/developers/plugin-api.txt 2018-11-18 18:23:32 +0000
+++ doc/developers/plugin-api.txt 2018-11-22 02:24:44 +0000
@@ -23,7 +23,7 @@
23--------23--------
2424
25 * `Breezy Developer Documentation Catalog <../index.html>`_.25 * `Breezy Developer Documentation Catalog <../index.html>`_.
26 * `Breezy Plugins Guide <http://doc.bazaar.canonical.com/plugins/en/plugin-development.html>`_ for26 * `Breezy Plugins Guide <plugin-development.txt>`_ for
27 more suggestions about particular APIs.27 more suggestions about particular APIs.
2828
2929
@@ -241,7 +241,7 @@
241time other than register or override functions to be called later.241time other than register or override functions to be called later.
242242
243The plugin can import breezy and call any function.243The plugin can import breezy and call any function.
244Some interesting APIs are described in `Breezy Plugins Guide <http://doc.bazaar.canonical.com/plugins/en/plugin-development.html>`_.244Some interesting APIs are described in `Breezy Plugins Guide <plugin-development.txt>`_.
245245
246246
247Publishing your plugin247Publishing your plugin
248248
=== added file 'doc/developers/plugin-development.txt'
--- doc/developers/plugin-development.txt 1970-01-01 00:00:00 +0000
+++ doc/developers/plugin-development.txt 2018-11-22 02:24:44 +0000
@@ -0,0 +1,264 @@
1Developing a plugin
2===================
3
4Naming
5------
6
7By convention, most plugins are named brz-xxx and are installed into a
8directory called xxx. Note that the directory name must be a legal
9Python package name, so a plugin called brz-xxx-yyy need to be installed
10into a directory called xxx_yyy, i.e. '-' in a plugin name should be mapped to
11an underscore in the directory name.
12
13
14Licensing
15---------
16
17We encourage plugin authors to make their plugins publicly available
18under the same license as Breezy itself, namely GPL v2 or later. However, there
19is no requirement to do so. You are free to create Breezy plugins for
20private or internal use within your company and not distribute them.
21
22By sharing your work, a larger number of people benefit. In our experience,
23plugin developers also benefit heavily by having more users involved in
24the design, testing, bug fixing and longer term maintenance. In other words,
25sharing leads to a better plugin faster.
26
27
28Testing
29-------
30
31To ensure your plugin under development is available to Breezy, set
32the ``BRZ_PLUGIN_PATH`` environment variable to its parent directory.
33Alternatively, you may wish to develop your plugin within a directory
34under your personal plugins area (``~/.bazaar/plugins`` on GNU/Linux)
35or put a symbolic link in that area pointing to your plugin under
36test. Finally you can use ``BRZ_PLUGINS_AT`` to point to a specific
37directory for a specific plugin (separated by your platform's value of
38os.pathsep), e.g.
39
40 export BRZ_PLUGINS_AT=qbrz@/home/me/qbrz:explorer@/home/me/explorer
41
42You can disable loading plugins with ``BRZ_DISABLE_PLUGINS``.
43
44If you want to stop loading all but installed plugins you can use:
45
46 BRZ_PLUGIN_PATH=-site
47
48We also encourage plugin developers to provide tests for their plugin.
49When you run ``brz selftest``, Breezy will scan all its plugins to see if
50they contain a function named ``test_suite()``. For each plugin that does,
51it calls the function and adds any resulting tests to the master test suite.
52To run just the tests for plugin xxx, the command is::
53
54 brz selftest -s bp.xxx
55
56
57Providing help
58--------------
59
60Plugins in this guide have their documentation automatically
61generated from the online help provided for a plugin. Sections are
62ordered as follows:
63
641. High level introduction
652. Plugin-specific help topics (COMING SOON)
663. Commands defined or extended by the plugin.
67
68High level help is specified in the docstring for the ``__init__.py`` module.
69You can register plugin-specific help topics in ``__init__.py`` like this::
70
71 _xxx_tutorial = """XXX Tutorial
72
73 Welcome to xxx, your new best friend. ...
74 """
75 topic_registry.register('xxx-tutorial',
76 _xxx_tutorial,
77 'How to use xxx')
78
79Command level help is specified in the docstring for the relevant
80``cmd_xxx`` Command class.
81
82.. note::
83
84 The final documentation needs to be in ReST format. Keep in mind though
85 that the documentation should also be readable via ``brz help xxx`` so
86 it's best to keep markup to a reasonable minimum.
87
88
89Providing custom code via hooks
90-------------------------------
91
92Hooks let you provide custom code at certain processing points.
93The available hook point are documented in the `User Reference
94<http://doc.bazaar-vcs.org/development/en/user-reference/index.html#hooks>`_.
95
96Adding a new hook is done with, for example::
97
98 import breezy.branch
99 breezy.branch.Branch.hooks.install_named_hook('post_push', post_push_hook,
100 'My post_push hook')
101
102For more information on how to write hooks,
103see http://doc.bazaar-vcs.org/development/en/user-guide/hooks.html.
104
105
106Defining a new command
107----------------------
108
109Breezy commands are defined as subclasses of ``breezy.commands.Command``, the
110command name is specified by the name of the subclass, and they must be
111registered into ``brz`` with the ``breezy.commands.register_command`` function
112at module import time.
113
114To define the ``brz foo-bar`` command::
115
116 from breezy.commands import Command, register_command
117
118 class cmd_foo_bar(Command):
119 # see breezy/builtins.py for information about what to put here
120 pass
121
122 register_command(cmd_foo_bar)
123
124If the class name starts with ``cmd_``, the prefix will get dropped
125and ``_`` will be replaced by ``-`` characters.
126
127
128Managing data
129-------------
130
131Plugin data falls into several categories:
132
133* Configuration settings.
134* Data the user can see and version control.
135* Data behind the scenes.
136
137Configuration settings are often stored in ``branch.conf``,
138``locations.conf`` or ``bazaar.conf``.
139
140User-visible data for a plugin called xxx should be stored in
141``.bzrmeta/xxx``. If mutiple files are desirable, make ``.bzrmeta/xxx``
142a directory or give them a common prefix within ``.bzrmeta``, e.g.
143``xxx-foo``, ``xxx-bar``.
144
145Data managed behind the scenes should be stored in ``.bzr``.
146Depending on the nature of the data, it may belong in a subdirectory
147within there, e.g. ``checkout``, ``branch`` or ``repository``.
148It's your responsibility to ensure behind-the-scenes data is
149propagated and merged appropriately via custom code. You may want
150to use existing hooks for this or ask for new hooks to help.
151
152Useful metadata
153---------------
154
155It is highly recommended that plugins define a version number. This
156is displayed by ``brz plugins`` and by the ``qplugins`` GUI dialog.
157To do this, define ``version_info`` in ``__init__.py`` like this::
158
159 version_info = (1, 2, 0, 'beta', 1)
160
161Plugins can also declare other useful metadata such as a mimimum
162breezy version, new transports and storage formats. See
163`Plugin API <plugin-api>`_ for details.
164
165
166Performance tips
167----------------
168
169When brz starts up, it imports every plugin, so plugins can degrade
170performance when they're not being used. However, sub-modules are not
171loaded, only the main name.
172
173One way you can avoid this slowdown is by putting most of your code
174in sub-modules, so that the plugin, itself, is small. All you really
175need in the ``__init__.py`` is the plugin's Command classes, the
176commands to register them, and the optional ``test_suite()``.
177
178Another way to reduce your plugin's overhead is to use the breezy
179lazy_import functionality. That looks something like this::
180
181 from breezy.lazy_import import lazy_import
182 lazy_import(globals(), """
183 from breezy import (
184 branch as _mod_branch,
185 option,
186 workingtree,
187 )
188 """)
189
190Lazy importing only works for packages and modules, not classes or
191functions. It defers the import until you actually need it.
192
193
194Learning more
195-------------
196
197`Integrating with Bazaar <http://wiki.bazaar.canonical.com/Integrating_with_Bazaar>`_
198explains how to do such operations as ``add``, ``commit``, ``log`` and more.
199
200Reference documentation on some key APIs is provided below. For a more
201detailed reference, see the `complete breezy API documentation <api/index>`_.
202
203
204Mini API Reference
205------------------
206
207Command Class
208~~~~~~~~~~~~~
209
210Base class for commands. Commands are the heart of the command-line brz
211interface.
212
213The command object mostly handles the mapping of command-line parameters into
214one or more breezy operations, and of the results into textual output.
215
216Commands normally don't have any state. All their arguments are passed in to
217the run method. (Subclasses may take a different policy if the behaviour of the
218instance needs to depend on e.g. a shell plugin and not just its Python class.)
219
220The docstring for an actual command should give a single-line summary, then a
221complete description of the command. A grammar description will be inserted.
222
223aliases
224 Other accepted names for this command.
225
226takes_args
227 List of argument forms, marked with whether they are optional,
228 repeated, etc.
229
230 For example: ``['to_location', 'from_branch?', 'file*']`` means:
231
232 * 'to_location' is required
233 * 'from_branch' is optional
234 * 'file' can be specified 0 or more times
235
236takes_options
237 List of options that may be given for this command. These can be either
238 strings, referring to globally-defined options, or option objects.
239 Retrieve through options().
240
241hidden
242 If true, this command isn't advertised. This is typically for commands
243 intended for expert users.
244
245run()
246 Actually run the command. This is invoked with the options and arguments
247 bound to keyword parameters.
248
249 Return 0 or None if the command was successful, or a non-zero shell error
250 code if not. It's OK for this method to allow an exception to raise up.
251
252
253register_command Function
254~~~~~~~~~~~~~~~~~~~~~~~~~
255
256Utility function to help register a command.
257
258param *cmd*
259 Command subclass to register
260
261param *decorate*
262 If true, allow overriding an existing command of the same name; the old
263 command is returned by this function. Otherwise it is an error to try to
264 override an existing command.
0265
=== modified file 'doc/en/_templates/index.html'
--- doc/en/_templates/index.html 2018-11-18 13:17:18 +0000
+++ doc/en/_templates/index.html 2018-11-22 02:24:44 +0000
@@ -45,12 +45,12 @@
45 <p class="biglink"><a class="biglink" href="https://answers.launchpad.net/brz/+faqs">FAQ</a><br/>45 <p class="biglink"><a class="biglink" href="https://answers.launchpad.net/brz/+faqs">FAQ</a><br/>
46 <span class="linkdescr">frequently asked questions</span>46 <span class="linkdescr">frequently asked questions</span>
47 </p>47 </p>
48 <p class="biglink"><a class="biglink" href="http://wiki.bazaar.canonical.com/brzGlossary/">Glossary</a><br/>48 <p class="biglink"><a class="biglink" href="user-reference/glossary-help.html">Glossary</a><br/>
49 <span class="linkdescr">help with terminology</span>49 <span class="linkdescr">help with terminology</span>
50 </p>50 </p>
51 </td>51 </td>
52 <td width="50%">52 <td width="50%">
53 <p class="biglink"><a class="biglink" href="../developers/">Developer Docs</a><br/>53 <p class="biglink"><a class="biglink" href="{{ pathto("developers/index") }}">Developer Docs</a><br/>
54 <span class="linkdescr">improving and extending brz</span>54 <span class="linkdescr">improving and extending brz</span>
55 </p>55 </p>
56 <p class="biglink"><a class="biglink" href="http://doc.bazaar.canonical.com/migration/en/">Migration Docs</a><br/>56 <p class="biglink"><a class="biglink" href="http://doc.bazaar.canonical.com/migration/en/">Migration Docs</a><br/>
5757
=== modified file 'doc/en/tutorials/using_breezy_with_launchpad.txt'
--- doc/en/tutorials/using_breezy_with_launchpad.txt 2018-11-18 13:16:09 +0000
+++ doc/en/tutorials/using_breezy_with_launchpad.txt 2018-11-22 02:24:44 +0000
@@ -410,36 +410,3 @@
410library of 750,000 translated strings, and a community of 19,000410library of 750,000 translated strings, and a community of 19,000
411registered translators can radically cut the time required to411registered translators can radically cut the time required to
412localise your project into many languages.412localise your project into many languages.
413
414
415Summary
416=======
417
418The communities we join, whether off-line or on-line,
419say a lot about the sort of people we are. The flip-side
420to this is that the tools you choose for your community - particularly
421the CDE and version control tool - can have a large impact on who
422joins and how easily they can contribute.
423
424In their own right, Launchpad and Breezy are highly useful tools.
425Together, they can:
426
427* help your community track major assets such as source code and knowledge
428* help it grow by reducing barriers to entry
429* help it interact with related communities.
430
431In particular, Launchpad is a free code hosting service for your Breezy
432branches, branches can be browsed online, branches can be linked to bugs
433and blueprints, and the status of bug-branch relationships can be
434automatically managed by mentioning the bug while committing in Breezy.
435Further integration is under development with the aim of streamlining
436the process from *great idea* to *running code in the hands of end users*.
437
438If you have any feedback on how you'd like to see Breezy and Launchpad
439further integrated, please contact us on the Bazaar mailing list,
440bazaar@lists.canonical.com.
441
442While designed as a free service to support free software projects,
443Canonical may make Launchpad available to commercial software developers
444depending on their requirements. We would be happy to hear from you
445if you think Launchpad would be useful for managing your community.
446413
=== modified file 'doc/en/user-guide/hooks.txt'
--- doc/en/user-guide/hooks.txt 2017-05-21 18:10:28 +0000
+++ doc/en/user-guide/hooks.txt 2018-11-22 02:24:44 +0000
@@ -33,7 +33,7 @@
33 branch.Branch.hooks.install_named_hook('post_push', post_push_hook,33 branch.Branch.hooks.install_named_hook('post_push', post_push_hook,
34 'My post_push hook')34 'My post_push hook')
3535
36.. _write a plugin: http://doc.bazaar.canonical.com/plugins/en/plugin-development.html36.. _write a plugin: ../../developers/plugin-development.html
3737
38To use this example, create a file named ``push_hook.py``, and stick it in38To use this example, create a file named ``push_hook.py``, and stick it in
39``plugins`` subdirectory of your configuration directory. (If you have never39``plugins`` subdirectory of your configuration directory. (If you have never
4040
=== modified file 'doc/en/user-guide/writing_a_plugin.txt'
--- doc/en/user-guide/writing_a_plugin.txt 2017-05-21 18:10:28 +0000
+++ doc/en/user-guide/writing_a_plugin.txt 2018-11-22 02:24:44 +0000
@@ -40,8 +40,8 @@
40Plugin searching rules40Plugin searching rules
41----------------------41----------------------
4242
43Bzr will scan ``~/.bazaar/plugins`` and ``breezy/plugins`` for plugins43Breezy will scan ``~/.config/breezy/plugins`` and ``breezy/plugins`` for
44by default. You can override this with ``BZR_PLUGIN_PATH``44plugins by default. You can override this with ``BRZ_PLUGIN_PATH``
45(see `User Reference 45(see `User Reference
46<../user-reference/configuration-help.html#brz-plugin-path>`_ for details).46<../user-reference/configuration-help.html#brz-plugin-path>`_ for details).
4747
@@ -53,7 +53,7 @@
53More information53More information
54----------------54----------------
5555
56Please feel free to contribute your plugin to BzrTools, if you think it56Please feel free to contribute your plugin to Breezy, if you think it
57would be useful to other people.57would be useful to other people.
5858
59See the `Breezy Developer Guide`_ for details on Breezy's development59See the `Breezy Developer Guide`_ for details on Breezy's development

Subscribers

People subscribed via source and target branches