Rev 3641: (jam) Merge in bzr-1.6rc4 including the fix for bug #256757 in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Aug 19 16:25:44 BST 2008


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

------------------------------------------------------------
revno: 3641
revision-id: pqm at pqm.ubuntu.com-20080819152536-6oobtmrum8e34h8l
parent: pqm at pqm.ubuntu.com-20080819034437-8cr7y59abr4wemaz
parent: john at arbash-meinel.com-20080819145408-ibct0khuxzte1tt4
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-08-19 16:25:36 +0100
message:
  (jam) Merge in bzr-1.6rc4 including the fix for bug #256757
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
  bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
  bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
  bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3640.1.1
    revision-id: john at arbash-meinel.com-20080819145408-ibct0khuxzte1tt4
    parent: pqm at pqm.ubuntu.com-20080819034437-8cr7y59abr4wemaz
    parent: pqm at pqm.ubuntu.com-20080818234533-ixoxs0ca9kygqe0m
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: jam-integration
    timestamp: Tue 2008-08-19 09:54:08 -0500
    message:
      Merge in bzr-1.6rc4 including the fix for bug #256757
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3606.5.6
    revision-id: pqm at pqm.ubuntu.com-20080818234533-ixoxs0ca9kygqe0m
    parent: pqm at pqm.ubuntu.com-20080814165207-0sfq9u9vy6rl7oxc
    parent: john at arbash-meinel.com-20080818231159-r9buncgsgj6cja4j
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: 1.6
    timestamp: Tue 2008-08-19 00:45:33 +0100
    message:
      (jam) Fix bug #256757, when fetching knits => packs,
      	use the existing deltas
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3606.7.8
    revision-id: john at arbash-meinel.com-20080818231159-r9buncgsgj6cja4j
    parent: john at arbash-meinel.com-20080818223421-todjny24vj4faj4t
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: fetch_regression_256757
    timestamp: Mon 2008-08-18 18:11:59 -0500
    message:
      Switch names to 'unordered' that I missed before.
    modified:
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3606.7.7
    revision-id: john at arbash-meinel.com-20080818223421-todjny24vj4faj4t
    parent: john at arbash-meinel.com-20080818192544-nohhonfyuaf2ut88
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: fetch_regression_256757
    timestamp: Mon 2008-08-18 17:34:21 -0500
    message:
      Add tests for the fetching behavior.
      
      The proper parameter passed is 'unordered' add an assert for it, and
      fix callers that were passing 'unsorted' instead.
      Add tests that we make the right get_record_stream call based
      on the value of _fetch_uses_deltas.
      Fix the fetch request for signatures.
    modified:
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
    ------------------------------------------------------------
    revno: 3606.7.6
    revision-id: john at arbash-meinel.com-20080818192544-nohhonfyuaf2ut88
    parent: john at arbash-meinel.com-20080818192501-4r4h4x21yrd36jrd
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: fetch_regression_256757
    timestamp: Mon 2008-08-18 14:25:44 -0500
    message:
      Prepare 1.6rc4
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
    ------------------------------------------------------------
    revno: 3606.7.5
    revision-id: john at arbash-meinel.com-20080818192501-4r4h4x21yrd36jrd
    parent: john at arbash-meinel.com-20080818191542-52i3flqrkeufhjw2
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: fetch_regression_256757
    timestamp: Mon 2008-08-18 14:25:01 -0500
    message:
      Fixup NEWS to be more accurate.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3606.7.4
    revision-id: john at arbash-meinel.com-20080818191542-52i3flqrkeufhjw2
    parent: john at arbash-meinel.com-20080818191351-de63gybx2jaco2yo
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: fetch_regression_256757
    timestamp: Mon 2008-08-18 14:15:42 -0500
    message:
      We don't have to change the default order either.
    modified:
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
    ------------------------------------------------------------
    revno: 3606.7.3
    revision-id: john at arbash-meinel.com-20080818191351-de63gybx2jaco2yo
    parent: john at arbash-meinel.com-20080818190432-gkn0umj08xln8owu
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: fetch_regression_256757
    timestamp: Mon 2008-08-18 14:13:51 -0500
    message:
      We don't have to fetch in topological order, as long as we fix all of the delta logic pieces.
    modified:
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3606.7.2
    revision-id: john at arbash-meinel.com-20080818190432-gkn0umj08xln8owu
    parent: john at arbash-meinel.com-20080818185537-w3abkc3a29c7828t
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: fetch_regression_256757
    timestamp: Mon 2008-08-18 14:04:32 -0500
    message:
      Find a couple more places with incorrect logic, and fix the tests effected.
    modified:
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3606.7.1
    revision-id: john at arbash-meinel.com-20080818185537-w3abkc3a29c7828t
    parent: pqm at pqm.ubuntu.com-20080814165207-0sfq9u9vy6rl7oxc
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: fetch_regression_256757
    timestamp: Mon 2008-08-18 13:55:37 -0500
    message:
      Fix bug #256757 by restoring knit => pack fetches to use topological ordering and preserve deltas.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
