Rev 2: Add progress bar. in file:///data/jelmer/bzr-global-log/trunk/

Jelmer Vernooij jelmer at samba.org
Tue Nov 20 18:22:45 GMT 2007


At file:///data/jelmer/bzr-global-log/trunk/

------------------------------------------------------------
revno: 2
revision-id:jelmer at samba.org-20071103220227-i8pshd0fprcui4hz
parent: jelmer at samba.org-20071029013801-u851g57uy5vqi3lf
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2007-11-03 23:02:27 +0100
message:
  Add progress bar.
modified:
  __init__.py                    __init__.py-20071029004222-avdgq0mc7n1q6q8f-1
=== modified file '__init__.py'
--- a/__init__.py	2007-10-29 01:38:01 +0000
+++ b/__init__.py	2007-11-03 22:02:27 +0000
@@ -1,5 +1,6 @@
 #!/usr/bin/python
 
+from bzrlib import ui
 from bzrlib.branch import Branch
 from bzrlib.commands import Command, register_command
 from bzrlib.log import (log_formatter, log_formatter_registry, show_log, 
@@ -28,10 +29,17 @@
     takes_args = ["location*"]
 
     def run(self, location_list, log_format=None):
-        revs = set()
-        for location in location_list:
-            branch = Branch.open(location)
-            revs.update(GlobalLogRevision(branch=branch, rev=rev) for rev in branch.repository.get_revisions(filter(lambda x: x is not None, branch.repository.get_ancestry(branch.last_revision()))))
+        pb = ui.ui_factory.nested_progress_bar()
+        try:
+            revs = set()
+            for location in location_list:
+                pb.update("discovering revisions", 
+                          location_list.index(location),
+                          len(location_list))
+                branch = Branch.open(location)
+                revs.update(GlobalLogRevision(branch=branch, rev=rev) for rev in branch.repository.get_revisions(filter(lambda x: x is not None, branch.repository.get_ancestry(branch.last_revision()))))
+        finally:
+            pb.finished()
 
         revs = list(revs)
         revs.sort(revcmp)




More information about the bazaar-commits mailing list