Rev 3574: Fetch the revisions first. in http://bzr.arbash-meinel.com/branches/bzr/jam-integration

John Arbash Meinel john at arbash-meinel.com
Sat Jul 26 03:27:32 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/jam-integration

------------------------------------------------------------
revno: 3574
revision-id: john at arbash-meinel.com-20080726022711-j9xgk8xn7833b17w
parent: michael.hudson at canonical.com-20080723205513-o4otck9lsnenivha
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Fri 2008-07-25 21:27:11 -0500
message:
  Fetch the revisions first.
-------------- next part --------------
=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py	2008-06-25 10:06:48 +0000
+++ b/bzrlib/fetch.py	2008-07-26 02:27:11 +0000
@@ -261,29 +261,24 @@
     """
 
     def _fetch_revision_texts(self, revs, pb):
-        """Fetch revision object texts"""
-        count = 0
-        total = len(revs)
-        for rev in revs:
-            pb.update('copying revisions', count, total)
-            try:
-                sig_text = self.from_repository.get_signature_text(rev)
-                self.to_repository.add_signature_text(rev, sig_text)
-            except errors.NoSuchRevision:
-                # not signed.
-                pass
-            self._copy_revision(rev)
-            count += 1
-        # fixup inventory if needed: 
-        # this is expensive because we have no inverse index to current ghosts.
-        # but on local disk its a few seconds and sftp push is already insane.
-        # so we just-do-it.
-        # FIXME: repository should inform if this is needed.
+        # may need to be a InterRevisionStore call here.
+        to_sf = self.to_repository.signatures
+        from_sf = self.from_repository.signatures
+        # We fetch the revisions first, so that we don't end up with signatures
+        # without their matching revision.
+        self._fetch_just_revision_texts(revs)
+        # A missing signature is just skipped.
+        to_sf.insert_record_stream(filter_absent(from_sf.get_record_stream(
+            [(rev_id,) for rev_id in revs],
+            'unordered', False)))
         self.to_repository.reconcile()
 
-    def _copy_revision(self, rev_id):
-        rev = self.from_repository.get_revision(rev_id)
-        self.to_repository.add_revision(rev_id, rev)
+    def _fetch_just_revision_texts(self, version_ids):
+        to_rf = self.to_repository.revisions
+        from_rf = self.from_repository.revisions
+        to_rf.insert_record_stream(from_rf.get_record_stream(
+            [(rev_id,) for rev_id in version_ids],
+            'topological', False))
 
 
 class KnitRepoFetcher(RepoFetcher):



More information about the bazaar-commits mailing list