Rev 1270: Avoid threading - provide a receiver function directly when fetching data for the cache in logwalker. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4

Jelmer Vernooij jelmer at samba.org
Sun Jun 22 14:43:02 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.4

------------------------------------------------------------
revno: 1270
revision-id: jelmer at samba.org-20080622134301-ipt7j95at288i3t3
parent: jelmer at samba.org-20080622133550-ybfqafgay8gh1cei
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sun 2008-06-22 15:43:01 +0200
message:
  Avoid threading - provide a receiver function directly when fetching data for the cache in logwalker.
modified:
  logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
=== modified file 'logwalker.py'
--- a/logwalker.py	2008-06-22 13:35:50 +0000
+++ b/logwalker.py	2008-06-22 13:43:01 +0000
@@ -262,32 +262,32 @@
 
         pb = ui.ui_factory.nested_progress_bar()
 
+        def rcvr(orig_paths, revision, revprops):
+            pb.update('fetching svn revision info', revision, to_revnum)
+            if orig_paths is None:
+                orig_paths = {}
+            for p in orig_paths:
+                copyfrom_path = orig_paths[p][1]
+                if copyfrom_path is not None:
+                    copyfrom_path = copyfrom_path.strip("/")
+
+                self.cachedb.execute(
+                     "replace into changed_path (rev, path, action, copyfrom_path, copyfrom_rev) values (?, ?, ?, ?, ?)", 
+                     (revision, p.strip("/"), orig_paths[p][0], copyfrom_path, orig_paths[p][2]))
+            self.saved_revnum = revision
+            if self.saved_revnum % 1000 == 0:
+                self.cachedb.commit()
+
         try:
             try:
-                for (orig_paths, revision, revprops) in self.actual._transport.iter_log(None, self.saved_revnum, 
-                                         to_revnum, 0, True, 
-                                         True, []):
-                    pb.update('fetching svn revision info', revision, to_revnum)
-                    if orig_paths is None:
-                        orig_paths = {}
-                    for p in orig_paths:
-                        copyfrom_path = orig_paths[p][1]
-                        if copyfrom_path is not None:
-                            copyfrom_path = copyfrom_path.strip("/")
-
-                        self.cachedb.execute(
-                             "replace into changed_path (rev, path, action, copyfrom_path, copyfrom_rev) values (?, ?, ?, ?, ?)", 
-                             (revision, p.strip("/"), orig_paths[p][0], copyfrom_path, orig_paths[p][2]))
-                    self.saved_revnum = revision
-                    if self.saved_revnum % 1000 == 0:
-                        self.cachedb.commit()
-            finally:
-                pb.finished()
-        except SubversionException, (_, num):
-            if num == ERR_FS_NO_SUCH_REVISION:
-                raise NoSuchRevision(branch=self, 
-                    revision="Revision number %d" % to_revnum)
-            raise
+                self.actual._transport.get_log(rcvr, None, self.saved_revnum, to_revnum, 0, True, True, [])
+            except SubversionException, (_, num):
+                if num == ERR_FS_NO_SUCH_REVISION:
+                    raise NoSuchRevision(branch=self, 
+                        revision="Revision number %d" % to_revnum)
+                raise
+        finally:
+            pb.finished()
         self.cachedb.commit()
 
 




More information about the bazaar-commits mailing list