21
21
core improvements should be tested closer to the code that is doing the
22
22
work. Command line level tests should be placed in 'blackbox.py'.
24
* Try to practice Test-Driven Development. before fixing a bug, write a
25
test case so that it does not regress. Similarly for adding a new
26
feature: write a test case for a small version of the new feature before
27
starting on the code itself. Check the test fails on the old code, then
28
add the feature or fix and check it passes.
24
* Before fixing a bug, write a test case so that it does not regress.
30
26
* Exceptions should be defined inside bzrlib.errors, so that we can
31
27
see the whole tree at a glance.
38
34
* Module names should always be given fully-qualified,
39
35
i.e. ``bzrlib.hashcache`` not just ``hashcache``.
41
* Commands should return non-zero when they encounter circumstances that
42
the user should really pay attention to - which includes trivial shell
45
Recommended values are
47
1- Conflicts in merge-like operations, or changes are present in
49
2- Unrepresentable diff changes (i.e. binary files that we cannot show
51
3- An error or exception has occurred.
53
37
Evolving interfaces
54
38
-------------------
57
41
be sure to change its name as well. For instance, if I add a keyword
58
42
parameter to branch.commit - that's fine. On the other hand, if I add
59
43
a keyword parameter to branch.commit which is a *required* transaction
60
object, I should rename the API - i.e. to 'branch.commit_transaction'.
44
object, I should rename the api - i.e. to 'branch.commit_transaction'.
62
This will prevent users of the old API getting surprising results.
63
Instead, they will get an Attribute error as the API is missing, and
46
This will prevent users of the old api getting surprising results.
47
Instead, they will get an Attribute error as the api is missing, and
64
48
will know to update their code. If in doubt, just ask on #bzr.
69
53
If you change the behaviour of a command, please update its docstring
70
54
in bzrlib/commands.py. This is displayed by the 'bzr help' command.
75
56
If you make a user-visible change, please add a note to the NEWS file.
76
57
The description should be written to make sense to someone who's just
77
58
a user of bzr, not a developer: new functions or classes shouldn't be
79
60
bugs should be listed. See the existing entries for an idea of what
82
Within each release, entries in the news file should have the most
83
user-visible changes first. So the order should be approximately:
85
* changes to existing behaviour - the highest priority because the
86
user's existing knowledge is incorrect
87
* new features - should be brought to their attention
88
* bug fixes - may be of interest if the bug was affecting them, and
89
should include the bug number if any
90
* major documentation changes
91
* changes to internal interfaces
93
People who made significant contributions to each change are listed in
94
parenthesis. This can include reporting bugs (particularly with good
95
details or reproduction recipes), submitting patches, etc.
152
119
(not ``x2y`` as occurs in some old code.)
158
Python destructors (``__del__``) work differently to those of other
159
languages. In particular, bear in mind that destructors may be called
160
immediately when the object apparently becomes unreferenced, or at some
161
later time, or possibly never at all. Therefore we have restrictions on
162
what can be done inside them.
164
0. Never use a __del__ method without asking Martin/Robert first.
166
1. Never rely on a ``__del__`` method running. If there is code that
167
must run, do it from a ``finally`` block instead.
169
2. Never ``import`` from inside a ``__del__`` method, or you may crash the
172
3. In some places we raise a warning from the destructor if the object
173
has not been cleaned up or closed. This is considered OK: the warning
174
may not catch every case but it's still useful sometimes.
246
188
Integer identifier for a revision on the main line of a branch.
247
189
Revision 0 is always the null revision; others are 1-based
248
190
indexes into the branch's revision history.
254
If you'd like to propose a change, please post to the
255
bazaar-ng@lists.canonical.com list with a patch, bzr changeset, or link to a
256
branch. Please put '[patch]' in the subject so we can pick them out, and
257
include some text explaining the change. Remember to put an update to the NEWS
258
file in your diff, if it makes any changes visible to users or plugin
259
developers. Please include a diff against mainline if you're giving a link to
262
Please indicate if you think the code is ready to merge, or if it's just a
263
draft or for discussion. If you want comments from many developers rather than
264
to be merged, you can put '[rfc]' in the subject lines.
266
Anyone is welcome to review code. There are broadly three gates for
269
* Doesn't reduce test coverage: if it adds new methods or commands,
270
there should be tests for them. There is a good test framework
271
and plenty of examples to crib from, but if you are having trouble
272
working out how to test something feel free to post a draft patch
275
* Doesn't reduce design clarity, such as by entangling objects
276
we're trying to separate. This is mostly something the more
277
experienced reviewers need to help check.
279
* Improves bugs, features, speed, or code simplicity.
281
Code that goes in should pass all three.
283
If you read a patch please reply and say so. We can use a numeric scale
284
of -1, -0, +0, +1, meaning respectively "really don't want it in current
285
form", "somewhat uncomfortable", "ok with me", and "please put it in".
286
Anyone can "vote". (It's not really voting, just a terse expression.)
288
If something gets say two +1 votes from core reviewers, and no
289
vetos, then it's OK to come in. Any of the core developers can bring it
290
into their integration branch, which I'll merge regularly. (If you do
291
so, please reply and say so.)