Rev 3822: Change the fetch logic to properly use the child_pb for child ops. in http://bazaar.launchpad.net/%7Ebzr/bzr/brisbane-core

John Arbash Meinel john at arbash-meinel.com
Wed Feb 18 16:36:52 GMT 2009


At http://bazaar.launchpad.net/%7Ebzr/bzr/brisbane-core

------------------------------------------------------------
revno: 3822
revision-id: john at arbash-meinel.com-20090218163618-isb3yg01ygdx3m2n
parent: john at arbash-meinel.com-20090218161422-9ncxfaeoqnmy59ee
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: brisbane-core
timestamp: Wed 2009-02-18 10:36:18 -0600
message:
  Change the fetch logic to properly use the child_pb for child ops.
  Also, change iter_interesting_nodes to use pb.update() with a counter.
  We don't know how many total, but we at least know how many so far.
-------------- next part --------------
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py	2009-02-18 16:14:22 +0000
+++ b/bzrlib/chk_map.py	2009-02-18 16:36:18 +0000
@@ -1367,11 +1367,13 @@
     interesting_keys.difference_update(all_uninteresting_chks)
 
     chks_to_read = interesting_keys
+    counter = 0
     while chks_to_read:
         next_chks = set()
         for record in store.get_record_stream(chks_to_read, 'unordered', False):
+            counter += 1
             if pb is not None:
-                pb.tick()
+                pb.update('find chk pages', counter)
             # TODO: Handle 'absent'?
             if record.storage_kind in ('fulltext', 'chunked'):
                 bytes = record.get_bytes_as('fulltext')

=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py	2009-02-10 22:54:46 +0000
+++ b/bzrlib/fetch.py	2009-02-18 16:36:18 +0000
@@ -233,20 +233,20 @@
     def _fetch_inventory_weave(self, revs, pb):
         pb.update("fetch inventory", 0, 2)
         to_weave = self.to_repository.inventories
+        # just merge, this is optimisable and its means we don't
+        # copy unreferenced data such as not-needed inventories.
+        pb.update("fetch inventory", 1, 3)
+        from_weave = self.from_repository.inventories
+        pb.update("fetch inventory", 2, 3)
+        # we fetch only the referenced inventories because we do not
+        # know for unselected inventories whether all their required
+        # texts are present in the other repository - it could be
+        # corrupt.
         child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
         try:
-            # just merge, this is optimisable and its means we don't
-            # copy unreferenced data such as not-needed inventories.
-            pb.update("fetch inventory", 1, 3)
-            from_weave = self.from_repository.inventories
-            pb.update("fetch inventory", 2, 3)
-            # we fetch only the referenced inventories because we do not
-            # know for unselected inventories whether all their required
-            # texts are present in the other repository - it could be
-            # corrupt.
             if (self.from_repository._format.supports_chks and
                 self.to_repository._format.supports_chks):
-                self._fetch_chk_inventories(revs, pb)
+                self._fetch_chk_inventories(revs, child_pb)
             elif (self.from_repository._format.supports_chks or
                 self.to_repository._format.supports_chks):
                 # Hack to make not-chk->chk fetch: copy the inventories as
@@ -254,7 +254,7 @@
                 total = len(revs)
                 for pos, inv in enumerate(
                     self.from_repository.iter_inventories(revs)):
-                    pb.update("Copying inventories", pos, total)
+                    child_pb.update("Copying inventories", pos, total)
                     self.to_repository.add_inventory(inv.revision_id, inv, [])
             else:
                 to_weave.insert_record_stream(from_weave.get_record_stream(
@@ -263,6 +263,7 @@
                     not self.to_repository._fetch_uses_deltas))
         finally:
             child_pb.finished()
+        pb.update("fetch inventory", 3, 3)
 
     def _fetch_revision_texts(self, revs, pb):
         # fetch signatures first and then the revision texts



More information about the bazaar-commits mailing list