Rev 5795: Fire config hooks for the actual implementation even if these calls should be deleted in the end. This will help the transition by providing *some* measurements. in file:///home/vila/src/bzr/experimental/config/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Jun 13 07:22:02 UTC 2011
At file:///home/vila/src/bzr/experimental/config/
------------------------------------------------------------
revno: 5795
revision-id: v.ladeuil+lp at free.fr-20110613072202-114pzj2lfshce932
parent: v.ladeuil+lp at free.fr-20110612170137-yew3ljk8odooc1ff
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: config-hooks
timestamp: Mon 2011-06-13 09:22:02 +0200
message:
Fire config hooks for the actual implementation even if these calls should be deleted in the end. This will help the transition by providing *some* measurements.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2011-06-10 13:14:34 +0000
+++ b/bzrlib/config.py 2011-06-13 07:22:02 +0000
@@ -371,6 +371,10 @@
% (option_name,))
else:
value = self._expand_options_in_string(value)
+ for hook in ConfigHooks['get']:
+ # We're lying here pretending to be a Stack until we get deprecated
+ # -- vila 20110610
+ hook(self, option_name, value)
return value
def get_user_option_as_bool(self, option_name, expand=None):
@@ -657,6 +661,10 @@
raise errors.ParseConfigError(e.errors, e.config.filename)
# Make sure self.reload() will use the right file name
self._parser.filename = self.file_name
+ for hook in ConfigHooks['load']:
+ # We're lying here pretending to be a Store until we get deprecated
+ # -- vila 20110610
+ hook(self)
return self._parser
def reload(self):
@@ -665,6 +673,10 @@
raise AssertionError('We need a file name to reload the config')
if self._parser is not None:
self._parser.reload()
+ for hook in ConfigHooks['load']:
+ # We're lying here pretending to be a Store until we get deprecated
+ # -- vila 20110610
+ hook(self)
def _get_matching_sections(self):
"""Return an ordered list of (section_name, extra_path) pairs.
@@ -842,6 +854,10 @@
except KeyError:
raise errors.NoSuchConfigOption(option_name)
self._write_config_file()
+ for hook in ConfigHooks['remove']:
+ # We're lying here pretending to be a Stack until we get deprecated
+ # -- vila 20110610
+ hook(self, name)
def _write_config_file(self):
if self.file_name is None:
@@ -986,7 +1002,10 @@
self.reload()
self._get_parser().setdefault(section, {})[option] = value
self._write_config_file()
-
+ for hook in ConfigHooks['set']:
+ # We're lying here pretending to be a Store until we get deprecated
+ # -- vila 20110610
+ hook(self, name, value)
def _get_sections(self, name=None):
"""See IniBasedConfig._get_sections()."""
@@ -1188,6 +1207,10 @@
# the allowed values of store match the config policies
self._set_option_policy(location, option, store)
self._write_config_file()
+ for hook in ConfigHooks['set']:
+ # We're lying here pretending to be a Store until we get deprecated
+ # -- vila 20110610
+ hook(self, name, value)
class BranchConfig(Config):
More information about the bazaar-commits
mailing list