Rev 4040: Merge bzr.dev, adjust effort tests reducing the effort in line with the write_group avoidance. in http://people.ubuntu.com/~robertc/baz2.0/integration

Robert Collins robertc at robertcollins.net
Wed Feb 25 00:31:18 GMT 2009


At http://people.ubuntu.com/~robertc/baz2.0/integration

------------------------------------------------------------
revno: 4040
revision-id: robertc at robertcollins.net-20090225003109-9ngqolksoevjw5ay
parent: robertc at robertcollins.net-20090224212243-wpleuzp5uin2h89p
parent: pqm at pqm.ubuntu.com-20090225000405-09p33ue22l4h19yk
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Wed 2009-02-25 11:31:09 +1100
message:
  Merge bzr.dev, adjust effort tests reducing the effort in line with the write_group avoidance.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
  bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
  bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
  bzrlib/tests/test_read_bundle.py test_read_bundle.py-20060615211421-ud8cwr1ulgd914zf-1
  setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
  tools/win32/build_release.py   build_release.py-20081105204355-2ghh5cv01v1x4rzz-1
    ------------------------------------------------------------
    revno: 4032.2.11
    revision-id: pqm at pqm.ubuntu.com-20090225000405-09p33ue22l4h19yk
    parent: pqm at pqm.ubuntu.com-20090224221910-i352mbfn0sa3bq4z
    parent: robertc at robertcollins.net-20090224231953-rkp47hmdg2c84ai4
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Wed 2009-02-25 00:04:05 +0000
    message:
      (robertc) Fix unnecessary get_parent_map calls after insert_stream
      	during push. (Andrew Bennetts)
    modified:
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
      bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
        ------------------------------------------------------------
        revno: 4032.9.3
        revision-id: robertc at robertcollins.net-20090224231953-rkp47hmdg2c84ai4
        parent: robertc at robertcollins.net-20090224223938-3msunxpyk4cki95d
        committer: Robert Collins <robertc at robertcollins.net>
        branch nick: integration
        timestamp: Wed 2009-02-25 10:19:53 +1100
        message:
          Fix trailing whitespace.
        modified:
          bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
        ------------------------------------------------------------
        revno: 4032.9.2
        revision-id: robertc at robertcollins.net-20090224223938-3msunxpyk4cki95d
        parent: andrew.bennetts at canonical.com-20090224060251-25g4k13lh1sekza6
        parent: pqm at pqm.ubuntu.com-20090224203358-pxxf7n5ybvzm3mnh
        committer: Robert Collins <robertc at robertcollins.net>
        branch nick: integration
        timestamp: Wed 2009-02-25 09:39:38 +1100
        message:
          Minor tweaks to fix failing tests.
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
          bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
          bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
          bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
          bzrlib/info.py                 info.py-20050323235939-6bbfe7d9700b0b9b
          bzrlib/push.py                 push.py-20080606021927-5fe39050e8xne9un-1
          bzrlib/registry.py             lazy_factory.py-20060809213415-2gfvqadtvdn0phtg-1
          bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
          bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
          bzrlib/smart/bzrdir.py         bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-1
          bzrlib/smart/request.py        request.py-20061108095550-gunadhxmzkdjfeek-1
          bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
          bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
          bzrlib/tests/blackbox/test_upgrade.py test_upgrade.py-20060120060132-b41e5ed2f886ad28
          bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
          bzrlib/tests/branch_implementations/test_hooks.py test_hooks.py-20070129154855-blhpwxmvjs07waei-1
          bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
          bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
          bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
          bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
          bzrlib/tests/test_read_bundle.py test_read_bundle.py-20060615211421-ud8cwr1ulgd914zf-1
          bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
        ------------------------------------------------------------
        revno: 4032.9.1
        revision-id: andrew.bennetts at canonical.com-20090224060251-25g4k13lh1sekza6
        parent: pqm at pqm.ubuntu.com-20090223205523-xp0lqm5iz1df5o0x
        committer: Andrew Bennetts <andrew.bennetts at canonical.com>
        branch nick: bug-331823
        timestamp: Tue 2009-02-24 17:02:51 +1100
        message:
          Fix unnecessary get_parent_map calls after insert_stream during push.
        modified:
          bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
          bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
          bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
    ------------------------------------------------------------
    revno: 4032.2.10
    revision-id: pqm at pqm.ubuntu.com-20090224221910-i352mbfn0sa3bq4z
    parent: pqm at pqm.ubuntu.com-20090224214044-953waog3od1tvlfr
    parent: john at arbash-meinel.com-20090218182834-lvlzcj1q88bl269r
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Tue 2009-02-24 22:19:10 +0000
    message:
      (jam) Tweak the delta base selection for InterDifferingSerializer
      	conversions.
    modified:
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
        ------------------------------------------------------------
        revno: 4017.4.1
        revision-id: john at arbash-meinel.com-20090218182834-lvlzcj1q88bl269r
        parent: pqm at pqm.ubuntu.com-20090218132708-okubrahz9exvae9r
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: generic_fetch_delta_selection
        timestamp: Wed 2009-02-18 12:28:34 -0600
        message:
          Change the generic fetch logic to improve delta selection.
          
          The code was using an arbitrary base as the basis for its delta,
          instead we cache a few revision trees, and use the one that most-closely
          matches the final tree we want to end up with.
          
          For some conversions (chk) this has a rather large impact, as it
          means we have fewer redundant bits of the delta to apply.
        modified:
          bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
    ------------------------------------------------------------
    revno: 4032.2.9
    revision-id: pqm at pqm.ubuntu.com-20090224214044-953waog3od1tvlfr
    parent: pqm at pqm.ubuntu.com-20090224203358-pxxf7n5ybvzm3mnh
    parent: john at arbash-meinel.com-20090224204340-h210yh5ufnlej6yr
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Tue 2009-02-24 21:40:44 +0000
    message:
      (jam) Some updates to win32 packaging.
    modified:
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
      tools/win32/build_release.py   build_release.py-20081105204355-2ghh5cv01v1x4rzz-1
        ------------------------------------------------------------
        revno: 3995.3.12
        revision-id: john at arbash-meinel.com-20090224204340-h210yh5ufnlej6yr
        parent: john at arbash-meinel.com-20090224191959-9ds39e79cxi3rfz4
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: 1.12_packaging
        timestamp: Tue 2009-02-24 14:43:40 -0600
        message:
          it seems subvertpy 0.6.4 has some bugfixes we want.
        modified:
          tools/win32/build_release.py   build_release.py-20081105204355-2ghh5cv01v1x4rzz-1
        ------------------------------------------------------------
        revno: 3995.3.11
        revision-id: john at arbash-meinel.com-20090224191959-9ds39e79cxi3rfz4
        parent: john at arbash-meinel.com-20090224190807-ie0q6uhz8z0gzseq
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: bzr.1.12
        timestamp: Wed 2009-02-25 06:19:59 +1100
        message:
          Use bzr-svn 0.5.2 as well
        modified:
          tools/win32/build_release.py   build_release.py-20081105204355-2ghh5cv01v1x4rzz-1
        ------------------------------------------------------------
        revno: 3995.3.10
        revision-id: john at arbash-meinel.com-20090224190807-ie0q6uhz8z0gzseq
        parent: john at arbash-meinel.com-20090224190729-pvb2vrgwajvw65jz
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: bzr.1.12
        timestamp: Wed 2009-02-25 06:08:07 +1100
        message:
          Use qbzr 0.9.8 for final build of 1.12
        modified:
          tools/win32/build_release.py   build_release.py-20081105204355-2ghh5cv01v1x4rzz-1
        ------------------------------------------------------------
        revno: 3995.3.9
        revision-id: john at arbash-meinel.com-20090224190729-pvb2vrgwajvw65jz
        parent: pqm at pqm.ubuntu.com-20090213054838-lkk3nsn89bp3b0yt
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: bzr.1.12
        timestamp: Wed 2009-02-25 06:07:29 +1100
        message:
          Local modification to exclude certain system DLLs
        modified:
          setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
    ------------------------------------------------------------
    revno: 4032.2.8
    revision-id: pqm at pqm.ubuntu.com-20090224203358-pxxf7n5ybvzm3mnh
    parent: pqm at pqm.ubuntu.com-20090224103149-b9a60tx1qy68jtcj
    parent: v.ladeuil+lp at free.fr-20090224195435-yn22l3tlayfkkguf
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Tue 2009-02-24 20:33:58 +0000
    message:
      (vila) Fix missing gpg import and update call sites
    modified:
      bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
        ------------------------------------------------------------
        revno: 4032.8.1
        revision-id: v.ladeuil+lp at free.fr-20090224195435-yn22l3tlayfkkguf
        parent: pqm at pqm.ubuntu.com-20090224103149-b9a60tx1qy68jtcj
        parent: v.ladeuil+lp at free.fr-20090224151143-sf37g4khuzwgqvf6
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: bzr.integration
        timestamp: Tue 2009-02-24 20:54:35 +0100
        message:
          Fix missing gpg import and update call sites
        modified:
          bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
        ------------------------------------------------------------
        revno: 4032.7.1
        revision-id: v.ladeuil+lp at free.fr-20090224151143-sf37g4khuzwgqvf6
        parent: pqm at pqm.ubuntu.com-20090224103149-b9a60tx1qy68jtcj
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: various
        timestamp: Tue 2009-02-24 16:11:43 +0100
        message:
          Fix missing gpg import and update call sites.
        modified:
          bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
    ------------------------------------------------------------
    revno: 4032.2.7
    revision-id: pqm at pqm.ubuntu.com-20090224103149-b9a60tx1qy68jtcj
    parent: pqm at pqm.ubuntu.com-20090224095304-uk12twrtk4u1mkd1
    parent: v.ladeuil+lp at free.fr-20090224081142-bp0u9ryp6kyl2ur3
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Tue 2009-02-24 10:31:49 +0000
    message:
      (vila) Catching-up with review tweaks
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/tests/test_read_bundle.py test_read_bundle.py-20060615211421-ud8cwr1ulgd914zf-1
        ------------------------------------------------------------
        revno: 4032.6.1
        revision-id: v.ladeuil+lp at free.fr-20090224081142-bp0u9ryp6kyl2ur3
        parent: pqm at pqm.ubuntu.com-20090224073648-8cdhj9m2zsab8hx8
        parent: v.ladeuil+lp at free.fr-20090210091925-hog86ju0m3doty42
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: bzr.integration
        timestamp: Tue 2009-02-24 09:11:42 +0100
        message:
          Catching-up with review tweaks
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
          bzrlib/tests/test_read_bundle.py test_read_bundle.py-20060615211421-ud8cwr1ulgd914zf-1
        ------------------------------------------------------------
        revno: 3988.2.4
        revision-id: v.ladeuil+lp at free.fr-20090210091925-hog86ju0m3doty42
        parent: v.ladeuil+lp at free.fr-20090210091139-se2d9d3nb8twp0yy
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: httplib-broken-readline
        timestamp: Tue 2009-02-10 10:19:25 +0100
        message:
          Fixed as per Martin's review.
          
          * bzrlib/tests/test_read_bundle.py:
          (TestDeprecations.create_test_bundle,
          TestReadBundleFromURL.create_test_bundle): Add try/finally around
          f.write.
        modified:
          bzrlib/tests/test_read_bundle.py test_read_bundle.py-20060615211421-ud8cwr1ulgd914zf-1
        ------------------------------------------------------------
        revno: 3988.2.3
        revision-id: v.ladeuil+lp at free.fr-20090210091139-se2d9d3nb8twp0yy
        parent: v.ladeuil+lp at free.fr-20090210085255-r75icw1wo30l4ua4
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: httplib-broken-readline
        timestamp: Tue 2009-02-10 10:11:39 +0100
        message:
          Update NEWS about read_bundle_from_url being deprecated.
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
        ------------------------------------------------------------
        revno: 3988.2.2
        revision-id: v.ladeuil+lp at free.fr-20090210085255-r75icw1wo30l4ua4
        parent: v.ladeuil+lp at free.fr-20090209182543-nb0220ksr5xa20pg
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: httplib-broken-readline
        timestamp: Tue 2009-02-10 09:52:55 +0100
        message:
          Fix failing test.
          
          * bzrlib/tests/test_http.py:
          (TestHTTPRedirections.test_read_redirected_bundle_from_url): Don't
          use read_bundle_from_url since it's deprecated,sigh.
        modified:
          bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
    ------------------------------------------------------------
    revno: 4032.2.6
    revision-id: pqm at pqm.ubuntu.com-20090224095304-uk12twrtk4u1mkd1
    parent: pqm at pqm.ubuntu.com-20090224073648-8cdhj9m2zsab8hx8
    parent: robertc at robertcollins.net-20090224091304-k97x0yqk5yjy8jbl
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Tue 2009-02-24 09:53:04 +0000
    message:
      (robertc) Use a HPSS verb to create Branch objects on bzr:// servers.
      	(Robert Collins)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/push.py                 push.py-20080606021927-5fe39050e8xne9un-1
      bzrlib/registry.py             lazy_factory.py-20060809213415-2gfvqadtvdn0phtg-1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/smart/bzrdir.py         bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-1
      bzrlib/smart/request.py        request.py-20061108095550-gunadhxmzkdjfeek-1
      bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
      bzrlib/tests/blackbox/test_upgrade.py test_upgrade.py-20060120060132-b41e5ed2f886ad28
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/branch_implementations/test_hooks.py test_hooks.py-20070129154855-blhpwxmvjs07waei-1
      bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
