~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/plugin-api.txt

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
See also
23
23
--------
24
24
 
25
 
 * `Bazaar Developer Documentation Catalog <index.html>`_.
26
 
 * <http://bazaar-vcs.org/WritingPlugins> wiki page with many more
27
 
   suggestions about particular APIs
 
25
 * `Bazaar Developer Documentation Catalog <../index.html>`_.
 
26
 * `Bazaar Plugins Guide <http://doc.bazaar.canonical.com/plugins/en/plugin-development.html>`_ for
 
27
   more suggestions about particular APIs.
28
28
 
29
29
 
30
30
Structure of a plugin
109
109
| bzr_repository_formats | {}      | As bzr_checkout_formats but for        |
110
110
|                        |         | repositories.                          |
111
111
+------------------------+---------+----------------------------------------+
 
112
| bzr_transports         | []      | URL prefixes for which this plugin     |
 
113
|                        |         | will register transports.              |
 
114
+------------------------+---------+----------------------------------------+
112
115
 
113
116
Control Formats
114
117
---------------
125
128
 
126
129
  # (look for a .hg directory)
127
130
  bzr_control_formats = {"Mercurial":{'.hg/': None}}
128
 
  
 
131
 
129
132
  # (look for a file called .svn/format with contents 4\n).
130
133
  bzr_control_formats = {"Subversion":{'.svn/format': '4\n'}}
131
134
 
134
137
-------
135
138
 
136
139
An example setup.py follows::
137
 
  
 
140
 
138
141
  #!/usr/bin/env python2.4
139
142
  from distutils.core import setup
140
 
  
 
143
 
141
144
  bzr_plugin_name = 'demo'
142
145
  bzr_commands = [
143
146
      'new-command',
144
147
      ]
145
 
  
 
148
 
146
149
  bzr_branch_formats = {
147
150
      "Branch label on disk\n":"demo branch",
148
151
      }
149
152
 
150
153
  bzr_control_formats = {"Subversion":{'.svn/format': '4\n'}}
151
 
  
 
154
 
 
155
  bzr_transports = ["hg+ssh://"]
 
156
 
152
157
  bzr_plugin_version = (1, 3, 0, 'dev', 0)
153
158
  bzr_minimum_version = (1, 0, 0)
154
 
  
 
159
 
155
160
  if __name__ == 'main':
156
161
      setup(name="Demo",
157
162
            version="1.3.0dev0",
181
186
short complete sentence summarizing the plugin.  The full docstring is
182
187
shown by ``bzr help PLUGIN_NAME``.
183
188
 
184
 
Remember that to be effective, the module docstring must be the first
185
 
statement in the file.  It may come after comments but it must be before
186
 
any import statements.
 
189
This is a user-visible docstring so should be prefixed with ``__doc__ =``
 
190
to ensure help works under ``python -OO`` with docstrings stripped.
187
191
 
188
192
API version
189
193
-----------
237
241
time other than register or override functions to be called later.
238
242
 
239
243
The plugin can import bzrlib and call any function.
240
 
Some interesting APIs are described in <http://bazaar-vcs.org/WritingPlugins>
 
244
Some interesting APIs are described in `Bazaar Plugins Guide <http://doc.bazaar.canonical.com/plugins/en/plugin-development.html>`_.
241
245
 
242
246
 
243
247
Publishing your plugin
250
254
   <https://launchpad.net/bzr-fastimport>
251
255
   and publish the branches or tarballs there
252
256
 
253
 
 * include the plugin in <http://bazaar-vcs.org/BzrPlugins>
 
257
 * include the plugin in <http://wiki.bazaar.canonical.com/BzrPlugins>
254
258
 
255
259
 * post about it to the ``bazaar-announce`` list at ``lists.canonical.com``
256
260