~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/HACKING.txt

NEWS section template into a separate file

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
the Bazaar mailing list.  To propose a correction or addition to this
12
12
document, send a merge request or new text to the mailing list.
13
13
 
14
 
The current version of this document is available in the file 
15
 
``doc/developers/HACKING.txt`` in the source tree, or at
16
 
http://doc.bazaar-vcs.org/bzr.dev/en/developer-guide/HACKING.html
17
 
 
18
 
See also:
19
 
`Bazaar Developer Documentation Catalog <../../developers/index.html>`_.
20
 
 
21
 
.. contents::
 
14
The latest developer documentation can be found online at
 
15
http://doc.bazaar-vcs.org/developers/.
22
16
 
23
17
 
24
18
Getting Started
46
40
If nothing else, perhaps you'll find inspiration in how other developers
47
41
have solved their challenges.
48
42
 
 
43
Finding Something To Do
 
44
=======================
 
45
 
 
46
Ad-hoc performance work can also be done. One useful tool is the 'evil' debug
 
47
flag. For instance running ``bzr -Devil commit -m "test"`` will log a backtrace
 
48
to the bzr log file for every method call which triggers a slow or non-scalable
 
49
part of the bzr library. So checking that a given command with ``-Devil`` has
 
50
no backtraces logged to the log file is a good way to find problem function
 
51
calls that might be nested deep in the code base.
49
52
 
50
53
Planning and Discussing Changes
51
54
===============================
73
76
Bazaar Development in a Nutshell
74
77
================================
75
78
 
76
 
Looking for a 10 minute introduction to submitting a change?
77
 
See http://bazaar-vcs.org/BzrGivingBack.
78
 
 
79
 
TODO: Merge that Wiki page into this document.
 
79
.. was from bazaar-vcs.org/BzrGivingBack
 
80
 
 
81
One of the fun things about working on a version control system like Bazaar is
 
82
that the users have a high level of proficiency in contributing back into
 
83
the tool.  Consider the following very brief introduction to contributing back
 
84
to Bazaar.  More detailed instructions are in the following sections.
 
85
 
 
86
Making the change
 
87
-----------------
 
88
 
 
89
First, get a local copy of the development mainline (See `Why make a local
 
90
copy of bzr.dev?`_.) 
 
91
::
 
92
 
 
93
 $ bzr init-repo ~/bzr
 
94
 $ cd ~/bzr
 
95
 $ bzr branch http://bazaar-vcs.org/bzr/bzr.dev/ bzr.dev
 
96
 
 
97
Now make your own branch::
 
98
 
 
99
 $ bzr branch bzr.dev 123456-my-bugfix
 
100
 
 
101
This will give you a branch called "123456-my-bugfix" that you can work on
 
102
and commit in. Here, you can study the code, make a fix or a new feature.
 