=== modified file 'NEWS'
--- a/NEWS	2009-02-24 08:09:17 +0000
+++ b/NEWS	2009-02-24 10:31:49 +0000
@@ -179,6 +179,8 @@
       respectively, given they are not ready for release in 1.12.
       (Ian Clatworthy)
 
+    * ``read_bundle_from_url`` has been deprecated. (Vincent Ladeuil)
+
   NEW FEATURES:
 
     * Add support for filtering ``bzr missing`` on revisions.  Remote revisions

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2009-02-24 21:22:43 +0000
+++ b/bzrlib/remote.py	2009-02-25 00:31:09 +0000
@@ -865,10 +865,18 @@
         #
         # We need to accumulate additional repositories here, to pass them in
         # on various RPC's.
+        #
         self._fallback_repositories.append(repository)
-        # They are also seen by the fallback repository.  If it doesn't exist
-        # yet they'll be added then.  This implicitly copies them.
-        self._ensure_real()
+        # If self._real_repository was parameterised already (e.g. because a
+        # _real_branch had its get_stacked_on_url method called), then the
+        # repository to be added may already be in the _real_repositories list.
+        if self._real_repository is not None:
+            if repository not in self._real_repository._fallback_repositories:
+                self._real_repository.add_fallback_repository(repository)
+        else:
+            # They are also seen by the fallback repository.  If it doesn't
+            # exist yet they'll be added then.  This implicitly copies them.
+            self._ensure_real()
 
     def add_inventory(self, revid, inv, parents):
         self._ensure_real()
