Rev 5768: Merge config-abstract-store into config-concrete-stores in file:///home/vila/src/bzr/experimental/config/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Apr 8 15:55:24 UTC 2011


At file:///home/vila/src/bzr/experimental/config/

------------------------------------------------------------
revno: 5768 [merge]
revision-id: v.ladeuil+lp at free.fr-20110408155524-7sqasvz182jwtlt3
parent: v.ladeuil+lp at free.fr-20110408132752-3buc4aay7txe6ln7
parent: v.ladeuil+lp at free.fr-20110408155502-9ojf971rtcrwnr9s
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: config-concrete-stores
timestamp: Fri 2011-04-08 17:55:24 +0200
message:
  Merge config-abstract-store into config-concrete-stores
added:
  doc/developers/configuration.txt configuration.txt-20110408142435-korjxxnskvq44sta-1
modified:
  bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
  bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
  doc/developers/index.txt       index.txt-20070508041241-qznziunkg0nffhiw-1
  doc/en/user-guide/configuring_bazaar.txt configuring_bazaar.t-20071128000722-ncxiua259xwbdbg7-1
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2011-04-08 13:27:52 +0000
+++ b/bzrlib/config.py	2011-04-08 15:55:24 +0000
@@ -2112,7 +2112,7 @@
         return self.options.get(name, default)
 
 
-_Created = object()
+_NewlyCreatedOption = object()
 """Was the option created during the MutableSection lifetime"""
 
 
@@ -2126,7 +2126,7 @@
     def set(self, name, value):
         if name not in self.options:
             # This is a new option
-            self.orig[name] = _Created
+            self.orig[name] = _NewlyCreatedOption
         elif name not in self.orig:
             self.orig[name] = self.get(name, None)
         self.options[name] = value
@@ -2261,6 +2261,12 @@
         return MutableSection(section_name, section)
 
 
+# Note that LockableConfigObjStore inherits from ConfigObjStore because we need
+# unlockable stores for use with objects that can already ensure the locking
+# (think branches). If different stores (not based on ConfigObj) are created,
+# they may face the same issue.
+
+
 class LockableConfigObjStore(ConfigObjStore):
     """A ConfigObjStore using locks on save to ensure store integrity."""
 

=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2011-04-07 20:55:00 +0000
+++ b/bzrlib/tests/test_config.py	2011-04-08 15:55:24 +0000
@@ -1887,7 +1887,7 @@
         # The option didn't exist initially so it we need to keep track of it
         # with a special value
         self.assertTrue('foo' in section.orig)
-        self.assertEquals(config._Created, section.orig['foo'])
+        self.assertEquals(config._NewlyCreatedOption, section.orig['foo'])
 
 
 def get_ConfigObjStore(transport, file_name, content=None):

=== added file 'doc/developers/configuration.txt'
--- a/doc/developers/configuration.txt	1970-01-01 00:00:00 +0000
+++ b/doc/developers/configuration.txt	2011-04-08 15:55:02 +0000
@@ -0,0 +1,44 @@
+Configuring Bazaar
+==================
+
+A configuration option has:
+
+- a name: a valid python identifier (even if it's not used as an
+  identifier in python itself)
+
+- a value: a unicode string
+
+Sections
+--------
+
+Options are grouped into sections which share some properties with the well
+known dict objects:
+
+- the key is the name,
+- you can get, set and remove an option,
+- the value is a unicode string.
+
+MutableSection are needed to set or remove an option, ReadOnlySection should
+be used otherwise.
+
+Stores
+------
+
+Options can persistent in which case they are saved into Stores.
+
+``config.Store`` defines the abstract interface that all stores should
+implement.
+
+This object doesn't provide a direct access to the options, it only provides
+access to Sections. This is deliberate to ensure that sections can be properly
+shared by reusing the same underlying objects. Accessing options should be
+done via the ``Section`` objects.
+
+A ``Store`` can contain one or more sections, each section is uniquely
+identified by a unicode string.
+
+``config.ConfigObjStore`` is an implementation that use ``ConfigObj``.
+
+Depending on the object it is associated with (or not) a ``Store`` also needs
+to implement a locking mechanism. ``LockableConfigObjStore`` implements such a
+mechanism for ``ConfigObj`` based stores.

=== modified file 'doc/developers/index.txt'
--- a/doc/developers/index.txt	2011-01-06 06:26:23 +0000
+++ b/doc/developers/index.txt	2011-04-08 14:59:29 +0000
@@ -36,9 +36,10 @@
 .. toctree::
    :maxdepth: 1
 
+   configuration
+   fetch
    transports
    ui
-   fetch
 
 Releasing and Packaging
 =======================

=== modified file 'doc/en/user-guide/configuring_bazaar.txt'
--- a/doc/en/user-guide/configuring_bazaar.txt	2011-02-07 01:39:42 +0000
+++ b/doc/en/user-guide/configuring_bazaar.txt	2011-04-08 14:59:29 +0000
@@ -37,6 +37,24 @@
 which shouldn't be reached by the proxy.  (See
 <http://docs.python.org/library/urllib.html> for more details.)
 
+Various ways to configure
+-------------------------
+
+As shown in the example above, there are various ways to
+configure Bazaar, they all share some common properties though,
+an option has:
+
+- a name which is generally a valid python identifier,
+
+- a value which is a string. In some cases, Bazzar will be able
+  to recognize special values like 'True', 'False' to infer a
+  boolean type, but basically, as a user, you will always specify
+  a value as a string.
+
+Options are grouped in various contexts so their name uniquely
+identify them in this context. When needed, options can be made
+persistent by recording them in a configuration file.
+
 
 Configuration files
 -------------------



More information about the bazaar-commits mailing list