Rev 5766: This put a common processing into the loop to avoid bad inputs. The in file:///home/vila/src/bzr/experimental/config/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Thu Apr 7 15:08:17 UTC 2011
At file:///home/vila/src/bzr/experimental/config/
------------------------------------------------------------
revno: 5766
revision-id: v.ladeuil+lp at free.fr-20110407150817-99lkxiu746wo9vaj
parent: v.ladeuil+lp at free.fr-20110407150513-rshmyf6a1c2jkbgs
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: refactor-locationconfig-matching
timestamp: Thu 2011-04-07 17:08:17 +0200
message:
This put a common processing into the loop to avoid bad inputs. The
location and the section should really be handled in the same way and
separating this processing between the caller and the callee is likely to
bitrot.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2011-04-07 15:05:13 +0000
+++ b/bzrlib/config.py 2011-04-07 15:08:17 +0000
@@ -967,7 +967,9 @@
super(LockableConfig, self).remove_user_option(option_name,
section_name)
-def _match_section_by_parts(section, location, location_parts):
+def _match_section_by_parts(section, location):
+ location_parts = location.rstrip('/').split('/')
+
# location is a local path if possible, so we need
# to convert 'file://' urls to local paths if necessary.
@@ -1043,12 +1045,10 @@
def _get_matching_sections(self):
"""Return an ordered list of section names matching this location."""
sections = self._get_parser()
- location_parts = self.location.rstrip('/').split('/')
matches = []
for section in sections:
- match = _match_section_by_parts(section, self.location,
- location_parts)
+ match = _match_section_by_parts(section, self.location)
if match is None:
continue
nb_parts, relpath = match
More information about the bazaar-commits
mailing list