=== modified file 'NEWS'
--- a/NEWS	2008-08-19 03:08:37 +0000
+++ b/NEWS	2008-08-19 14:54:08 +0000
@@ -65,6 +65,16 @@
       (Robert Collins, Aaron Bentley)
 
 
+bzr 1.6rc4 2008-08-18
+---------------------
+
+  BUG FIXES: 
+
+    * Fix a regression in knit => pack fetching.  We had a logic
+      inversion, causing the fetch to insert fulltexts in random order,
+      rather than preserving deltas.  (John Arbash Meinel, #256757)
+
+
 bzr 1.6rc3 2008-08-14
 ---------------------
 

=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py	2008-07-28 09:12:28 +0000
+++ b/bzrlib/fetch.py	2008-08-18 22:34:21 +0000
@@ -180,7 +180,7 @@
                     from_texts = self.from_repository.texts
                     to_texts.insert_record_stream(from_texts.get_record_stream(
                         text_keys, self.to_repository._fetch_order,
-                        self.to_repository._fetch_uses_deltas))
+                        not self.to_repository._fetch_uses_deltas))
                     # Cause an error if a text occurs after we have done the
                     # copy.
                     text_keys = None
@@ -243,7 +243,7 @@
             to_weave.insert_record_stream(from_weave.get_record_stream(
                 [(rev_id,) for rev_id in revs],
                 self.to_repository._fetch_order,
-                self.to_repository._fetch_uses_deltas))
+                not self.to_repository._fetch_uses_deltas))
         finally:
             child_pb.finished()
 
@@ -255,7 +255,7 @@
         to_sf.insert_record_stream(filter_absent(from_sf.get_record_stream(
             [(rev_id,) for rev_id in revs],
             self.to_repository._fetch_order,
-            self.to_repository._fetch_uses_deltas)))
+            not self.to_repository._fetch_uses_deltas)))
         self._fetch_just_revision_texts(revs)
 
     def _fetch_just_revision_texts(self, version_ids):
