Rev 908: Add progress bar to revision_history() function in file:///data/jelmer/bzr-svn/revhistory-progress/

Jelmer Vernooij jelmer at samba.org
Wed Mar 12 16:09:56 GMT 2008


At file:///data/jelmer/bzr-svn/revhistory-progress/

------------------------------------------------------------
revno: 908
revision-id:jelmer at samba.org-20080312160955-qx05a8vgvl2e4t17
parent: jelmer at samba.org-20080312151424-slxtuacqbs0c6ods
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: revhistory-progress
timestamp: Wed 2008-03-12 17:09:55 +0100
message:
  Add progress bar to revision_history() function
modified:
  branch.py                      svnbranch.py-20051017135706-11c749eb0dab04a7
=== modified file 'branch.py'
--- a/branch.py	2007-12-23 03:23:00 +0000
+++ b/branch.py	2008-03-12 16:09:55 +0000
@@ -22,6 +22,7 @@
                            NotBranchError)
 from bzrlib.inventory import (Inventory)
 from bzrlib.revision import ensure_null
+from bzrlib.ui import ui_factory
 from bzrlib.workingtree import WorkingTree
 
 import svn.client, svn.core
@@ -200,11 +201,16 @@
     def _generate_revision_history(self, last_revnum):
         """Generate the revision history up until a specified revision."""
         revhistory = []
-        for (branch, rev) in self.repository.follow_branch(
-                self.get_branch_path(last_revnum), last_revnum, self.scheme):
-            revhistory.append(
-                self.repository.generate_revision_id(rev, branch, 
-                    str(self.scheme)))
+        pb = ui_factory.nested_progress_bar()
+        try:
+            for (branch, rev) in self.repository.follow_branch(
+                    self.get_branch_path(last_revnum), last_revnum, self.scheme):
+                pb.update("determining branch history", last_revnum-rev, last_revnum)
+                revhistory.append(
+                    self.repository.generate_revision_id(rev, branch, 
+                        str(self.scheme)))
+        finally:
+            pb.finished()
         revhistory.reverse()
         return revhistory
 




More information about the bazaar-commits mailing list