Rev 421: get rid of svn.ra.ls in favor of checkout. this should improve the amount of time required to determine the file id map of an indepedent revision tree significantly. in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev

Jelmer Vernooij jelmer at samba.org
Thu Feb 1 10:37:40 GMT 2007


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

------------------------------------------------------------
revno: 421
revision-id: jelmer at samba.org-20070201103709-z4xm1j5cwaezzxt0
parent: jelmer at samba.org-20070131131854-vp5bqzuy9zc3kizz
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Thu 2007-02-01 11:37:09 +0100
message:
  get rid of svn.ra.ls in favor of checkout. this should improve the amount of time required to determine the file id map of an indepedent revision tree significantly.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  README                         README-20051120210643-bd274a2fef9aed6a
  TODO                           todo-20060729211917-2kpobww0zyvvo0j2-1
  logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
=== modified file 'NEWS'
--- a/NEWS	2007-01-20 23:01:10 +0000
+++ b/NEWS	2007-02-01 10:37:09 +0000
@@ -18,6 +18,12 @@
    * Working tree copies will be disabled if the version of python-subversion 
      is too old.
 
+  PERFORMANCE
+
+   * do_update() is now used to find the contents of a directory recursively. 
+     This should reduce the number of roundtrips significantly when 
+	 finding file id mappings.
+
 
 bzr-svn 0.3	2007-01-16
 

=== modified file 'README'
--- a/README	2006-12-25 01:49:59 +0000
+++ b/README	2007-02-01 10:37:09 +0000
@@ -6,12 +6,12 @@
 
 == Dependencies == 
 
-You will need at least version 0.14 of Bazaar or higher.
+You will need at least version 0.15 of Bazaar or higher.
 
 You also need a fairly recent version of the Python bindings to the 
 Subversion libraries. At the moment, the svn plugin only works with 
-Subversion 1.5 (trunk). The python-subversion package in Ubuntu Edgy and 
-Debian Sid also contains the required changes.
+Subversion 1.5 (trunk). The python-subversion package in Ubuntu Feisty 
+and Debian Etch and Sid also contain the required changes. 
 
 If you are running an older version of Python (under 2.5), you will also 
 need to have the pysqlite package installed.

=== modified file 'TODO'
--- a/TODO	2007-01-31 12:02:55 +0000
+++ b/TODO	2007-02-01 10:37:09 +0000
@@ -1,5 +1,5 @@
 - simplify find_branches by using Transport.list_dir() ?
-- make scheme name part of revision id
+- replace 'undefined' by scheme name in revision ids
 - fix commits in heavyweight checkouts somehow
 - fix autorealm repository
 - handle parent directories of branches being moved correctly
@@ -9,7 +9,6 @@
 - custom implementation of WorkingTree.revert()
 - don't update all entries to the same revnum when opening working tree
 - avoid extra connect in logwalker?
-- get rid of use of `svn ls' in logwalker
 - make ListBranchingScheme() support wildcards
  - rewrite TrunkBranchingScheme() and ListBranchingScheme() as subclasses of 
    ListBranchingScheme()
@@ -17,6 +16,3 @@
 - more efficient implementation for applying txdeltas to weaves. perhaps convert svn deltas to bzr deltas?
 - free memory!
 - implement BzrDirFormat.get_converter()
-- implement find_children by doing a checkout of the subdirectory in 
-  question, rather then using recursive ls. Should improve the speed of 
-  a first use of bzr-svn in a lightweight checkout significantly.

=== modified file 'logwalker.py'
--- a/logwalker.py	2007-01-02 16:58:01 +0000
+++ b/logwalker.py	2007-02-01 10:37:09 +0000
@@ -251,25 +251,59 @@
 
     def find_children(self, path, revnum):
         """Find all children of path in revnum."""
-        # TODO: Find children by walking history, or use 
-        # cache?
-
-        try:
-            (dirents, _, _) = self.transport.get_dir(
-                path.lstrip("/").encode('utf8'), revnum, kind=True)
-        except SubversionException, (_, num):
-            if num == svn.core.SVN_ERR_FS_NOT_DIRECTORY:
-                return
-            raise
-
-        for p in dirents:
-            yield os.path.join(path, p)
-            # This needs to be != svn.core.svn_node_file because 
-            # some ra backends seem to return negative values for .kind.
-            # however, dirents[p].node seems to contain semi-random 
-            # values.
-            for c in self.find_children(os.path.join(path, p), revnum):
-                yield c
+        path = path.strip("/")
+        if self.transport.check_path(path, revnum) == svn.core.svn_node_file:
+            return []
+        class TreeLister(svn.delta.Editor):
+            def __init__(self, base):
+                self.files = []
+                self.base = base
+
+            def set_target_revision(self, revnum):
+                pass
+
+            def open_root(self, revnum, baton):
+                return path
+
+            def add_directory(self, path, parent_baton, copyfrom_path, copyfrom_revnum, pool):
+                self.files.append(os.path.join(self.base, path))
+                return path
+
+            def change_dir_prop(self, id, name, value, pool):
+                pass
+
+            def change_file_prop(self, id, name, value, pool):
+                pass
+
+            def add_file(self, path, parent_id, copyfrom_path, copyfrom_revnum, baton):
+                self.files.append(os.path.join(self.base, path))
+                return path
+
+            def close_dir(self, id):
+                pass
+
+            def close_file(self, path, checksum):
+                pass
+
+            def close_edit(self):
+                pass
+
+            def abort_edit(self):
+                pass
+
+            def apply_textdelta(self, file_id, base_checksum):
+                pass
+        pool = Pool()
+        editor = TreeLister(path)
+        edit, baton = svn.delta.make_editor(editor, pool)
+        root_repos = self.transport.get_repos_root()
+        self.transport.reparent(os.path.join(root_repos, path))
+        reporter, reporter_baton = self.transport.do_update(
+                        revnum, "", True, edit, baton, pool)
+        svn.ra.reporter2_invoke_set_path(reporter, reporter_baton, "", revnum, 
+                                         True, None, pool)
+        svn.ra.reporter2_invoke_finish_report(reporter, reporter_baton, pool)
+        return editor.files
 
     def get_previous(self, path, revnum):
         """Return path,revnum pair specified pair was derived from.




More information about the bazaar-commits mailing list