103
Feel free to commit early and often (after all, it's your branch!). 
 
104
 
 
105
Documentation improvements are an easy place to get started giving back to the
 
106
Bazaar project.  The documentation is in the `doc/` subdirectory of the Bazaar
 
107
source tree.
 
108
 
 
109
When you are done, make sure that you commit your last set of changes as well!
 
110
Once you are happy with your changes, ask for them to be merged, as described
 
111
below.
 
112
 
 
113
Making a Merge Proposal
 
114
-----------------------
 
115
 
 
116
The Bazaar developers use Launchpad to further enable a truly distributed
 
117
style of development.  Anyone can propose a branch for merging into the Bazaar
 
118
trunk.  To start this process, you need to push your branch to Launchpad.  To
 
119
do this, you will need a Launchpad account and user name, e.g.
 
120
`your_lp_username`.  You can push your branch to Launchpad directly from
 
121
Bazaar::
 
122
 
 
123
  $ bzr push lp:~your_lp_username/bzr/giveback
 
124
 
 
125
After you have pushed your branch, you will need to propose it for merging to
 
126
the Bazaar trunk.  Go to <https://launchpad.net/your_lp_username/bzr/giveback>
 
127
and choose "Propose for merging into another branch".  Select "~bzr/bzr/trunk"
 
128
to hand your changes off to the Bazaar developers for review and merging.
 
129
 
 
130
Why make a local copy of bzr.dev?
 
131
---------------------------------
 
132
 
 
133
Making a local mirror of bzr.dev is not strictly necessary, but it means
 
134
 
 
135
- You can use that copy of bzr.dev as your main bzr executable, and keep it
 
136
  up-to-date using ``bzr pull``.  
 
137
- Certain operations are faster, and can be done when offline.  For example:
 
138
 
 
139
  - ``bzr bundle``
 
140
  - ``bzr diff -r ancestor:...``
 
141
  - ``bzr merge``
 
142
 
 
143
- When it's time to create your next branch, it's more convenient.  When you 
 
144
  have further contributions to make, you should do them in their own branch::
 
145
 
 
146
    $ cd ~/bzr
 
147
    $ bzr branch bzr.dev additional_fixes
 
148
    $ cd additional_fixes # hack, hack, hack
 
149
 
80
150
 
81
151
 
82
152
Understanding the Development Process
83
153
=====================================
84
154
 
85
 
The development team follows many best-practices including:
 
155
The development team follows many practices including:
86
156
 
87
157
* a public roadmap and planning process in which anyone can participate
88
158
 
108
178
For further information, see http://bazaar-vcs.org/BzrDevelopment.
109
179
 
110
180
 
111
 
A Closer Look at the Merge & Review Process
112
 
===========================================
113
 
 
114
 
If you'd like to propose a change, please post to the
115
 
bazaar@lists.canonical.com list with a bundle, patch, or link to a
116
 
branch. Put '[PATCH]' or '[MERGE]' in the subject so Bundle Buggy
117
 
can pick it out, and explain the change in the email message text.
118
 
Remember to update the NEWS file as part of your change if it makes any
119
 
changes visible to users or plugin developers. Please include a diff
120
 
against mainline if you're giving a link to a branch.
121
 
 
122
 
You can generate a bundle like this::
123
 
 
124
 
  bzr bundle > mybundle.patch
125
 
  
126
 
A .patch extension is recommended instead of .bundle as many mail clients
127
 
will send the latter as a binary file. If a bundle would be too long or your
128
 
mailer mangles whitespace (e.g. implicitly converts Unix newlines to DOS
129
 
newlines), use the merge-directive command instead like this::
130
 
 
131
 
  bzr merge-directive http://bazaar-vcs.org http://example.org/my_branch > my_directive.patch
132
 
 
133
 
See the help for details on the arguments to merge-directive.
134
 
 
135
 
Please do **NOT** put [PATCH] or [MERGE] in the subject line if you don't
136
 
want it to be merged. If you want comments from developers rather than
137
 
to be merged, you can put '[RFC]' in the subject line.
138
 
 
139
 
Anyone is welcome to review code.  There are broadly three gates for
140
 
code to get in:
141
 
 
142
 
 * Doesn't reduce test coverage: if it adds new methods or commands,
143
 
   there should be tests for them.  There is a good test framework
144
 
   and plenty of examples to crib from, but if you are having trouble
145
 
   working out how to test something feel free to post a draft patch
146
 
   and ask for help.
147
 
 
148
 
 * Doesn't reduce design clarity, such as by entangling objects
149
 
   we're trying to separate.  This is mostly something the more
150
 
   experienced reviewers need to help check.
151
 
 
152
 
 * Improves bugs, features, speed, or code simplicity.
153
 
 
154
 
Code that goes in should pass all three. The core developers take care
155
 
to keep the code quality high and understandable while recognising that
156
 
perfect is sometimes the enemy of good. (It is easy for reviews to make
157
 
people notice other things which should be fixed but those things should
158
 
not hold up the original fix being accepted. New things can easily be
159
 
recorded in the Bug Tracker instead.)
160
 
 
161
 
Anyone can "vote" on the mailing list. Core developers can also vote using
162
 
Bundle Buggy. Here are the voting codes and their explanations.
163
 
 
164
 
:approve:  Reviewer wants this submission merged.
165
 
:tweak:    Reviewer wants this submission merged with small changes. (No
166
 
  re-review required.)
167
 
:abstain:  Reviewer does not intend to vote on this patch.
168
 
:resubmit: Please make changes and resubmit for review.
169
 
:reject:   Reviewer doesn't want this kind of change merged.
170
 
:comment:  Not really a vote. Reviewer just wants to comment, for now.
171
 
 
172
 
If a change gets two approvals from core reviewers, and no rejections,
173
 
then it's OK to come in.  Any of the core developers can bring it into the
174
 
bzr.dev trunk and backport it to maintenance branches if required.  The
175
 
Release Manager will merge the change into the branch for a pending
176
 
release, if any. As a guideline, core developers usually merge their own
177
 
changes and volunteer to merge other contributions if they were the second
178
 
reviewer to agree to a change.
179
 
 
180
 
To track the progress of proposed changes, use Bundle Buggy. See
181
 
http://bundlebuggy.aaronbentley.com/help for a link to all the
182
 
outstanding merge requests together with an explanation of the columns.
183
 
Bundle Buggy will also mail you a link to track just your change.
184
181
 
185
182
 
186
183
Preparing a Sandbox for Making Changes to Bazaar
199
196
  
200
197
    bzr branch http://bazaar-vcs.org/bzr/bzr.dev/ bzr.dev
201
198
   
202
 
* keep your copy of bzr.dev prestine (by not developing in it) and keep
 
199
* keep your copy of bzr.dev pristine (by not developing in it) and keep
203
200
  it up to date (by using bzr pull)
204
201
 
205
202
* create a new branch off your local bzr.dev copy for each issue
207
204
 
208
205
This approach makes it easy to go back and make any required changes
209
206
after a code review. Resubmitting the change is then simple with no
210
 
risk of accidentially including edits related to other issues you may
 
207
risk of accidentally including edits related to other issues you may
211
208
be working on. After the changes for an issue are accepted and merged,
212
209
the associated branch can be deleted or archived as you wish.
213
210
 
255
252
    is in the ReStructuredText markup language.
256
253
 
257
254
doc/developers 
258
 
    Documentation specifically targetted at Bazaar and plugin developers.
 
255
    Documentation specifically targeted at Bazaar and plugin developers.
259
256
    (Including this document.)
260
257
    
261
258
        
262
259
 
263
260
Automatically-generated API reference information is available at 
264
261
<http://starship.python.net/crew/mwh/bzrlibapi/>.  
265
 
(There is an experimental editable version at 
266
 
<http://starship.python.net/crew/mwh/bzrlibapi-oe/>.)
267
 
See also the `Essential Domain Classes`_
268
 
section of this guide.
269
 
 
270
 
 
271
 
Testing Bazaar
272
 
##############
273
 
 
274
 
The Importance of Testing
275
 
=========================
276
 
 
277
 
Reliability is a critical success factor for any Version Control System.
278
 
We want Bazaar to be highly reliable across multiple platforms while
279
 
evolving over time to meet the needs of its community. 
280
 
 
281
 
In a nutshell, this is want we expect and encourage:
282
 
 
283
 
* New functionality should have test cases.  Preferably write the
284
 
  test before writing the code.
285
 
 
286
 
  In general, you can test at either the command-line level or the
287
 
  internal API level.  See Writing tests below for more detail.
288
 
 
289
 
* Try to practice Test-Driven Development: before fixing a bug, write a
290
 
  test case so that it does not regress.  Similarly for adding a new
291
 
  feature: write a test case for a small version of the new feature before
292
 
  starting on the code itself.  Check the test fails on the old code, then
293
 
  add the feature or fix and check it passes.
294
 
 
295
 
By doing these things, the Bazaar team gets increased confidence that
296
 
changes do what they claim to do, whether provided by the core team or
297
 
by community members. Equally importantly, we can be surer that changes
298
 
down the track do not break new features or bug fixes that you are
299
 
contributing today.
300
 
 
301
 
As of May 2008, Bazaar ships with a test suite containing over 12000 tests
302
 
and growing. We are proud of it and want to remain so. As community
303
 
members, we all benefit from it. Would you trust version control on
304
 
your project to a product *without* a test suite like Bazaar has?
305
 
 
306
 
 
307
 
Running the Test Suite
308
 
======================
309
 
 
310
 
Currently, bzr selftest is used to invoke tests.
311
 
You can provide a pattern argument to run a subset. For example, 
312
 
to run just the blackbox tests, run::
313
 
 
314
 
  ./bzr selftest -v blackbox
315
 
 
316
 
To skip a particular test (or set of tests), use the --exclude option
317
 
(shorthand -x) like so::
318
 
 
319
 
  ./bzr selftest -v -x blackbox  
320
 
 
321
 
To ensure that all tests are being run and succeeding, you can use the
322
 
--strict option which will fail if there are any missing features or known
323
 
failures, like so::
324
 
 
325
 
  ./bzr selftest --strict
326
 
 
327
 
To list tests without running them, use the --list-only option like so::
328
 
 
329
 
  ./bzr selftest --list-only
330
 
 
331
 
This option can be combined with other selftest options (like -x) and
332
 
filter patterns to understand their effect.
333
 
 
334
 
Once you understand how to create a list of tests, you can use the --load-list
335
 
option to run only a restricted set of tests that you kept in a file, one test
336
 
id by line. Keep in mind that this will never be sufficient to validate your
337
 
modifications, you still need to run the full test suite for that, but using it
338
 
can help in some cases (like running only the failed tests for some time)::
339
 
 
340
 
  ./bzr selftest -- load-list my_failing_tests
341
 
 
342
 
This option can also be combined with other selftest options, including
343
 
patterns. It has some drawbacks though, the list can become out of date pretty
344
 
quick when doing Test Driven Development.
345
 
 
346
 
To address this concern, there is another way to run a restricted set of tests:
347
 
the --starting-with option will run only the tests whose name starts with the
348
 
specified string. It will also avoid loading the other tests and as a
349
 
consequence starts running your tests quicker::
350
 
 
351
 
  ./bzr selftest --starting-with bzrlib.blackbox
352
 
 
353
 
This option can be combined with all the other selftest options including
354
 
--load-list. The later is rarely used but allows to run a subset of a list of
355
 
failing tests for example.
356
 
 
357
 
Test suite debug flags
358
 
----------------------
359
 
 
360
 
Similar to the global ``-Dfoo`` debug options, bzr selftest accepts
361
 
``-E=foo`` debug flags.  These flags are:
362
 
 
363
 
:allow_debug: do *not* clear the global debug flags when running a test.
364
 
  This can provide useful logging to help debug test failures when used
365
 
  with e.g. ``bzr -Dhpss selftest -E=allow_debug``
366
 
 
367
 
 
368
 
Writing Tests
369
 
=============
370
 
 
371
 
In general tests should be placed in a file named test_FOO.py where 
372
 
FOO is the logical thing under test. That file should be placed in the
373
 
tests subdirectory under the package being tested.
374
 
 
375
 
For example, tests for merge3 in bzrlib belong in bzrlib/tests/test_merge3.py.
376
 
See bzrlib/tests/test_sampler.py for a template test script.
377
 
 
378
 
Tests can be written for the UI or for individual areas of the library.
379
 
Choose whichever is appropriate: if adding a new command, or a new command 
380
 
option, then you should be writing a UI test.  If you are both adding UI
381
 
functionality and library functionality, you will want to write tests for 
382
 
both the UI and the core behaviours.  We call UI tests 'blackbox' tests
383
 
and they are found in ``bzrlib/tests/blackbox/*.py``. 
384
 
 
385
 
When writing blackbox tests please honour the following conventions:
386
 
 
387
 
 1. Place the tests for the command 'name' in
388
 
    bzrlib/tests/blackbox/test_name.py. This makes it easy for developers
389
 
    to locate the test script for a faulty command.
390
 
 
391
 
 2. Use the 'self.run_bzr("name")' utility function to invoke the command
392
 
    rather than running bzr in a subprocess or invoking the
393
 
    cmd_object.run() method directly. This is a lot faster than
394
 
    subprocesses and generates the same logging output as running it in a
395
 
    subprocess (which invoking the method directly does not).
 
262
 
 
263
See also the `Bazaar Architectural Overview
 
264
<http://doc.bazaar-vcs.org/developers/overview.html>`_.
 
265
 
 
266
 
 
267
The Code Review Process
 
268
#######################
 
269
 
 
270
All code changes coming in to Bazaar are reviewed by someone else.
 
271
Normally changes by core contributors are reviewed by one other core
 
272
developer, and changes from other people are reviewed by two core
 
273
developers.  Use intelligent discretion if the patch is trivial.
 
274
 
 
275
Good reviews do take time. They also regularly require a solid
 
276
understanding of the overall code base. In practice, this means a small
 
277
number of people often have a large review burden - with knowledge comes
 
278
responsibility. No one likes their merge requests sitting in a queue going
 
279
nowhere, so reviewing sooner rather than later is strongly encouraged.
 
280
 
 
281
 
 
282
 
 
283
 
 
284
 
 
285
Review cover letters
 
286
====================
 
287
 
 
288
Please put a "cover letter" on your merge request explaining:
 
289
 
 
290
* the reason **why** you're making this change
 
291
 
 
292
* **how** this change achieves this purpose
 
293
 
 
294
* anything else you may have fixed in passing 
 
295
 
 
296
* anything significant that you thought of doing, such as a more
 
297
  extensive fix or a different approach, but didn't or couldn't do now
 
298
 
 
299
A good cover letter makes reviewers' lives easier because they can decide
 
300
from the letter whether they agree with the purpose and approach, and then
 
301
assess whether the patch actually does what the cover letter says.
 
302
Explaining any "drive-by fixes" or roads not taken may also avoid queries
 
303
from the reviewer.  All in all this should give faster and better reviews.
 
304
Sometimes writing the cover letter helps the submitter realize something
 
305
else they need to do.  The size of the cover letter should be proportional
 
306
to the size and complexity of the patch.
 
307
 
 
308
 
 
309
Reviewing proposed changes
 
310
==========================
 
311
 
 
312
Anyone is welcome to review code, and reply to the thread with their
 
313
opinion or comments.
 
314
 
 
315
The simplest way to review a proposed change is to just read the patch on
 
316
the list or in Bundle Buggy.  For more complex changes it may be useful
 
317
to make a new working tree or branch from trunk, and merge the proposed
 
318
change into it, so you can experiment with the code or look at a wider
 
319
context.
 
320
 
 
321
There are three main requirements for code to get in:
 
322
 
 
323
* Doesn't reduce test coverage: if it adds new methods or commands,
 
324
  there should be tests for them.  There is a good test framework
 
325
  and plenty of examples to crib from, but if you are having trouble
 
326
  working out how to test something feel free to post a draft patch
 
327
  and ask for help.
 
328
 
 
329
* Doesn't reduce design clarity, such as by entangling objects
 
330
  we're trying to separate.  This is mostly something the more
 
331
  experienced reviewers need to help check.
 
332
 
 
333
* Improves bugs, features, speed, or code simplicity.
 
334
 
 
335
Code that goes in should not degrade any of these aspects.  Patches are
 
336
welcome that only cleanup the code without changing the external
 
337
behaviour.  The core developers take care to keep the code quality high
 
338
and understandable while recognising that perfect is sometimes the enemy
 
339
of good. 
 
340
 
 
341
It is easy for reviews to make people notice other things which should be
 
342
fixed but those things should not hold up the original fix being accepted.
 
343
New things can easily be recorded in the Bug Tracker instead.
 
344
 
 
345
It's normally much easier to review several smaller patches than one large
 
346
one.  You might want to use ``bzr-loom`` to maintain threads of related
 
347
work, or submit a preparatory patch that will make your "real" change
 
348
easier.
 
349
 
 
350
 
 
351
Checklist for reviewers
 
352
=======================
 
353
 
 
354
* Do you understand what the code's doing and why?
 
355
 
 
356
* Will it perform reasonably for large inputs, both in memory size and
 
357
  run time?  Are there some scenarios where performance should be
 
358
  measured?
 
359
 
 
360
* Is it tested, and are the tests at the right level?  Are there both
 
361
  blackbox (command-line level) and API-oriented tests?
 
362
 
 
363
* If this change will be visible to end users or API users, is it
 
364
  appropriately documented in NEWS?
 
365
 
 
366
* Does it meet the coding standards below?
 
367
 
 
368
* If it changes the user-visible behaviour, does it update the help
 
369
  strings and user documentation?
 
370
 
 
371
* If it adds a new major concept or standard practice, does it update the
 
372
  developer documentation?
 
373
 
 
374
* (your ideas here...)
 
375
 
 
376
 
 
377
Reviews on Launchpad
 
378
====================
 
379
 
 
380
From May 2009 on, we prefer people to propose code reviews through
 
381
Launchpad.  
 
382
 
 
383
 * <https://launchpad.net/+tour/code-review>
 
384
 
 
385
 * <https://help.launchpad.net/Code/Review>
 
386
 
 
387
Anyone can propose or comment on a merge proposal just by creating a
 
388
Launchpad account.
 
389
 
 
390
There are two ways to create a new merge proposal: through the web
 
391
interface or by email.
 
392
 
 
393
 
 
394
Proposing a merge through the web
 
395
---------------------------------
 
396
 
 
397
To create the proposal through the web, first push your branch to Launchpad.
 
398
For example, a branch dealing with documentation belonging to the Launchpad
 
399
User mbp could be pushed as ::
 
400
 
 
401
  bzr push lp:~mbp/bzr/doc
 
402
 
 
403
Then go to the branch's web page, which in this case would be
 
404
<https://code.launchpad.net/~mbp/bzr/doc>.  You can simplify this step by just
 
405
running ::
396
406
 
397
 
 3. Only test the one command in a single test script. Use the bzrlib 
398
 
    library when setting up tests and when evaluating the side-effects of
399
 
    the command. We do this so that the library api has continual pressure
400
 
    on it to be as functional as the command line in a simple manner, and
401
 
    to isolate knock-on effects throughout the blackbox test suite when a
402
 
    command changes its name or signature. Ideally only the tests for a
403
 
    given command are affected when a given command is changed.
404
 
 
405
 
 4. If you have a test which does actually require running bzr in a
406
 
    subprocess you can use ``run_bzr_subprocess``. By default the spawned
407
 
    process will not load plugins unless ``--allow-plugins`` is supplied.
408
 
 
409
 
 
410
 
Doctests
411
 
--------
412
 
 
413
 
We make selective use of doctests__.  In general they should provide 
414
 
*examples* within the API documentation which can incidentally be tested.  We 
415
 
don't try to test every important case using doctests -- regular Python
416
 
tests are generally a better solution.
417
 
 
418
 
Most of these are in ``bzrlib/doc/api``.  More additions are welcome.
419
 
 
420
 
  __ http://docs.python.org/lib/module-doctest.html
421
 
 
422
 
 
423
 
Skipping tests and test requirements
424
 
------------------------------------
425
 
 
426
 
In our enhancements to unittest we allow for some addition results beyond
427
 
just success or failure.
428
 
 
429
 
If a test can't be run, it can say that it's skipped.  This is typically
430
 
used in parameterized tests - for example if a transport doesn't support
431
 
setting permissions, we'll skip the tests that relating to that.  ::
432
 
 
433
 
    try:
434
 
        return self.branch_format.initialize(repo.bzrdir)
435
 
    except errors.UninitializableFormat:
436
 
        raise tests.TestSkipped('Uninitializable branch format')
437
 
 
438
 
Raising TestSkipped is a good idea when you want to make it clear that the
439
 
test was not run, rather than just returning which makes it look as if it
440
 
was run and passed.
441
 
 
442
 
Several different cases are distinguished:
443
 
 
444
 
TestSkipped
445
 
        Generic skip; the only type that was present up to bzr 0.18.
446
 
 
447
 
TestNotApplicable
448
 
        The test doesn't apply to the parameters with which it was run.
449
 
        This is typically used when the test is being applied to all
450
 
        implementations of an interface, but some aspects of the interface
451
 
        are optional and not present in particular concrete
452
 
        implementations.  (Some tests that should raise this currently
453
 
        either silently return or raise TestSkipped.)  Another option is
454
 
        to use more precise parameterization to avoid generating the test
455
 
        at all.
456
 
 
457
 
TestPlatformLimit
458
 
        **(Not implemented yet)**
459
 
        The test can't be run because of an inherent limitation of the
460
 
        environment, such as not having symlinks or not supporting
461
 
        unicode.
462
 
 
463
 
UnavailableFeature
464
 
        The test can't be run because a dependency (typically a Python
465
 
        library) is not available in the test environment.  These
466
 
        are in general things that the person running the test could fix 
467
 
        by installing the library.  It's OK if some of these occur when 
468
 
        an end user runs the tests or if we're specifically testing in a
469
 
        limited environment, but a full test should never see them.
470
 
 
471
 
KnownFailure
472
 
        The test exists but is known to fail, for example because the 
473
 
        code to fix it hasn't been run yet.  Raising this allows 
474
 
        you to distinguish these failures from the ones that are not 
475
 
        expected to fail.  This could be conditionally raised if something
476
 
        is broken on some platforms but not on others.
477
 
 
478
 
We plan to support three modes for running the test suite to control the
479
 
interpretation of these results.  Strict mode is for use in situations
480
 
like merges to the mainline and releases where we want to make sure that
481
 
everything that can be tested has been tested.  Lax mode is for use by
482
 
developers who want to temporarily tolerate some known failures.  The
483
 
default behaviour is obtained by ``bzr selftest`` with no options, and
484
 
also (if possible) by running under another unittest harness.
485
 
 
486
 
======================= ======= ======= ========
487
 
result                  strict  default lax
488
 
======================= ======= ======= ========
489
 
TestSkipped             pass    pass    pass
490
 
TestNotApplicable       pass    pass    pass
491
 
TestPlatformLimit       pass    pass    pass
492
 
TestDependencyMissing   fail    pass    pass
493
 
KnownFailure            fail    pass    pass
494
 
======================= ======= ======= ========
495
 
     
496
 
 
497
 
Test feature dependencies
 
407
  bzr lp-open
 
408
 
 
409
You can then click "Propose for merging into another branch", and enter your
 
410
cover letter (see above) into the web form.  Typically you'll want to merge
 
411
into ``~bzr/bzr/trunk`` which will be the default; you might also want to
 
412
nominate merging into a release branch for a bug fix.  There is the option to
 
413
specify a specific reviewer or type of review, and you shouldn't normally
 
414
change those.
 
415
 
 
416
Submitting the form takes you to the new page about the merge proposal
 
417
containing the diff of the changes, comments by interested people, and
 
418
controls to comment or vote on the change.
 
419
 
 
420
Proposing a merge by mail
498
421
-------------------------
499
422
 
500
 
Rather than manually checking the environment in each test, a test class
501
 
can declare its dependence on some test features.  The feature objects are
502
 
checked only once for each run of the whole test suite.
503
 
 
504
 
For historical reasons, as of May 2007 many cases that should depend on
505
 
features currently raise TestSkipped.)
506
 
 
507
 
::
508
 
 
509
 
    class TestStrace(TestCaseWithTransport):
510
 
 
511
 
        _test_needs_features = [StraceFeature]
512
 
 
513
 
This means all tests in this class need the feature.  The feature itself
514
 
should provide a ``_probe`` method which is called once to determine if
515
 
it's available.
516
 
 
517
 
These should generally be equivalent to either TestDependencyMissing or
518
 
sometimes TestPlatformLimit.
519
 
 
520
 
 
521
 
Known failures
522
 
--------------
523
 
 
524
 
Known failures are when a test exists but we know it currently doesn't
525
 
work, allowing the test suite to still pass.  These should be used with
526
 
care, we don't want a proliferation of quietly broken tests.  It might be
527
 
appropriate to use them if you've committed a test for a bug but not the
528
 
fix for it, or if something works on Unix but not on Windows.
529
 
 
530
 
 
531
 
Testing exceptions and errors
532
 
-----------------------------
533
 
 
534
 
It's important to test handling of errors and exceptions.  Because this
535
 
code is often not hit in ad-hoc testing it can often have hidden bugs --
536
 
it's particularly common to get NameError because the exception code
537
 
references a variable that has since been renamed.
538
 
 
539
 
.. TODO: Something about how to provoke errors in the right way?
540
 
 
541
 
In general we want to test errors at two levels:
542
 
 
543
 
1. A test in ``test_errors.py`` checking that when the exception object is
544
 
   constructed with known parameters it produces an expected string form.
545
 
   This guards against mistakes in writing the format string, or in the
546
 
   ``str`` representations of its parameters.  There should be one for
547
 
   each exception class.
548
 
 
549
 
2. Tests that when an api is called in a particular situation, it raises
550
 
   an error of the expected class.  You should typically use
551
 
   ``assertRaises``, which in the Bazaar test suite returns the exception
552
 
   object to allow you to examine its parameters.  
553
 
 
554
 
In some cases blackbox tests will also want to check error reporting.  But
555
 
it can be difficult to provoke every error through the commandline
556
 
interface, so those tests are only done as needed -- eg in response to a
557
 
particular bug or if the error is reported in an unusual way(?)  Blackbox
558
 
tests should mostly be testing how the command-line interface works, so
559
 
should only test errors if there is something particular to the cli in how
560
 
they're displayed or handled.
561
 
 
562
 
 
563
 
Testing warnings
564
 
----------------
565
 
 
566
 
The Python ``warnings`` module is used to indicate a non-fatal code
567
 
problem.  Code that's expected to raise a warning can be tested through
568
 
callCatchWarnings.
569
 
 
570
 
The test suite can be run with ``-Werror`` to check no unexpected errors
571
 
occur.
572
 
 
573
 
However, warnings should be used with discretion.  It's not an appropriate
574
 
way to give messages to the user, because the warning is normally shown
575
 
only once per source line that causes the problem.  You should also think
576
 
about whether the warning is serious enought that it should be visible to
577
 
users who may not be able to fix it.
578
 
 
579
 
 
580
 
Interface implementation testing and test scenarios
581
 
---------------------------------------------------
582
 
 
583
 
There are several cases in Bazaar of multiple implementations of a common 
584
 
conceptual interface.  ("Conceptual" because 
585
 
it's not necessary for all the implementations to share a base class,
586
 
though they often do.)  Examples include transports and the working tree,
587
 
branch and repository classes. 
588
 
 
589
 
In these cases we want to make sure that every implementation correctly
590
 
fulfils the interface requirements.  For example, every Transport should
591
 
support the ``has()`` and ``get()`` and ``clone()`` methods.  We have a
592
 
sub-suite of tests in ``test_transport_implementations``.  (Most
593
 
per-implementation tests are in submodules of ``bzrlib.tests``, but not
594
 
the transport tests at the moment.)  
595
 
 
596
 
These tests are repeated for each registered Transport, by generating a
597
 
new TestCase instance for the cross product of test methods and transport
598
 
implementations.  As each test runs, it has ``transport_class`` and
599
 
``transport_server`` set to the class it should test.  Most tests don't
600
 
access these directly, but rather use ``self.get_transport`` which returns
601
 
a transport of the appropriate type.
602
 
 
603
 
The goal is to run per-implementation only tests that relate to that
604
 
particular interface.  Sometimes we discover a bug elsewhere that happens
605
 
with only one particular transport.  Once it's isolated, we can consider 
606
 
whether a test should be added for that particular implementation,
607
 
or for all implementations of the interface.
608
 
 
609
 
The multiplication of tests for different implementations is normally 
610
 
accomplished by overriding the ``test_suite`` function used to load 
611
 
tests from a module.  This function typically loads all the tests,
612
 
then applies a TestProviderAdapter to them, which generates a longer 
613
 
suite containing all the test variations.
614
 
 
615
 
 
616
 
Test scenarios
617
 
--------------
618
 
 
619
 
Some utilities are provided for generating variations of tests.  This can
620
 
be used for per-implementation tests, or other cases where the same test
621
 
code needs to run several times on different scenarios.
622
 
 
623
 
The general approach is to define a class that provides test methods,
624
 
which depend on attributes of the test object being pre-set with the
625
 
values to which the test should be applied.  The test suite should then
626
 
also provide a list of scenarios in which to run the tests.
627
 
 
628
 
Typically ``multiply_tests_from_modules`` should be called from the test
629
 
module's ``test_suite`` function.
630
 
 
631
 
 
632
 
Essential Domain Classes
633
 
########################
634
 
 
635
 
Introducing the Object Model
 
423
To propose a merge by mail, send a bundle to ``merge@code.launchpad.net``.
 
424
 
 
425
You can generate a merge request like this::
 
426
 
 
427
  bzr send -o bug-1234.diff
 
428
  
 
429
``bzr send`` can also send mail directly if you prefer; see the help.
 
430
 
 
431
Reviewing changes
 
432
-----------------
 
433
 
 
434
From <https://code.launchpad.net/bzr/+activereviews> you can see all
 
435
currently active reviews, and choose one to comment on.  This page also
 
436
shows proposals that are now approved and should be merged by someone with
 
437
PQM access.
 
438
 
 
439
 
 
440
Reviews through Bundle Buggy
636
441
============================
637
442
 
638
 
The core domain objects within the bazaar model are:
639
 
 
640
 
* Transport
641
 
 
642
 
* Branch
643
 
 
644
 
* Repository
645
 
 
646
 
* WorkingTree
647
 
 
648
 
Transports are explained below. See http://bazaar-vcs.org/Classes/
649
 
for an introduction to the other key classes.
650
 
 
651
 
Using Transports
652
 
================
653
 
 
654
 
The ``Transport`` layer handles access to local or remote directories.
655
 
Each Transport object acts like a logical connection to a particular
656
 
directory, and it allows various operations on files within it.  You can
657
 
*clone* a transport to get a new Transport connected to a subdirectory or
658
 
parent directory.
659
 
 
660
 
Transports are not used for access to the working tree.  At present
661
 
working trees are always local and they are accessed through the regular
662
 
Python file io mechanisms.
663
 
 
664
 
Filenames vs URLs
665
 
-----------------
666
 
 
667
 
Transports work in URLs.  Take note that URLs are by definition only
668
 
ASCII - the decision of how to encode a Unicode string into a URL must be
669
 
taken at a higher level, typically in the Store.  (Note that Stores also
670
 
escape filenames which cannot be safely stored on all filesystems, but
671
 
this is a different level.)
672
 
 
673
 
The main reason for this is that it's not possible to safely roundtrip a
674
 
URL into Unicode and then back into the same URL.  The URL standard
675
 
gives a way to represent non-ASCII bytes in ASCII (as %-escapes), but
676
 
doesn't say how those bytes represent non-ASCII characters.  (They're not
677
 
guaranteed to be UTF-8 -- that is common but doesn't happen everywhere.)
678
 
 
679
 
For example if the user enters the url ``http://example/%e0`` there's no
680
 
way to tell whether that character represents "latin small letter a with
681
 
grave" in iso-8859-1, or "latin small letter r with acute" in iso-8859-2
682
 
or malformed UTF-8.  So we can't convert their URL to Unicode reliably.
683
 
 
684
 
Equally problematic if we're given a url-like string containing non-ascii
685
 
characters (such as the accented a) we can't be sure how to convert that
686
 
to the correct URL, because we don't know what encoding the server expects
687
 
for those characters.  (Although this is not totally reliable we might still
688
 
accept these and assume they should be put into UTF-8.)
689
 
 
690
 
A similar edge case is that the url ``http://foo/sweet%2Fsour`` contains
691
 
one directory component whose name is "sweet/sour".  The escaped slash is
692
 
not a directory separator.  If we try to convert URLs to regular Unicode
693
 
paths this information will be lost.
694
 
 
695
 
This implies that Transports must natively deal with URLs; for simplicity
696
 
they *only* deal with URLs and conversion of other strings to URLs is done
697
 
elsewhere.  Information they return, such as from ``list_dir``, is also in
698
 
the form of URL components.
699
 
 
 
443
The Bundle Buggy tool used up to May 2009 is still available as a review
 
444
mechanism.
 
445
 
 
446
Sending patches for review
 
447
--------------------------
 
448
 
 
449
If you'd like to propose a change, please post to the
 
450
bazaar@lists.canonical.com list with a bundle, patch, or link to a
 
451
branch. Put ``[PATCH]`` or ``[MERGE]`` in the subject so Bundle Buggy
 
452
can pick it out, and explain the change in the email message text.
 
453
Remember to update the NEWS file as part of your change if it makes any
 
454
changes visible to users or plugin developers. Please include a diff
 
455
against mainline if you're giving a link to a branch.
 
456
 
 
457
You can generate a merge request like this::
 
458
 
 
459
  bzr send -o bug-1234.patch
 
460
  
 
461
A ``.patch`` extension is recommended instead of .bundle as many mail clients
 
462
will send the latter as a binary file.
 
463
 
 
464
``bzr send`` can also send mail directly if you prefer; see the help.
 
465
 
 
466
Please do **NOT** put [PATCH] or [MERGE] in the subject line if you don't
 
467
want it to be merged. If you want comments from developers rather than
 
468
to be merged, you can put ``[RFC]`` in the subject line.
 
469
 
 
470
If this change addresses a bug, please put the bug number in the subject
 
471
line too, in the form ``[#1]`` so that Bundle Buggy can recognize it.
 
472
 
 
473
If the change is intended for a particular release mark that in the
 
474
subject too, e.g. ``[1.6]``.
 
475
Anyone can "vote" on the mailing list by expressing an opinion. Core
 
476
developers can also vote using Bundle Buggy. Here are the voting codes and
 
477
their explanations.
 
478
 
 
479
:approve:  Reviewer wants this submission merged.
 
480
:tweak:    Reviewer wants this submission merged with small changes. (No
 
481
  re-review required.)
 
482
:abstain:  Reviewer does not intend to vote on this patch.
 
483
:resubmit: Please make changes and resubmit for review.
 
484
:reject:   Reviewer doesn't want this kind of change merged.
 
485
:comment:  Not really a vote. Reviewer just wants to comment, for now.
 
486
 
 
487
If a change gets two approvals from core reviewers, and no rejections,
 
488
then it's OK to come in.  Any of the core developers can bring it into the
 
489
bzr.dev trunk and backport it to maintenance branches if required.  The
 
490
Release Manager will merge the change into the branch for a pending
 
491
release, if any. As a guideline, core developers usually merge their own
 
492
changes and volunteer to merge other contributions if they were the second
 
493
reviewer to agree to a change.
 
494
 
 
495
To track the progress of proposed changes, use Bundle Buggy. See
 
496
http://bundlebuggy.aaronbentley.com/help for a link to all the
 
497
outstanding merge requests together with an explanation of the columns.
 
498
Bundle Buggy will also mail you a link to track just your change.
700
499
 
701
500
Coding Style Guidelines
702
501
#######################
723
522
We use 4 space indents for blocks, and never use tab characters.  (In vim,
724
523
``set expandtab``.)
725
524
 
 
525
Trailing white space should be avoided, but is allowed.
 
526
You should however not make lots of unrelated white space changes.
 
527
 
 
528
Unix style newlines (LF) are used.
 
529
 
 
530
Each file must have a newline at the end of it.
 
531
 
726
532
Lines should be no more than 79 characters if at all possible.
727
533
Lines that continue a long statement may be indented in either of 
728
534
two ways:
769
575
        marmalade,
770
576
        )
771
577
 
772
 
There should be spaces between function paramaters, but not between the
 
578
There should be spaces between function parameters, but not between the
773
579
keyword name and the value::
774
580
 
775
581
    call(1, 3, cheese=quark)
891
697
associated information such as a help string or description.
892
698
 
893
699
 
 
700
InterObject and multiple dispatch
 
701
=================================
 
702
 
 
703
The ``InterObject`` provides for two-way `multiple dispatch`__: matching
 
704
up for example a source and destination repository to find the right way
 
705
to transfer data between them. 
 
706
 
 
707
.. __: http://en.wikipedia.org/wiki/Multiple_dispatch
 
708
 
 
709
There is a subclass ``InterObject`` classes for each type of object that is
 
710
dispatched this way, e.g. ``InterRepository``.  Calling ``.get()`` on this
 
711
class will return an ``InterObject`` instance providing the best match for 
 
712
those parameters, and this instance then has methods for operations
 
713
between the objects.
 
714
 
 
715
  inter = InterRepository.get(source_repo, target_repo)
 
716
  inter.fetch(revision_id)
 
717
 
 
718
``InterRepository`` also acts as a registry-like object for its
 
719
subclasses, and they can be added through ``.register_optimizer``.  The
 
720
right one to run is selected by asking each class, in reverse order of
 
721
registration, whether it ``.is_compatible`` with the relevant objects.
 
722
 
894
723
Lazy Imports
895
724
============
896
725
 
1004
833
be better.
1005
834
 
1006
835
 
 
836
Test coverage
 
837
=============
 
838
 
 
839
All code should be exercised by the test suite.  See the `Bazaar Testing
 
840
Guide <http://doc.bazaar-vcs.org/developers/testing.html>`_ for detailed
 
841
information about writing tests.
 
842
 
1007
843
 
1008
844
Core Topics
1009
845
###########
1028
864
_function or ...) behind which forwards to the new API. See the
1029
865
bzrlib.symbol_versioning module for decorators that take care of the
1030
866
details for you - such as updating the docstring, and issuing a warning
1031
 
when the old api is used.
 
867
when the old API is used.
1032
868
 
1033
869
For unsupported API's, it does not hurt to follow this discipline, but it's
1034
870
not required. Minimally though, please try to rename things so that
1127
963
should be only in the command-line tool.
1128
964
 
1129
965
 
 
966
Progress and Activity Indications
 
967
---------------------------------
 
968
 
 
969
bzrlib has a way for code to display to the user that stuff is happening
 
970
during a long operation.  There are two particular types: *activity* which
 
971
means that IO is happening on a Transport, and *progress* which means that
 
972
higher-level application work is occurring.  Both are drawn together by
 
973
the `ui_factory`.
 
974
 
 
975
Transport objects are responsible for calling `report_transport_activity`
 
976
when they do IO.
 
977
 
 
978
Progress uses a model/view pattern: application code acts on a
 
979
`ProgressTask` object, which notifies the UI when it needs to be
 
980
displayed.  Progress tasks form a stack.  To create a new progress task on
 
981
top of the stack, call `bzrlib.ui.ui_factory.nested_progress_bar()`, then
 
982
call `update()` on the returned ProgressTask.  It can be updated with just
 
983
a text description, with a numeric count, or with a numeric count and
 
984
expected total count.  If an expected total count is provided the view
 
985
can show the progress moving along towards the expected total.
 
986
 
 
987
The user should call `finish` on the `ProgressTask` when the logical
 
988
operation has finished, so it can be removed from the stack.
 
989
 
 
990
Progress tasks have a complex relationship with generators: it's a very
 
991
good place to use them, but because python2.4 does not allow ``finally``
 
992
blocks in generators it's hard to clean them up properly.  In this case
 
993
it's probably better to have the code calling the generator allocate a
 
994
progress task for its use and then call `finalize` when it's done, which
 
995
will close it if it was not already closed.  The generator should also
 
996
finish the progress task when it exits, because it may otherwise be a long
 
997
time until the finally block runs.
 
998
 
1130
999
 
1131
1000
Displaying help
1132
1001
===============
1145
1014
sentences.
1146
1015
 
1147
1016
 
1148
 
Writing tests
1149
 
=============
1150
 
 
1151
 
In general tests should be placed in a file named test_FOO.py where 
1152
 
FOO is the logical thing under test. That file should be placed in the
1153
 
tests subdirectory under the package being tested.
1154
 
 
1155
 
For example, tests for merge3 in bzrlib belong in bzrlib/tests/test_merge3.py.
1156
 
See bzrlib/tests/test_sampler.py for a template test script.
1157
 
 
1158
 
Tests can be written for the UI or for individual areas of the library.
1159
 
Choose whichever is appropriate: if adding a new command, or a new command 
1160
 
option, then you should be writing a UI test.  If you are both adding UI
1161
 
functionality and library functionality, you will want to write tests for 
1162
 
both the UI and the core behaviours.  We call UI tests 'blackbox' tests
1163
 
and they are found in ``bzrlib/tests/blackbox/*.py``. 
1164
 
 
1165
 
When writing blackbox tests please honour the following conventions:
1166
 
 
1167
 
 1. Place the tests for the command 'name' in
1168
 
    bzrlib/tests/blackbox/test_name.py. This makes it easy for developers
1169
 
    to locate the test script for a faulty command.
1170
 
 
1171
 
 2. Use the 'self.run_bzr("name")' utility function to invoke the command
1172
 
    rather than running bzr in a subprocess or invoking the
1173
 
    cmd_object.run() method directly. This is a lot faster than
1174
 
    subprocesses and generates the same logging output as running it in a
1175
 
    subprocess (which invoking the method directly does not).
1176
 
 
1177
 
 3. Only test the one command in a single test script. Use the bzrlib 
1178
 
    library when setting up tests and when evaluating the side-effects of
1179
 
    the command. We do this so that the library api has continual pressure
1180
 
    on it to be as functional as the command line in a simple manner, and
1181
 
    to isolate knock-on effects throughout the blackbox test suite when a
1182
 
    command changes its name or signature. Ideally only the tests for a
1183
 
    given command are affected when a given command is changed.
1184
 
 
1185
 
 4. If you have a test which does actually require running bzr in a
1186
 
    subprocess you can use ``run_bzr_subprocess``. By default the spawned
1187
 
    process will not load plugins unless ``--allow-plugins`` is supplied.
1188
 
 
1189
 
 
1190
 
Test support
1191
 
------------
1192
 
 
1193
 
We have a rich collection of tools to support writing tests. Please use
1194
 
them in preference to ad-hoc solutions as they provide portability and
1195
 
performance benefits.
1196
 
 
1197
 
TreeBuilder
1198
 
~~~~~~~~~~~
1199
 
 
1200
 
The ``TreeBuilder`` interface allows the construction of arbitrary trees
1201
 
with a declarative interface. A sample session might look like::
1202
 
 
1203
 
  tree = self.make_branch_and_tree('path')
1204
 
  builder = TreeBuilder()
1205
 
  builder.start_tree(tree)
1206
 
  builder.build(['foo', "bar/", "bar/file"])
1207
 
  tree.commit('commit the tree')
1208
 
  builder.finish_tree()
1209
 
 
1210
 
Please see bzrlib.treebuilder for more details.
1211
 
 
1212
 
BranchBuilder
1213
 
~~~~~~~~~~~~~
1214
 
 
1215
 
The ``BranchBuilder`` interface allows the creation of test branches in a
1216
 
quick and easy manner. A sample session::
1217
 
 
1218
 
  builder = BranchBuilder(self.get_transport().clone('relpath'))
1219
 
  builder.build_commit()
1220
 
  builder.build_commit()
1221
 
  builder.build_commit()
1222
 
  branch = builder.get_branch()
1223
 
 
1224
 
Please see bzrlib.branchbuilder for more details.
1225
 
 
1226
 
Doctests
1227
 
--------
1228
 
 
1229
 
We make selective use of doctests__.  In general they should provide 
1230
 
*examples* within the API documentation which can incidentally be tested.  We 
1231
 
don't try to test every important case using doctests -- regular Python
1232
 
tests are generally a better solution.
1233
 
 
1234
 
Most of these are in ``bzrlib/doc/api``.  More additions are welcome.
1235
 
 
1236
 
  __ http://docs.python.org/lib/module-doctest.html
1237
 
 
1238
 
 
1239
 
Running tests
1240
 
=============
1241
 
Currently, bzr selftest is used to invoke tests.
1242
 
You can provide a pattern argument to run a subset. For example, 
1243
 
to run just the blackbox tests, run::
1244
 
 
1245
 
  ./bzr selftest -v blackbox
1246
 
 
1247
 
To skip a particular test (or set of tests), use the --exclude option
1248
 
(shorthand -x) like so::
1249
 
 
1250
 
  ./bzr selftest -v -x blackbox  
1251
 
 
1252
 
To list tests without running them, use the --list-only option like so::
1253
 
 
1254
 
  ./bzr selftest --list-only
1255
 
 
1256
 
This option can be combined with other selftest options (like -x) and
1257
 
filter patterns to understand their effect.
1258
 
 
1259
 
 
1260
1017
Handling Errors and Exceptions
1261
1018
==============================
1262
1019
 
1305
1062
that exception specifically, or when it needs a substantially different
1306
1063
format string.
1307
1064
 
 
1065
#. If it is something that a caller can recover from, a custom exception
 
1066
   is reasonable. 
 
1067
 
 
1068
#. If it is a data consistency issue, using a builtin like
 
1069
   ``ValueError``/``TypeError`` is reasonable. 
 
1070
 
 
1071
#. If it is a programmer error (using an api incorrectly)
 
1072
   ``AssertionError`` is reasonable. 
 
1073
 
 
1074
#. Otherwise, use ``BzrError`` or ``InternalBzrError``.
 
1075
 
1308
1076
Exception strings should start with a capital letter and should not have a
1309
1077
final fullstop.  If long, they may contain newlines to break the text.
1310
1078
 
1464
1232
then bzr will go into pdb post-mortem mode when an unhandled exception
1465
1233
occurs.
1466
1234
 
1467
 
If you send a SIGQUIT signal to bzr, which can be done by pressing
1468
 
Ctrl-\\ on Unix, bzr will go into the debugger immediately.  You can
1469
 
continue execution by typing ``c``.  This can be disabled if necessary
1470
 
by setting the environment variable ``BZR_SIGQUIT_PDB=0``.
 
1235
If you send a SIGQUIT or SIGBREAK signal to bzr then it will drop into the
 
1236
debugger immediately. SIGQUIT can be generated by pressing Ctrl-\\ on
 
1237
Unix.  SIGBREAK is generated with Ctrl-Pause on Windows (some laptops have
 
1238
this as Fn-Pause).  You can continue execution by typing ``c``.  This can
 
1239
be disabled if necessary by setting the environment variable
 
1240
``BZR_SIGQUIT_PDB=0``.
 
1241
 
 
1242
 
 
1243
Debug Flags
 
1244
===========
 
1245
 
 
1246
Bazaar accepts some global options starting with ``-D`` such as
 
1247
``-Dhpss``.  These set a value in `bzrlib.debug.debug_flags`, and
 
1248
typically cause more information to be written to the trace file.  Most
 
1249
`mutter` calls should be guarded by a check of those flags so that we
 
1250
don't write out too much information if it's not needed.
 
1251
 
 
1252
Debug flags may have effects other than just emitting trace messages.
 
1253
 
 
1254
Run ``bzr help global-options`` to see them all.
 
1255
 
 
1256
These flags may also be set as a comma-separated list in the
 
1257
``debug_flags`` option in e.g.  ``~/.bazaar/bazaar.conf``.  (Note that it
 
1258
must be in this global file, not in the branch or location configuration,
 
1259
because it's currently only loaded at startup time.)  For instance you may
 
1260
want to always record hpss traces and to see full error tracebacks::
 
1261
 
 
1262
    debug_flags = hpss, error
1471
1263
 
1472
1264
 
1473
1265
Jargon
1509
1301
    Attempting to print an unprintable character will cause a UnicodeError.
1510
1302
    This is for commands that are intended more as scripting support, rather
1511
1303
    than plain user review.
1512
 
    For exampl: ``bzr ls`` is designed to be used with shell scripting. One
1513
 
    use would be ``bzr ls --null --unknows | xargs -0 rm``.  If ``bzr``
 
1304
    For example: ``bzr ls`` is designed to be used with shell scripting. One
 
1305
    use would be ``bzr ls --null --unknowns | xargs -0 rm``.  If ``bzr``
1514
1306
    printed a filename with a '?', the wrong file could be deleted. (At the
1515
1307
    very least, the correct file would not be deleted). An error is used to
1516
1308
    indicate that the requested action could not be performed.
1607
1399
* reviewing changes
1608
1400
* reviewing blueprints
1609
1401
* planning releases
1610
 
* managing releases (see the `Releasing Bazaar <../../developers/releasing.html>`_)
 
1402
* managing releases (see `Releasing Bazaar <http://doc.bazaar-vcs.org/developers/releasing.html>`_)
1611
1403
 
1612
1404
.. note::
1613
1405
  Removing barriers to community participation is a key reason for adopting
1650
1442
how to set it up and configure it.
1651
1443
 
1652
1444
 
1653
 
Reviewing Changes
1654
 
=================
1655
 
 
1656
 
Setting Up Your Workspace for Reviews
1657
 
-------------------------------------
1658
 
 
1659
 
TODO: Incorporate John Arbash Meinel's detailed email to Ian C on the
1660
 
numerous ways of setting up integration branches.
1661
 
 
1662
 
 
1663
 
The Review Checklist
1664
 
--------------------
1665
 
 
1666
 
See `A Closer Look at the Merge & Review Process`_
1667
 
for information on the gates used to decide whether code can be merged
1668
 
or not and details on how review results are recorded and communicated.
1669
 
 
1670
 
 
1671
 
The Importance of Timely Reviews
1672
 
--------------------------------
1673
 
 
1674
 
Good reviews do take time. They also regularly require a solid
1675
 
understanding of the overall code base. In practice, this means a small
1676
 
number of people often have a large review burden - with knowledge comes
1677
 
responsibility. No one like their merge requests sitting in a queue going
1678
 
nowhere, so reviewing sooner rather than later is strongly encouraged.
1679
 
 
1680
 
 
1681
1445
Submitting Changes
1682
1446
==================
1683
1447
 
1843
1607
https://blueprints.launchpad.net/bzr/. Once a blueprint for ready for
1844
1608
review, please announce it on the mailing list.
1845
1609
 
1846
 
Alternatively, send an email begining with [RFC] with the proposal to the
 
1610
Alternatively, send an email beginning with [RFC] with the proposal to the
1847
1611
list. In some cases, you may wish to attach proposed code  or a proposed
1848
1612
developer document if that best communicates the idea. Debate can then
1849
1613
proceed using the normal merge review processes.
1861
1625
Planning Releases
1862
1626
=================
1863
1627
 
1864
 
Roadmaps
1865
 
--------
1866
 
 
1867
 
As the two senior developers, Martin Pool and Robert Collins coordinate
1868
 
the overall Bazaar product development roadmap. Core developers provide
1869
 
input and review into this, particularly during sprints. It's totally
1870
 
expected that community members ought to be working on things that
1871
 
interest them the most. The roadmap is valuable though because it provides
1872
 
context for understanding where the product is going as a whole and why.
1873
 
 
1874
1628
 
1875
1629
Using Releases and Milestones in Launchpad
1876
1630
------------------------------------------