Rev 6134: Rename IdMatcher to NameMatcher. in file:///home/vila/src/bzr/bugs/843638-id-matcher/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Sep 7 15:21:40 UTC 2011


At file:///home/vila/src/bzr/bugs/843638-id-matcher/

------------------------------------------------------------
revno: 6134
revision-id: v.ladeuil+lp at free.fr-20110907152139-wb368iwapfzqqtkm
parent: v.ladeuil+lp at free.fr-20110907082349-1ly8p12duy1exzn3
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 843638-id-matcher
timestamp: Wed 2011-09-07 17:21:39 +0200
message:
  Rename IdMatcher to NameMatcher.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2011-09-07 08:23:49 +0000
+++ b/bzrlib/config.py	2011-09-07 15:21:39 +0000
@@ -2917,10 +2917,10 @@
         raise NotImplementedError(self.match)
 
 
-class IdMatcher(SectionMatcher):
+class NameMatcher(SectionMatcher):
 
     def __init__(self, store, section_id):
-        super(IdMatcher, self).__init__(store)
+        super(NameMatcher, self).__init__(store)
         self.section_id = section_id
 
     def match(self, section):

=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2011-09-07 08:23:49 +0000
+++ b/bzrlib/tests/test_config.py	2011-09-07 15:21:39 +0000
@@ -3064,7 +3064,7 @@
 class TestSectionMatcher(TestStore):
 
     scenarios = [('location', {'matcher': config.LocationMatcher}),
-                 ('id', {'matcher': config.IdMatcher}),]
+                 ('id', {'matcher': config.NameMatcher}),]
 
     def get_store(self, file_name):
         return config.IniFileStore(self.get_readonly_transport(), file_name)
@@ -3179,10 +3179,10 @@
         self.assertEquals(expected_location, matcher.location)
 
 
-class TestIdMatcher(TestStore):
+class TestNameMatcher(TestStore):
 
     def setUp(self):
-        super(TestIdMatcher, self).setUp()
+        super(TestNameMatcher, self).setUp()
         self.store = config.IniFileStore(self.get_readonly_transport(),
                                          'foo.conf')
         self.store._load_from_string('''
@@ -3194,15 +3194,17 @@
 option=bar
 ''')
 
+    def get_matching_sections(self, name):
+        matcher = config.NameMatcher(self.store, name)
+        return list(matcher.get_sections())
+
     def test_matching(self):
-        matcher = config.IdMatcher(self.store, 'foo')
-        sections = list(matcher.get_sections())
+        sections = self.get_matching_sections('foo')
         self.assertLength(1, sections)
         self.assertSectionContent(('foo', {'option': 'foo'}), sections[0])
 
     def test_not_matching(self):
-        matcher = config.IdMatcher(self.store, 'baz')
-        sections = list(matcher.get_sections())
+        sections = self.get_matching_sections('baz')
         self.assertLength(0, sections)
 
 

=== modified file 'doc/developers/configuration.txt'
--- a/doc/developers/configuration.txt	2011-09-07 08:23:49 +0000
+++ b/doc/developers/configuration.txt	2011-09-07 15:21:39 +0000
@@ -102,7 +102,7 @@
 * ``LocationMatcher(store, location)``: To select all sections that match
   ``location``.
 
-* ``IdMatcher(store, unique_id)``: To select a single section matching
+* ``NameMatcher(store, unique_id)``: To select a single section matching
   ``unique_id``.
 
 Stacks

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2011-09-07 08:23:49 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2011-09-07 15:21:39 +0000
@@ -75,7 +75,7 @@
 * ``config.Option`` can now declare ``default_from_env``, a list of
   environment variables to get a default value from. (Vincent Ladeuil)
 
-* ``config.IdMatcher`` can be used to implement config stores and stacks
+* ``config.NameMatcher`` can be used to implement config stores and stacks
   that need to provide specific option values for arbitrary unique IDs (svn
   repository UUIDs, etc).  (Vincent Ladeuil, #843638)
 



More information about the bazaar-commits mailing list