~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/configuration.txt

  • Committer: Jelmer Vernooij
  • Date: 2012-01-05 16:03:11 UTC
  • mfrom: (6432 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6433.
  • Revision ID: jelmer@samba.org-20120105160311-12o5p67kin1v3zps
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
Adding a new store
129
129
------------------
130
130
 
131
 
 
132
 
 
133
131
The following stores are used by ``bzr`` in ways that illustrate various
134
132
uses of sections.
135
133
 
188
186
  suitable value for the option. If the string cannot be coerced it should
189
187
  return None.
190
188
 
 
189
* override_from_env: a list of environment variables. The first variable set
 
190
  will be used as the option value overriding any other definition of the
 
191
  option.
 
192
 
191
193
* default: the default value that Stack.get() should return if no value can
192
194
  be found for the option. This can also be a callable as long as it returns
193
195
  a unicode string.
207
209
 
208
210
The value of an option is a unicode string or ``None`` if it's not
209
211
defined. By using ``from_unicode`` you can turn this string into a more
210
 
appropriate representation (a list of unicode strings for example).
 
212
appropriate representation.
 
213
 
 
214
If you need a list value, you should use ``ListOption`` instead.
 
215
 
211
216
 
212
217
Sections
213
218
--------
251
256
places to inherit from the existing basic tests and add their own specific
252
257
ones.
253
258
 
 
259
A ``Store`` defines how option values are stored, this includes:
 
260
 
 
261
* defining the sections where the options are grouped,
 
262
 
 
263
* defining how the values are quoted/unquoted for storage purposes. Stacks
 
264
  use the unquoted values internally (default value handling and option
 
265
  expansion are simpler this way) and ``bzr config`` quote them when they
 
266
  need to be displayed.
 
267
 
 
268
 
254
269
Filtering sections
255
270
------------------
256
271
 
327
342
``Stores`` can be used to build them but shouldn't be used otherwise, ditto
328
343
for sections. Again, the associated tests could and should be used against the
329
344
created stacks.
 
345
 
 
346
Also note that ``MemoryStack`` can be used without any disk resources which
 
347
allows for simpler and faster tests. A common pattern is to accept a
 
348
``config`` parameter related to a given feature and test it with predefined
 
349
configurations without involving the whole
 
350
stack. ``bzrlib.tests.test_commit``, ``bzrlib.tests.test_gpg`` and
 
351
``bzrlib.tests.test_smtp_connection`` are good examples.
 
352