Rev 1828: Support progress bar while listing branch contents. in file:///data/jelmer/bzr-svn/trunk/

Jelmer Vernooij jelmer at samba.org
Sat Sep 6 14:34:49 BST 2008


At file:///data/jelmer/bzr-svn/trunk/

------------------------------------------------------------
revno: 1828
revision-id: jelmer at samba.org-20080906133447-1999zvhfop4o0724
parent: jelmer at samba.org-20080906125532-3awjtlzrf5f63hjq
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2008-09-06 15:34:47 +0200
message:
  Support progress bar while listing branch contents.
modified:
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
  revmeta.py                     revmeta.py-20080901215045-n8a6arqybs9ez5hl-1
=== modified file 'fetch.py'
--- a/fetch.py	2008-09-06 12:55:32 +0000
+++ b/fetch.py	2008-09-06 13:34:47 +0000
@@ -657,8 +657,7 @@
                 elif not find_ghosts:
                     break
                 checked.add(revid)
-            return [(meta_map[revid], mapping) 
-                      for revid in reversed(revs)]
+            return [(meta_map[revid], mapping) for revid in reversed(revs)]
 
         needed = check_revid(revision_id)
 

=== modified file 'logwalker.py'
--- a/logwalker.py	2008-09-05 21:28:56 +0000
+++ b/logwalker.py	2008-09-06 13:34:47 +0000
@@ -507,7 +507,7 @@
                     revision="Revision number %d" % revnum)
             raise
 
-    def find_children(self, path, revnum):
+    def find_children(self, path, revnum, pb=None):
         """Find all children of path in revnum.
 
         :param path:  Path to check
@@ -518,9 +518,13 @@
         conn = self._transport.connections.get(self._transport.get_svn_repos_root())
         results = []
         unchecked_dirs = set([path])
+        num_checked = 0
         try:
             while len(unchecked_dirs) > 0:
+                if pb is not None:
+                    pb.update("listing branch contents", num_checked, num_checked+len(unchecked_dirs))
                 nextp = unchecked_dirs.pop()
+                num_checked += 1
                 try:
                     dirents = conn.get_dir(nextp, revnum, DIRENT_KIND)[0]
                 except SubversionException, (_, num):

=== modified file 'revmeta.py'
--- a/revmeta.py	2008-09-05 22:08:25 +0000
+++ b/revmeta.py	2008-09-06 13:34:47 +0000
@@ -13,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from bzrlib import errors
+from bzrlib import errors, ui
 from bzrlib.revision import NULL_REVISION, Revision
 
 from bzrlib.plugins.svn import changes, core, errors as svn_errors, logwalker, properties
@@ -31,8 +31,12 @@
     :param from_bp: Path to look up children in
     :param from_rev: Revision to look up children in.
     """
-    for c in find_children(from_bp, from_rev):
-        paths[changes.rebase_path(c, from_bp, bp)] = ('A', None, -1)
+    pb = ui.ui_factory.nested_progress_bar()
+    try:
+        for c in find_children(from_bp, from_rev, pb):
+            paths[changes.rebase_path(c, from_bp, bp)] = ('A', None, -1)
+    finally:
+        pb.finished()
     return paths
 
 
@@ -418,6 +422,7 @@
                 not (mapping is None or mapping.is_branch(next[0]) or mapping.is_tag(next[0]))):
                 # Make it look like the branch started here if the mapping 
                 # doesn't support weird paths as branches
+                # TODO: Make this quicker - it can be very slow for large repos.
                 lazypaths = logwalker.lazy_dict(paths, full_paths, self._log.find_children, paths, bp, next[0], next[1])
                 paths[bp] = ('A', None, -1)
 




More information about the bazaar-commits mailing list