@@ -1637,10 +1645,14 @@
         fallback_url = urlutils.join(self.base, fallback_url)
         transports = [self.bzrdir.root_transport]
         if self._real_branch is not None:
+            # The real repository is setup already:
             transports.append(self._real_branch._transport)
-        stacked_on = branch.Branch.open(fallback_url,
-                                        possible_transports=transports)
-        self.repository.add_fallback_repository(stacked_on.repository)
+            self.repository.add_fallback_repository(
+                self.repository._real_repository._fallback_repositories[0])
+        else:
+            stacked_on = branch.Branch.open(fallback_url,
+                                            possible_transports=transports)
+            self.repository.add_fallback_repository(stacked_on.repository)
 
     def _get_real_transport(self):
         # if we try vfs access, return the real branch's vfs transport
@@ -2045,45 +2057,6 @@
         self._ensure_real()
         return self._real_branch.set_push_location(location)
 
-    @needs_write_lock
-    def update_revisions(self, other, stop_revision=None, overwrite=False,
-                         graph=None):
-        """See Branch.update_revisions."""
-        other.lock_read()
-        try:
-            if stop_revision is None:
-                stop_revision = other.last_revision()
-                if revision.is_null(stop_revision):
-                    # if there are no commits, we're done.
-                    return
-            self.fetch(other, stop_revision)
-
-            if overwrite:
-                # Just unconditionally set the new revision.  We don't care if
-                # the branches have diverged.
-                self._set_last_revision(stop_revision)
-            else:
-                medium = self._client._medium
-                if not medium._is_remote_before((1, 6)):
-                    try:
-                        self._set_last_revision_descendant(stop_revision, other)
-                        return
-                    except errors.UnknownSmartMethod:
-                        medium._remember_remote_is_before((1, 6))
-                # Fallback for pre-1.6 servers: check for divergence
-                # client-side, then do _set_last_revision.
-                last_rev = revision.ensure_null(self.last_revision())
-                if graph is None:
-                    graph = self.repository.get_graph()
-                if self._check_if_descendant_or_diverged(
-                        stop_revision, last_rev, graph, other):
-                    # stop_revision is a descendant of last_rev, but we aren't
-                    # overwriting, so we're done.
-                    return
-                self._set_last_revision(stop_revision)
-        finally:
-            other.unlock()
-
 
 def _extract_tar(tar, to_dir):
     """Extract all the contents of a tarfile object.

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-02-24 21:22:43 +0000
+++ b/bzrlib/repository.py	2009-02-25 00:31:09 +0000
@@ -3232,15 +3232,34 @@
             return False
         return True
 
-    def _fetch_batch(self, revision_ids, basis_id, basis_tree):
+    def _get_delta_for_revision(self, tree, parent_ids, basis_id, cache):
+        """Get the best delta and base for this revision.
+
+        :return: (basis_id, delta)
+        """
+        possible_trees = [(parent_id, cache[parent_id])
+                          for parent_id in parent_ids
+                           if parent_id in cache]
+        if len(possible_trees) == 0:
+            # There either aren't any parents, or the parents aren't in the
+            # cache, so just use the last converted tree
+            possible_trees.append((basis_id, cache[basis_id]))
+        deltas = []
+        for basis_id, basis_tree in possible_trees:
+            delta = tree.inventory._make_delta(basis_tree.inventory)
+            deltas.append((len(delta), basis_id, delta))
+        deltas.sort()
+        return deltas[0][1:]
+
+    def _fetch_batch(self, revision_ids, basis_id, cache):
         """Fetch across a few revisions.
 
         :param revision_ids: The revisions to copy
