Rev 4055: (robertc) Fix the root cause of bug 304841 rather than changing the in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Feb 26 05:27:20 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4055
revision-id: pqm at pqm.ubuntu.com-20090226052717-5tbzaulyew9auo7t
parent: pqm at pqm.ubuntu.com-20090226031558-1ubr618vdn4r5f07
parent: robertc at robertcollins.net-20090226023323-x36w98zx9jjmakpi
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-02-26 05:27:17 +0000
message:
  (robertc) Fix the root cause of bug 304841 rather than changing the
  	fetch order. (Robert Collins, John Arbash-Meinel)
modified:
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/per_repository/test_add_fallback_repository.py test_add_fallback_re-20080215040003-8w9n4ck9uqdxj18m-1
    ------------------------------------------------------------
    revno: 4052.1.2
    revision-id: robertc at robertcollins.net-20090226023323-x36w98zx9jjmakpi
    parent: robertc at robertcollins.net-20090226003951-c4tmpiirkq78q3us
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: bug-304841
    timestamp: Thu 2009-02-26 13:33:23 +1100
    message:
      Review feedback - fix flushing buffered records in knit's insert_record_stream.
    modified:
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
    ------------------------------------------------------------
    revno: 4052.1.1
    revision-id: robertc at robertcollins.net-20090226003951-c4tmpiirkq78q3us
    parent: pqm at pqm.ubuntu.com-20090225231224-r2fv2iqcgezje0zt
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: bug-304841
    timestamp: Thu 2009-02-26 11:39:51 +1100
    message:
      Roll back the overly big fix to bug 304841, allowing _fetch order to move to RepositoryFormat.
    modified:
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/per_repository/test_add_fallback_repository.py test_add_fallback_re-20080215040003-8w9n4ck9uqdxj18m-1
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2009-02-25 21:13:22 +0000
+++ b/bzrlib/knit.py	2009-02-26 02:33:23 +0000
@@ -1517,6 +1517,7 @@
         # key = basis_parent, value = index entry to add
         buffered_index_entries = {}
         for record in stream:
+            buffered = False
             parents = record.parents
             if record.storage_kind in delta_types:
                 # TODO: eventually the record itself should track
@@ -1568,7 +1569,6 @@
                 access_memo = self._access.add_raw_records(
                     [(record.key, len(bytes))], bytes)[0]
                 index_entry = (record.key, options, access_memo, parents)
-                buffered = False
                 if 'fulltext' not in options:
                     # Not a fulltext, so we need to make sure the compression
                     # parent will also be present.
@@ -1609,15 +1609,16 @@
                 except errors.RevisionAlreadyPresent:
                     pass
             # Add any records whose basis parent is now available.
-            added_keys = [record.key]
-            while added_keys:
-                key = added_keys.pop(0)
-                if key in buffered_index_entries:
-                    index_entries = buffered_index_entries[key]
-                    self._index.add_records(index_entries)
-                    added_keys.extend(
-                        [index_entry[0] for index_entry in index_entries])
-                    del buffered_index_entries[key]
+            if not buffered:
+                added_keys = [record.key]
+                while added_keys:
+                    key = added_keys.pop(0)
+                    if key in buffered_index_entries:
+                        index_entries = buffered_index_entries[key]
+                        self._index.add_records(index_entries)
+                        added_keys.extend(
+                            [index_entry[0] for index_entry in index_entries])
+                        del buffered_index_entries[key]
         if buffered_index_entries:
             # There were index entries buffered at the end of the stream,
             # So these need to be added (if the index supports holding such

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-02-25 00:31:09 +0000
+++ b/bzrlib/repository.py	2009-02-26 00:39:51 +0000
@@ -637,7 +637,6 @@
         self.inventories.add_fallback_versioned_files(repository.inventories)
         self.revisions.add_fallback_versioned_files(repository.revisions)
         self.signatures.add_fallback_versioned_files(repository.signatures)
-        self._fetch_order = 'topological'
 
     def _check_fallback_repository(self, repository):
         """Check that this repository can fallback to repository safely.

=== modified file 'bzrlib/tests/per_repository/test_add_fallback_repository.py'
--- a/bzrlib/tests/per_repository/test_add_fallback_repository.py	2009-02-13 00:52:18 +0000
+++ b/bzrlib/tests/per_repository/test_add_fallback_repository.py	2009-02-26 00:39:51 +0000
@@ -65,13 +65,3 @@
         self.addCleanup(other.unlock)
         self.assertEqual({revision_id: (NULL_REVISION,)},
             repo.get_graph(other).get_parent_map([revision_id]))
-
-    def test_add_fallback_sets_fetch_order(self):
-        repo = self.make_repository('repo')
-        tree = self.make_branch_and_tree('branch')
-        if not repo._format.supports_external_lookups:
-            self.assertRaises(errors.UnstackableRepositoryFormat,
-                repo.add_fallback_repository, tree.branch.repository)
-            raise TestNotApplicable
-        repo.add_fallback_repository(tree.branch.repository)
-        self.assertEqual('topological', repo._fetch_order)




More information about the bazaar-commits mailing list