Rev 4: Add a progress bar, we may remove it later. in http://bzr.arbash-meinel.com/plugins/update_copyright

John Arbash Meinel john at arbash-meinel.com
Thu Jan 7 20:10:27 GMT 2010


At http://bzr.arbash-meinel.com/plugins/update_copyright

------------------------------------------------------------
revno: 4
revision-id: john at arbash-meinel.com-20100107201021-hjrnmy864y2tgb0b
parent: john at arbash-meinel.com-20100107200850-e5155e13n2elnx2f
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: update_copyright
timestamp: Thu 2010-01-07 14:10:21 -0600
message:
  Add a progress bar, we may remove it later.
-------------- next part --------------
=== modified file 'update_copyright.py'
--- a/update_copyright.py	2010-01-07 20:08:50 +0000
+++ b/update_copyright.py	2010-01-07 20:10:21 +0000
@@ -24,6 +24,7 @@
 from bzrlib import (
     graph,
     lazy_regex,
+    ui,
     )
 
 
@@ -65,12 +66,17 @@
         basis_tree = tree.basis_tree()
         basis_tree.lock_read()
         try:
-            file_ids = tree.paths2ids(relpaths, trees=[basis_tree])
-            for path, ie in tree.iter_entries_by_dir(file_ids):
-                if ie.kind == 'file':
-                    result['count'] += 1
-                    action = update_copyright(tree, basis_tree, path)
-                    result[action] += 1
+            pb = ui.ui_factory.nested_progress_bar()
+            try:
+                file_ids = tree.paths2ids(relpaths, trees=[basis_tree])
+                for path, ie in tree.iter_entries_by_dir(file_ids):
+                    if ie.kind == 'file':
+                        result['count'] += 1
+                        action = update_copyright(tree, basis_tree, path)
+                        result[action] += 1
+                        pb.update(action, result[action], result['count'])
+            finally:
+                pb.finished()
         finally:
             basis_tree.unlock()
     finally:



More information about the bazaar-commits mailing list