-        :param basis_id: The revision_id of basis_tree
-        :param basis_tree: A tree that is not in revision_ids which should
-            already exist in the target.
-        :return: (basis_id, basis_tree) A new basis to use now that these trees
-            have been copied.
+        :param basis_id: The revision_id of a tree that must be in cache, used
+            as a basis for delta when no other base is available
+        :param cache: A cache of RevisionTrees that we can use.
+        :return: The revision_id of the last converted tree. The RevisionTree
+            for it will be in cache
         """
         # Walk though all revisions; get inventory deltas, copy referenced
         # texts that delta references, insert the delta, revision and
@@ -3248,15 +3267,18 @@
         text_keys = set()
         pending_deltas = []
         pending_revisions = []
+        parent_map = self.source.get_parent_map(revision_ids)
         for tree in self.source.revision_trees(revision_ids):
             current_revision_id = tree.get_revision_id()
-            delta = tree.inventory._make_delta(basis_tree.inventory)
+            parent_ids = parent_map.get(current_revision_id, ())
+            basis_id, delta = self._get_delta_for_revision(tree, parent_ids,
+                                                           basis_id, cache)
+            # Find text entries that need to be copied
             for old_path, new_path, file_id, entry in delta:
                 if new_path is not None:
                     if not (new_path or self.target.supports_rich_root()):
-                        # We leave the inventory delta in, because that
-                        # will have the deserialised inventory root
-                        # pointer.
+                        # We don't copy the text for the root node unless the
+                        # target supports_rich_root.
                         continue
                     # TODO: Do we need:
                     #       "if entry.revision == current_revision_id" ?
@@ -3266,8 +3288,8 @@
             pending_deltas.append((basis_id, delta,
                 current_revision_id, revision.parent_ids))
             pending_revisions.append(revision)
+            cache[current_revision_id] = tree
             basis_id = current_revision_id
-            basis_tree = tree
         # Copy file texts
         from_texts = self.source.texts
         to_texts = self.target.texts
@@ -3287,7 +3309,7 @@
             except errors.NoSuchRevision:
                 pass
             self.target.add_revision(revision.revision_id, revision)
-        return basis_id, basis_tree
+        return basis_id
 
     def _fetch_all_revisions(self, revision_ids, pb):
         """Fetch everything for the list of revisions.
