Rev 3391: (abentley) speed up no-op pull in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Apr 30 04:48:40 BST 2008


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

------------------------------------------------------------
revno: 3391
revision-id:pqm at pqm.ubuntu.com-20080430034827-95gmd3iu0j7vrr5p
parent: pqm at pqm.ubuntu.com-20080429155137-0w5littcl831pq4m
parent: aaron at aaronbentley.com-20080429191340-q0azlwbx2gha7m18
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-04-30 04:48:27 +0100
message:
  (abentley) speed up no-op pull
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.42
    revision-id:aaron at aaronbentley.com-20080429191340-q0azlwbx2gha7m18
    parent: aaron at aaronbentley.com-20080429175350-175taqt31h3v8der
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Tue 2008-04-29 15:13:40 -0400
    message:
      Add lock around branch pull
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.41
    revision-id:aaron at aaronbentley.com-20080429175350-175taqt31h3v8der
    parent: aaron at aaronbentley.com-20080429175137-ydw4zwn5fsf8g8pj
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Tue 2008-04-29 13:53:50 -0400
    message:
      Accelerate no-op pull
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.40
    revision-id:aaron at aaronbentley.com-20080429175137-ydw4zwn5fsf8g8pj
    parent: aaron at aaronbentley.com-20080428224739-1n5u92ht05c1hx2d
    parent: pqm at pqm.ubuntu.com-20080429155137-0w5littcl831pq4m
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Tue 2008-04-29 13:51:37 -0400
    message:
      Merge with bzr.dev
    modified:
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzr                            bzr.py-20050313053754-5485f144c7006fa6
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
      bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
      bzrlib/store/revision/knit.py  knit.py-20060303020652-de5fa299e941a3c7
      bzrlib/tests/blackbox/test_version.py test_version.py-20070312060045-ol7th9z035r3im3d-1
      bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
      bzrlib/tests/test_store.py     teststore.py-20050826022702-f6caadb647395769
      bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
      bzrlib/tests/tree_implementations/test_inv.py test_inv.py-20070312023226-0cdvk5uwhutis9vg-1
      bzrlib/tests/tree_implementations/test_test_trees.py test_tree_trees.py-20060720091921-3nwi5h21lf06vf5p-1
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
=== modified file 'NEWS'
--- a/NEWS	2008-04-29 13:43:40 +0000
+++ b/NEWS	2008-04-29 17:53:50 +0000
@@ -24,6 +24,9 @@
     * Diff now handles revision specs like "branch:" and "submit:" more
       efficiently.  (Aaron Bentley)
 
+    * Pull completes much faster when there is nothing to pull.
+      (Aaron Bentley)
+
   BUGFIXES:
 
     * Avoid muttering every time a child update does not cause a progress bar

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-04-29 01:42:32 +0000
+++ b/bzrlib/builtins.py	2008-04-29 19:13:40 +0000
@@ -669,22 +669,28 @@
                 raise errors.BzrCommandError(
                     'bzr pull --revision takes one value.')
 
-        if verbose:
-            old_rh = branch_to.revision_history()
-        if tree_to is not None:
-            change_reporter = delta._ChangeReporter(
-                unversioned_filter=tree_to.is_ignored)
-            result = tree_to.pull(branch_from, overwrite, revision_id,
-                                  change_reporter,
-                                  possible_transports=possible_transports)
-        else:
-            result = branch_to.pull(branch_from, overwrite, revision_id)
+        branch_to.lock_write()
+        try:
+            if tree_to is not None:
+                change_reporter = delta._ChangeReporter(
+                    unversioned_filter=tree_to.is_ignored)
+                result = tree_to.pull(branch_from, overwrite, revision_id,
+                                      change_reporter,
+                                      possible_transports=possible_transports)
+            else:
+                result = branch_to.pull(branch_from, overwrite, revision_id)
 
-        result.report(self.outf)
-        if verbose:
-            new_rh = branch_to.revision_history()
-            log.show_changed_revisions(branch_to, old_rh, new_rh,
-                                       to_file=self.outf)
+            result.report(self.outf)
+            if verbose and result.old_revid != result.new_revid:
+                old_rh = list(
+                    branch_to.repository.iter_reverse_revision_history(
+                    result.old_revid))
+                old_rh.reverse()
+                new_rh = branch_to.revision_history()
+                log.show_changed_revisions(branch_to, old_rh, new_rh,
+                                           to_file=self.outf)
+        finally:
+            branch_to.unlock()
 
 
 class cmd_push(Command):

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-04-28 05:54:46 +0000
+++ b/bzrlib/repository.py	2008-04-29 17:53:50 +0000
@@ -2380,12 +2380,14 @@
         :param revision_ids: The start point for the search.
         :return: A set of revision ids.
         """
-        graph = self.source.get_graph()
         target_graph = self.target.get_graph()
+        revision_ids = frozenset(revision_ids)
+        if set(target_graph.get_parent_map(revision_ids)) == revision_ids:
+            return graph.SearchResult(revision_ids, set(), 0, set())
         missing_revs = set()
+        source_graph = self.source.get_graph()
         # ensure we don't pay silly lookup costs.
-        revision_ids = frozenset(revision_ids)
-        searcher = graph._make_breadth_first_searcher(revision_ids)
+        searcher = source_graph._make_breadth_first_searcher(revision_ids)
         null_set = frozenset([_mod_revision.NULL_REVISION])
         while True:
             try:
@@ -2763,6 +2765,8 @@
                     find_ghosts=find_ghosts).get_keys()
             except errors.NoSuchRevision:
                 raise errors.InstallFailed([revision_id])
+            if len(revision_ids) == 0:
+                return (0, [])
         packs = self.source._pack_collection.all_packs()
         pack = Packer(self.target._pack_collection, packs, '.fetch',
             revision_ids).pack()




More information about the bazaar-commits mailing list