@@ -264,7 +264,7 @@
         to_rf.insert_record_stream(from_rf.get_record_stream(
             [(rev_id,) for rev_id in version_ids],
             self.to_repository._fetch_order,
-            self.to_repository._fetch_uses_deltas))
+            not self.to_repository._fetch_uses_deltas))
 
     def _generate_root_texts(self, revs):
         """This will be called by __fetch between fetching weave texts and

=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2008-08-01 04:06:18 +0000
+++ b/bzrlib/knit.py	2008-08-18 22:34:21 +0000
@@ -1195,6 +1195,10 @@
                     current_source = key_source
                 source_keys[-1][1].append(key)
         else:
+            if ordering != 'unordered':
+                raise AssertionError('valid values for ordering are:'
+                    ' "unordered" or "topological" not: %r'
+                    % (ordering,))
             # Just group by source; remote sources first.
             present_keys = []
             source_keys = []

=== modified file 'bzrlib/reconcile.py'
--- a/bzrlib/reconcile.py	2008-06-11 04:20:16 +0000
+++ b/bzrlib/reconcile.py	2008-08-18 22:34:21 +0000
@@ -245,7 +245,7 @@
         revision_keys = [(rev_id,) for rev_id in
             TopoSorter(self._rev_graph.items()).iter_topo_order()]
         stream = self._change_inv_parents(
-            self.inventory.get_record_stream(revision_keys, 'unsorted', True),
+            self.inventory.get_record_stream(revision_keys, 'unordered', True),
             self._new_inv_parents,
             set(revision_keys))
         new_inventories.insert_record_stream(stream)
@@ -377,7 +377,7 @@
         revision_ids = [key[-1] for key in revision_keys]
         self._setup_steps(len(revision_keys))
         stream = self._change_inv_parents(
-            self.inventory.get_record_stream(revision_keys, 'unsorted', True),
+            self.inventory.get_record_stream(revision_keys, 'unordered', True),
             graph.__getitem__,
             set(revision_keys))
         new_inventories.insert_record_stream(stream)

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2008-08-13 17:15:14 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2008-08-18 22:34:21 +0000
@@ -1719,7 +1719,7 @@
         self._reconcile_does_inventory_gc = True
         self._reconcile_fixes_text_parents = True
         self._reconcile_backsup_inventory = False
-        self._fetch_order = 'unsorted'
+        self._fetch_order = 'unordered'
 
     def _warn_if_deprecated(self):
         # This class isn't deprecated

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-08-13 01:30:31 +0000
+++ b/bzrlib/repository.py	2008-08-19 14:54:08 +0000
@@ -697,9 +697,9 @@
         # Additional places to query for data.
         self._fallback_repositories = []
         # What order should fetch operations request streams in?
-        # The default is unsorted as that is the cheapest for an origin to
+        # The default is unordered as that is the cheapest for an origin to
         # provide.
-        self._fetch_order = 'unsorted'
+        self._fetch_order = 'unordered'
         # Does this repository use deltas that can be fetched as-deltas ?
         # (E.g. knits, where the knit deltas can be transplanted intact.
         # We default to False, which will ensure that enough data to get

=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py	2008-07-28 09:12:28 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py	2008-08-18 23:11:59 +0000
@@ -68,7 +68,7 @@
         """Test the the _fetch_order attribute."""
         tree = self.make_branch_and_tree('tree')
         repo = tree.branch.repository
-        self.assertTrue(repo._fetch_order in ('topological', 'unsorted'))
+        self.assertTrue(repo._fetch_order in ('topological', 'unordered'))
 
     def test_attribute__fetch_uses_deltas(self):
         """Test the the _fetch_uses_deltas attribute."""
@@ -949,7 +949,7 @@
         self.assertRaises(errors.NoSuchRevision,
                           self.bzrdir.open_repository().get_ancestry, 'orphan')
 
-    def test_get_unsorted_ancestry(self):
+    def test_get_unordered_ancestry(self):
         repo = self.bzrdir.open_repository()
         self.assertEqual(set(repo.get_ancestry('rev3')),
                          set(repo.get_ancestry('rev3', topo_sorted=False)))

=== modified file 'bzrlib/tests/test_fetch.py'
--- a/bzrlib/tests/test_fetch.py	2008-07-28 08:43:03 +0000
+++ b/bzrlib/tests/test_fetch.py	2008-08-18 22:34:21 +0000
@@ -24,6 +24,7 @@
     errors,
     merge,
     repository,
+    versionedfile,
     )
 from bzrlib.branch import Branch
 from bzrlib.bzrdir import BzrDir
@@ -329,6 +330,105 @@
         self.assertEqual(4, len(http_logs))
 
 
+class TestKnitToPackFetch(TestCaseWithTransport):
+
+    def find_get_record_stream(self, calls):
+        """In a list of calls, find 'get_record_stream' calls.
+
+        This also ensures that there is only one get_record_stream call.
+        """
+        get_record_call = None
+        for call in calls:
+            if call[0] == 'get_record_stream':
+                self.assertIs(None, get_record_call,
+                              "there should only be one call to"
+                              " get_record_stream")
+                get_record_call = call
+        self.assertIsNot(None, get_record_call,
+                         "there should be exactly one call to "
+                         " get_record_stream")
+        return get_record_call
+
+    def test_fetch_with_deltas_no_delta_closure(self):
+        tree = self.make_branch_and_tree('source', format='dirstate')
+        target = self.make_repository('target', format='pack-0.92')
+        self.build_tree(['source/file'])
+        tree.set_root_id('root-id')
+        tree.add('file', 'file-id')
+        tree.commit('one', rev_id='rev-one')
+        source = tree.branch.repository
+        source.texts = versionedfile.RecordingVersionedFilesDecorator(
+                        source.texts)
+        source.signatures = versionedfile.RecordingVersionedFilesDecorator(
+                        source.signatures)
+        source.revisions = versionedfile.RecordingVersionedFilesDecorator(
+                        source.revisions)
+        source.inventories = versionedfile.RecordingVersionedFilesDecorator(
+                        source.inventories)
+        # precondition
+        self.assertTrue(target._fetch_uses_deltas)
+        target.fetch(source, revision_id='rev-one')
+        self.assertEqual(('get_record_stream', [('file-id', 'rev-one')],
+                          target._fetch_order, False),
+                         self.find_get_record_stream(source.texts.calls))
+        self.assertEqual(('get_record_stream', [('rev-one',)],
+                          target._fetch_order, False),
+                         self.find_get_record_stream(source.inventories.calls))
+        self.assertEqual(('get_record_stream', [('rev-one',)],
+                          target._fetch_order, False),
+                         self.find_get_record_stream(source.revisions.calls))
+        # XXX: Signatures is special, and slightly broken. The
+        # standard item_keys_introduced_by actually does a lookup for every
+        # signature to see if it exists, rather than waiting to do them all at
+        # once at the end. The fetch code then does an all-at-once and just
+        # allows for some of them to be missing.
+        # So we know there will be extra calls, but the *last* one is the one
+        # we care about.
+        signature_calls = source.signatures.calls[-1:]
+        self.assertEqual(('get_record_stream', [('rev-one',)],
+                          target._fetch_order, False),
+                         self.find_get_record_stream(signature_calls))
+
+    def test_fetch_no_deltas_with_delta_closure(self):
+        tree = self.make_branch_and_tree('source', format='dirstate')
+        target = self.make_repository('target', format='pack-0.92')
+        self.build_tree(['source/file'])
+        tree.set_root_id('root-id')
+        tree.add('file', 'file-id')
+        tree.commit('one', rev_id='rev-one')
+        source = tree.branch.repository
+        source.texts = versionedfile.RecordingVersionedFilesDecorator(
+                        source.texts)
+        source.signatures = versionedfile.RecordingVersionedFilesDecorator(
+                        source.signatures)
+        source.revisions = versionedfile.RecordingVersionedFilesDecorator(
+                        source.revisions)
+        source.inventories = versionedfile.RecordingVersionedFilesDecorator(
+                        source.inventories)
+        target._fetch_uses_deltas = False
+        target.fetch(source, revision_id='rev-one')
+        self.assertEqual(('get_record_stream', [('file-id', 'rev-one')],
+                          target._fetch_order, True),
+                         self.find_get_record_stream(source.texts.calls))
+        self.assertEqual(('get_record_stream', [('rev-one',)],
+                          target._fetch_order, True),
+                         self.find_get_record_stream(source.inventories.calls))
+        self.assertEqual(('get_record_stream', [('rev-one',)],
+                          target._fetch_order, True),
+                         self.find_get_record_stream(source.revisions.calls))
+        # XXX: Signatures is special, and slightly broken. The
+        # standard item_keys_introduced_by actually does a lookup for every
+        # signature to see if it exists, rather than waiting to do them all at
+        # once at the end. The fetch code then does an all-at-once and just
+        # allows for some of them to be missing.
+        # So we know there will be extra calls, but the *last* one is the one
+        # we care about.
+        signature_calls = source.signatures.calls[-1:]
+        self.assertEqual(('get_record_stream', [('rev-one',)],
+                          target._fetch_order, True),
+                         self.find_get_record_stream(signature_calls))
+
+
 class Test1To2Fetch(TestCaseWithTransport):
     """Tests for Model1To2 failure modes"""
 

=== modified file 'bzrlib/tests/test_pack_repository.py'
--- a/bzrlib/tests/test_pack_repository.py	2008-08-04 02:54:44 +0000
+++ b/bzrlib/tests/test_pack_repository.py	2008-08-18 23:11:59 +0000
@@ -65,7 +65,7 @@
         """Packs do not need ordered data retrieval."""
         format = self.get_format()
         repo = self.make_repository('.', format=format)
-        self.assertEqual('unsorted', repo._fetch_order)
+        self.assertEqual('unordered', repo._fetch_order)
 
     def test_attribute__fetch_uses_deltas(self):
         """Packs reuse deltas."""




More information about the bazaar-commits mailing list