@@ -3299,14 +3321,16 @@
         """
         basis_id, basis_tree = self._get_basis(revision_ids[0])
         batch_size = 100
+        cache = lru_cache.LRUCache(100)
+        cache[basis_id] = basis_tree
+        del basis_tree # We don't want to hang on to it here
         for offset in range(0, len(revision_ids), batch_size):
             self.target.start_write_group()
             try:
                 pb.update('Transferring revisions', offset,
                           len(revision_ids))
                 batch = revision_ids[offset:offset+batch_size]
-                basis_id, basis_tree = self._fetch_batch(batch,
-                    basis_id, basis_tree)
+                basis_id = self._fetch_batch(batch, basis_id, cache)
             except:
                 self.target.abort_write_group()
                 raise

=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py	2009-02-24 21:22:43 +0000
+++ b/bzrlib/smart/repository.py	2009-02-25 00:31:09 +0000
@@ -113,6 +113,8 @@
 class SmartServerRepositoryGetParentMap(SmartServerRepositoryRequest):
     """Bzr 1.2+ - get parent data for revisions during a graph search."""
 
+    no_extra_results = False
+
     def do_repository_request(self, repository, *revision_ids):
         """Get parent details for some revisions.
 
@@ -180,7 +182,8 @@
             # 64K (compressed) or so. We do one level of depth at a time to
             # stay in sync with the client. The 250000 magic number is
             # estimated compression ratio taken from bzr.dev itself.
