Rev 5366: Slight rewrite to make the method more readable. in file:///home/vila/src/bzr/bugs/525571-lock-bazaar-conf-files/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Jul 22 09:03:43 BST 2010


At file:///home/vila/src/bzr/bugs/525571-lock-bazaar-conf-files/

------------------------------------------------------------
revno: 5366
revision-id: v.ladeuil+lp at free.fr-20100722080343-e8vtwpooz20qxz03
parent: v.ladeuil+lp at free.fr-20100722080106-2dzh6l5g0n1rf1vc
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: remove-gratuitous-ensure-config-dir-exist-calls
timestamp: Thu 2010-07-22 10:03:43 +0200
message:
  Slight rewrite to make the method more readable.
  
  * bzrlib/config.py:
  (LocationConfig.set_user_option): Simplify.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2010-07-22 08:01:06 +0000
+++ b/bzrlib/config.py	2010-07-22 08:03:43 +0000
@@ -689,15 +689,15 @@
                 (store, option))
         self.reload()
         # FIXME: RBC 20051029 This should take a file lock on locations.conf.
+        parser = self._get_parser()
         location = self.location
         if location.endswith('/'):
             location = location[:-1]
-        if (not location in self._get_parser() and
-            not location + '/' in self._get_parser()):
-            self._get_parser()[location]={}
-        elif location + '/' in self._get_parser():
+        if not location in parser and not location + '/' in parser:
+            parser[location] = {}
+        elif location + '/' in parser:
             location = location + '/'
-        self._get_parser()[location][option]=value
+        parser[location][option]=value
         # the allowed values of store match the config policies
         self._set_option_policy(location, option, store)
         self._write_config_file()



More information about the bazaar-commits mailing list