1
1
============================
2
guidelines for modifying bzr
2
Guidelines for modifying bzr
3
3
============================
7
(The current version of this document is available in the file ``HACKING``
8
in the source tree, or at http://bazaar-ng.org/hacking.html)
5
13
* New functionality should have test cases. Preferably write the
6
14
test before writing the code.
20
28
function runs. Import statements have a cost, so try to make sure
21
29
they don't run inside hot functions.
23
* Please write PEP-8__ compliant code.
25
One often-missed requirement is that the first line of docstrings
26
should be a self-contained one-sentence summary.
28
__ http://www.python.org/peps/pep-0008.html
30
31
* Module names should always be given fully-qualified,
31
32
i.e. ``bzrlib.hashcache`` not just ``hashcache``.
53
Functions, methods, classes and modules should have docstrings
54
describing how they are used.
56
The first line of the docstring should be a self-contained sentence.
58
For the special case of Command classes, this acts as the user-visible
59
documentation shown by the help command.
61
The docstrings should be formatted as reStructuredText_ (like this
62
document), suitable for processing using the epydoc_ tool into HTML
65
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
66
.. _epydoc: http://epydoc.sourceforge.net/
73
Please write PEP-8__ compliant code.
75
One often-missed requirement is that the first line of docstrings
76
should be a self-contained one-sentence summary.
78
__ http://www.python.org/peps/pep-0008.html
85
Functions, methods or members that are in some sense "private" are given
86
a leading underscore prefix. This is just a hint that code outside the
87
implementation should probably not use that interface.
89
We prefer class names to be concatenated capital words (``TestCase``)
90
and variables, methods and functions to be lowercase words joined by
91
underscores (``revision_id``, ``get_revision``).
93
For the purposes of naming some names are treated as single compound
94
words: "filename", "revno".
96
Consider naming classes as nouns and functions/methods as verbs.
102
``revision_id`` not ``rev_id`` or ``revid``
104
Functions that transform one thing to another should be named ``x_to_y``
105
(not ``x2y`` as occurs in some old code.)
97
155
You can provide a pattern argument to run a subset. For example,
98
156
to run just the whitebox tests, run bzr selftest --pattern .*whitebox.*
163
Integer identifier for a revision on the main line of a branch.
164
Revision 0 is always the null revision; others are 1-based
165
indexes into the branch's revision history.