[Pkg-bazaar-commits] ./bzr/unstable r670: - Show progress while branching

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:20:39 UTC 2009


------------------------------------------------------------
revno: 670
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Sat 2005-06-11 11:35:24 +1000
message:
  - Show progress while branching
modified:
  bzrlib/branch.py
  bzrlib/store.py
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2005-06-10 09:34:32 +0000
+++ b/bzrlib/branch.py	2005-06-11 01:35:24 +0000
@@ -719,16 +719,29 @@
         >>> br1.text_store.total_size() == br2.text_store.total_size()
         True
         """
+        from bzrlib.progress import ProgressBar
+
+        pb = ProgressBar()
+
+        pb.update('comparing histories')
         revision_ids = self.missing_revisions(other)
-        revisions = [other.get_revision(f) for f in revision_ids]
+        revisions = []
         needed_texts = sets.Set()
-        for rev in revisions:
+        i = 0
+        for rev_id in revision_ids:
+            i += 1
+            pb.update('fetching revision', i, len(revision_ids))
+            rev = other.get_revision(rev_id)
+            revisions.append(rev)
             inv = other.get_inventory(str(rev.inventory_id))
             for key, entry in inv.iter_entries():
                 if entry.text_id is None:
                     continue
                 if entry.text_id not in self.text_store:
                     needed_texts.add(entry.text_id)
+
+        pb.clear()
+                    
         count = self.text_store.copy_multi(other.text_store, needed_texts)
         print "Added %d texts." % count 
         inventory_ids = [ f.inventory_id for f in revisions ]

=== modified file 'bzrlib/store.py'
--- a/bzrlib/store.py	2005-06-06 11:37:20 +0000
+++ b/bzrlib/store.py	2005-06-11 01:35:24 +0000
@@ -107,19 +107,26 @@
         f.write(content)
         f.close()
 
+
     def copy_multi(self, other, ids):
         """Copy texts for ids from other into self.
 
         If an id is present in self, it is skipped.  A count of copied
         ids is returned, which may be less than len(ids).
         """
+        from bzrlib.progress import ProgressBar
+        pb = ProgressBar()
+        pb.update('preparing to copy')
+        to_copy = [id for id in ids if id not in self]
         count = 0
-        for id in ids:
-            if id in self:
-                continue
+        for id in to_copy:
+            count += 1
+            pb.update('copy', count, len(to_copy))
             self.add(other[id], id)
-            count += 1
+        assert count == len(to_copy)
+        pb.clear()
         return count
+    
 
     def __contains__(self, fileid):
         """"""



More information about the Pkg-bazaar-commits mailing list