-            if first_loop_done and size_so_far > 250000:
+            if self.no_extra_results or (
+                first_loop_done and size_so_far > 250000):
                 next_revs = set()
                 break
             # don't query things we've already queried

=== modified file 'bzrlib/tests/branch_implementations/test_push.py'
--- a/bzrlib/tests/branch_implementations/test_push.py	2009-01-17 01:30:58 +0000
+++ b/bzrlib/tests/branch_implementations/test_push.py	2009-02-25 00:31:09 +0000
@@ -26,6 +26,7 @@
     debug,
     errors,
     push,
+    repository,
     tests,
     )
 from bzrlib.branch import Branch
@@ -33,6 +34,7 @@
 from bzrlib.memorytree import MemoryTree
 from bzrlib.revision import NULL_REVISION
 from bzrlib.smart import client, server
+from bzrlib.smart.repository import SmartServerRepositoryGetParentMap
 from bzrlib.tests.branch_implementations.test_branch import TestCaseWithBranch
 from bzrlib.transport import get_transport
 from bzrlib.transport.local import LocalURLServer
@@ -224,6 +226,68 @@
         trunk.push(remote_branch)
         remote_branch.check()
 
+    def test_no_get_parent_map_after_insert_stream(self):
+        # Effort test for bug 331823
+        self.setup_smart_server_with_call_log()
+        # Make a local branch with four revisions.  Four revisions because:
+        # one to push, one there for _walk_to_common_revisions to find, one we
+        # don't want to access, one for luck :)
+        if isinstance(self.branch_format, branch.BranchReferenceFormat):
+            # This test could in principle apply to BranchReferenceFormat, but
+            # make_branch_builder doesn't support it.
+            raise tests.TestSkipped(
+                "BranchBuilder can't make reference branches.")
+        try:
+            builder = self.make_branch_builder('local')
+        except (errors.TransportNotPossible, errors.UninitializableFormat):
+            raise tests.TestNotApplicable('format not directly constructable')
+        builder.start_series()
+        builder.build_snapshot('first', None, [
+            ('add', ('', 'root-id', 'directory', ''))])
+        builder.build_snapshot('second', ['first'], [])
+        builder.build_snapshot('third', ['second'], [])
+        builder.build_snapshot('fourth', ['third'], [])
+        builder.finish_series()
+        local = builder.get_branch()
+        local = branch.Branch.open(self.get_vfs_only_url('local'))
+        # Initial push of three revisions
+        remote_bzrdir = local.bzrdir.sprout(
+            self.get_url('remote'), revision_id='third')
+        remote = remote_bzrdir.open_branch()
+        # Push fourth revision
+        self.reset_smart_call_log()
+        self.disableOptimisticGetParentMap()
+        self.assertFalse(local.is_locked())
+        local.push(remote)
+        hpss_call_names = [item[0].method for item in self.hpss_calls]
+        self.assertTrue('Repository.insert_stream' in hpss_call_names)
+        insert_stream_idx = hpss_call_names.index('Repository.insert_stream')
+        calls_after_insert_stream = hpss_call_names[insert_stream_idx:]
+        # After inserting the stream the client has no reason to query the
+        # remote graph any further.
+        self.assertEqual(
+            ['Repository.insert_stream', 'Repository.insert_stream', 'get',
+             'Branch.set_last_revision_info', 'Branch.unlock'],
+            calls_after_insert_stream)
+
+    def disableOptimisticGetParentMap(self):
+        # Tweak some class variables to stop remote get_parent_map calls asking
+        # for or receiving more data than the caller asked for.
+        old_flag = SmartServerRepositoryGetParentMap.no_extra_results
+        inter_classes = [repository.InterOtherToRemote,
+            repository.InterPackToRemotePack]
+        old_batch_sizes = []
+        for inter_class in inter_classes:
+            old_batch_sizes.append(
+                inter_class._walk_to_common_revisions_batch_size)
+            inter_class._walk_to_common_revisions_batch_size = 1
+        SmartServerRepositoryGetParentMap.no_extra_results = True
+        def reset_values():
+            SmartServerRepositoryGetParentMap.no_extra_results = old_flag
+            for inter_class, size in zip(inter_classes, old_batch_sizes):
+                inter_class._walk_to_common_revisions_batch_size = size
+        self.addCleanup(reset_values)
+
 
 class TestPushHook(TestCaseWithBranch):
 

