Rev 6083: Merge into fix for bug #829237 in file:///home/vila/src/bzr/experimental/expand-in-stack/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Aug 19 13:17:56 UTC 2011


At file:///home/vila/src/bzr/experimental/expand-in-stack/

------------------------------------------------------------
revno: 6083 [merge]
revision-id: v.ladeuil+lp at free.fr-20110819131755-k7x6pvibgbvnxyze
parent: pqm at pqm.ubuntu.com-20110818042306-neji85pljf86z885
parent: v.ladeuil+lp at free.fr-20110819081212-zlh8tz1756j5bjhj
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: expand-in-stack
timestamp: Fri 2011-08-19 15:17:55 +0200
message:
  Merge into fix for bug #829237
modified:
  bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
  bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2011-08-16 15:12:39 +0000
+++ b/bzrlib/config.py	2011-08-19 13:17:55 +0000
@@ -2812,30 +2812,34 @@
         # We slightly diverge from LocalConfig here by allowing the no-name
         # section as the most generic one and the lower priority.
         no_name_section = None
-        sections = []
+        all_sections = []
         # Filter out the no_name_section so _iter_for_location_by_parts can be
         # used (it assumes all sections have a name).
         for section in self.store.get_sections():
             if section.id is None:
                 no_name_section = section
             else:
-                sections.append(section)
+                all_sections.append(section)
         # Unfortunately _iter_for_location_by_parts deals with section names so
         # we have to resync.
         filtered_sections = _iter_for_location_by_parts(
-            [s.id for s in sections], self.location)
-        iter_sections = iter(sections)
+            [s.id for s in all_sections], self.location)
+        iter_all_sections = iter(all_sections)
         matching_sections = []
         if no_name_section is not None:
             matching_sections.append(
                 LocationSection(no_name_section, 0, self.location))
         for section_id, extra_path, length in filtered_sections:
-            # a section id is unique for a given store so it's safe to iterate
-            # again
-            section = iter_sections.next()
-            if section_id == section.id:
-                matching_sections.append(
-                    LocationSection(section, length, extra_path))
+            # a section id is unique for a given store so it's safe to take the
+            # first matching section while iterating. Also, all filtered
+            # sections are part of 'all_sections' and will always be found
+            # there.
+            while True:
+                section = iter_all_sections.next()
+                if section_id == section.id:
+                    matching_sections.append(
+                        LocationSection(section, length, extra_path))
+                    break
         return matching_sections
 
     def get_sections(self):

=== modified file 'bzrlib/help_topics/__init__.py'
--- a/bzrlib/help_topics/__init__.py	2011-08-09 17:01:47 +0000
+++ b/bzrlib/help_topics/__init__.py	2011-08-19 13:17:55 +0000
@@ -613,8 +613,7 @@
 BZR_LOG (Win32)     Location of .bzr.log (use 'NUL' to suppress log).
 BZR_COLUMNS         Override implicit terminal width.
 BZR_CONCURRENCY     Number of processes that can be run concurrently (selftest)
-BZR_PROGRESS_BAR    Override the progress display. Values are 'none', 'dots',
-                    or 'tty'.
+BZR_PROGRESS_BAR    Override the progress display. Values are 'none' or 'text'.
 BZR_PDB             Control whether to launch a debugger on error.
 BZR_SIGQUIT_PDB     Control whether SIGQUIT behaves normally or invokes a
                     breakin debugger.

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2011-07-23 11:16:56 +0000
+++ b/bzrlib/repository.py	2011-08-19 13:17:55 +0000
@@ -1889,3 +1889,7 @@
         for list_part in self.list_parts:
             full_list.extend(list_part)
         return iter(full_list)
+
+    def __repr__(self):
+        return "%s.%s(%s)" % (self.__module__, self.__class__.__name__,
+                              self.list_parts)

=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2011-08-12 14:07:21 +0000
+++ b/bzrlib/tests/test_config.py	2011-08-19 13:17:55 +0000
@@ -2823,6 +2823,32 @@
     def get_store(self, file_name):
         return config.IniFileStore(self.get_readonly_transport(), file_name)
 
+    def test_unrelated_section_excluded(self):
+        store = self.get_store('foo.conf')
+        store._load_from_string('''
+[/foo]
+section=/foo
+[/foo/baz]
+section=/foo/baz
+[/foo/bar]
+section=/foo/bar
+[/foo/bar/baz]
+section=/foo/bar/baz
+[/quux/quux]
+section=/quux/quux
+''')
+        self.assertEquals(['/foo', '/foo/baz', '/foo/bar', '/foo/bar/baz',
+                           '/quux/quux'],
+                          [section.id for section in store.get_sections()])
+        matcher = config.LocationMatcher(store, '/foo/bar/quux')
+        sections = list(matcher.get_sections())
+        self.assertEquals([3, 2],
+                          [section.length for section in sections])
+        self.assertEquals(['/foo/bar', '/foo'],
+                          [section.id for section in sections])
+        self.assertEquals(['quux', 'bar/quux'],
+                          [section.extra_path for section in sections])
+
     def test_more_specific_sections_first(self):
         store = self.get_store('foo.conf')
         store._load_from_string('''

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2011-05-26 08:05:45 +0000
+++ b/bzrlib/tests/test_repository.py	2011-08-18 13:27:18 +0000
@@ -1660,3 +1660,11 @@
     def test_IDS_format_same_no(self):
         # When the formats are the same, pack is not called.
         self.run_fetch('2a', '2a', False)
+
+
+class Test_LazyListJoin(tests.TestCase):
+
+    def test__repr__(self):
+        lazy = repository._LazyListJoin(['a'], ['b'])
+        self.assertEqual("bzrlib.repository._LazyListJoin((['a'], ['b']))",
+                         repr(lazy))

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-08-16 14:20:13 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-08-19 13:17:55 +0000
@@ -32,11 +32,17 @@
 .. Fixes for situations where bzr would previously crash or give incorrect
    or undesirable results.
 
+* ``config.LocationMatcher`` properly excludes unrelated sections.
+  (Vincent Ladeuil, #829237)
+
 Documentation
 *************
 
 .. Improved or updated documentation.
 
+* Corrected documentation for BZR_PROGRESS_BAR. 
+  (Dennis Benzinger, #735417)
+
 API Changes
 ***********
 



More information about the bazaar-commits mailing list