Rev 6410: Feedback from review. in file:///home/vila/src/bzr/bugs/832046-globs-store-ordered/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Jan 4 17:42:22 UTC 2012


At file:///home/vila/src/bzr/bugs/832046-globs-store-ordered/

------------------------------------------------------------
revno: 6410
revision-id: v.ladeuil+lp at free.fr-20120104174222-tdt031gd262sh1f2
parent: v.ladeuil+lp at free.fr-20120103101900-b4xcrced6mitukhj
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 832046-globs-store-ordered
timestamp: Wed 2012-01-04 18:42:22 +0100
message:
  Feedback from review.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2012-01-03 10:19:00 +0000
+++ b/bzrlib/config.py	2012-01-04 17:42:22 +0000
@@ -3352,6 +3352,14 @@
 class StartingPathMatcher(SectionMatcher):
     """Select sections for a given location respecting the Store order."""
 
+    # FIXME: Both local paths and urls can be used for section names as well as
+    # ``location`` to stay consistent with ``LocationMatcher`` which itself
+    # inherited the fuzziness from the previous ``LocationConfig``
+    # implementation. We probably need to revisit which encoding is allowed for
+    # both ``location`` and section names and how we normalize
+    # them. http://pad.lv/85479, http://pad.lv/437009 and http://359320 are
+    # related too. -- vila 2012-01-04
+
     def __init__(self, store, location):
         super(StartingPathMatcher, self).__init__(store)
         if location.startswith('file://'):

=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2012-01-03 10:19:00 +0000
+++ b/bzrlib/tests/test_config.py	2012-01-04 17:42:22 +0000
@@ -3321,6 +3321,23 @@
     def test_empty(self):
         self.assertSectionIDs([], self.get_url(), '')
 
+    def test_url_vs_local_paths(self):
+        # The matcher location is an url and the section names are local paths
+        sections = self.assertSectionIDs(['/foo/bar', '/foo'],
+                                         'file:///foo/bar/baz', '''\
+[/foo]
+[/foo/bar]
+''')
+
+    def test_local_path_vs_url(self):
+        # The matcher location is a local path and the section names are urls
+        sections = self.assertSectionIDs(['file:///foo/bar', 'file:///foo'],
+                                         '/foo/bar/baz', '''\
+[file:///foo]
+[file:///foo/bar]
+''')
+
+
     def test_no_name_section_included_when_present(self):
         # Note that other tests will cover the case where the no-name section
         # is empty and as such, not included.
@@ -3355,8 +3372,8 @@
 [/foo/*/baz]
 ''')
         # Note that 'baz' as a relpath for /foo/b* is not fully correct, but
-        # nothing really does... as far using {relpath} to append it to
-        # something else, this seems good enough though.
+        # nothing really is... as far using {relpath} to append it to something
+        # else, this seems good enough though.
         self.assertEquals(['', 'baz', 'bar/baz'],
                           [s.locals['relpath'] for _, s in sections])
 



More information about the bazaar-commits mailing list