=== modified file 'bzrlib/tests/per_repository/test_repository.py'
--- a/bzrlib/tests/per_repository/test_repository.py	2009-02-23 15:42:47 +0000
+++ b/bzrlib/tests/per_repository/test_repository.py	2009-02-24 15:11:43 +0000
@@ -23,6 +23,7 @@
 from bzrlib import (
     bzrdir,
     errors,
+    gpg,
     graph,
     osutils,
     remote,
@@ -424,7 +425,7 @@
         repo = wt.branch.repository
         repo.lock_write()
         repo.start_write_group()
-        repo.sign_revision('A', bzrlib.gpg.LoopbackGPGStrategy(None))
+        repo.sign_revision('A', gpg.LoopbackGPGStrategy(None))
         repo.commit_write_group()
         repo.unlock()
         old_signature = repo.get_signature_text('A')
@@ -591,7 +592,7 @@
         repo = tree.branch.repository
         repo.lock_write()
         repo.start_write_group()
-        repo.sign_revision('rev_id', bzrlib.gpg.LoopbackGPGStrategy(None))
+        repo.sign_revision('rev_id', gpg.LoopbackGPGStrategy(None))
         repo.commit_write_group()
         repo.unlock()
         repo.lock_read()
@@ -712,7 +713,7 @@
         repo = wt.branch.repository
         repo.lock_write()
         repo.start_write_group()
-        repo.sign_revision('A', bzrlib.gpg.LoopbackGPGStrategy(None))
+        repo.sign_revision('A', gpg.LoopbackGPGStrategy(None))
         repo.commit_write_group()
         repo.unlock()
         repo.lock_read()

=== modified file 'bzrlib/tests/test_read_bundle.py'
--- a/bzrlib/tests/test_read_bundle.py	2009-02-23 15:29:35 +0000
+++ b/bzrlib/tests/test_read_bundle.py	2009-02-24 08:11:42 +0000
@@ -72,8 +72,10 @@
     def create_test_bundle(self):
         out, wt = create_bundle_file(self)
         f = open('test_bundle', 'wb')
-        f.write(out.getvalue())
-        f.close()
+        try:
+            f.write(out.getvalue())
+        finally:
+            f.close()
         return wt
 
     def test_read_bundle_from_url_deprecated(self):
@@ -96,8 +98,10 @@
         out, wt = create_bundle_file(self)
         if self.get_transport().is_readonly():
             f = open('test_bundle', 'wb')
-            f.write(out.getvalue())
-            f.close()
+            try:
+                f.write(out.getvalue())
+            finally:
+                f.close()
         else:
             self.get_transport().put_file('test_bundle', out)
             self.log('Put to: %s', self.get_url('test_bundle'))

=== modified file 'setup.py'
--- a/setup.py	2009-02-11 15:33:31 +0000
+++ b/setup.py	2009-02-24 19:07:29 +0000
@@ -616,7 +616,7 @@
 
     # MSWSOCK.dll is a system-specific library, which py2exe accidentally pulls
     # in on Vista.
-    dll_excludes.append("MSWSOCK.dll")
+    dll_excludes.extend(["MSWSOCK.dll", "MSVCP60.dll", "powrprof.dll"])
     options_list = {"py2exe": {"packages": packages + list(additional_packages),
                                "includes": includes,
                                "excludes": excludes,

=== modified file 'tools/win32/build_release.py'
--- a/tools/win32/build_release.py	2009-02-11 15:45:01 +0000
+++ b/tools/win32/build_release.py	2009-02-24 20:43:40 +0000
@@ -5,10 +5,10 @@
 # values.
 VERSIONS = {
     'bzr': '1.12',
-    'qbzr': '0.9.7',
+    'qbzr': '0.9.8',
     'bzrtools': '1.12.0',
-    'bzr-svn': '0.5.0',
-    'subvertpy': '0.6.2',
+    'bzr-svn': '0.5.2',
+    'subvertpy': '0.6.4',
 }
 
 # This will be passed to 'make' to ensure we build with the right python




More information about the bazaar-commits mailing list