deal with editor batons only in the transport code
authorJelmer Vernooij <jelmer@samba.org>
Tue, 23 Oct 2007 18:18:20 +0000 (20:18 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 23 Oct 2007 18:18:20 +0000 (20:18 +0200)
fetch.py
logwalker.py
transport.py
tree.py

index 8b8523d6ff32e8c9224e61a21ff4ec7c042585b7..dbfd5b0b7ce30aff8bd95daa52e6e4ca6b764e78 100644 (file)
--- a/fetch.py
+++ b/fetch.py
@@ -531,15 +531,14 @@ class InterFromSvnRepository(InterRepository):
                              id_map, scheme)
 
                 pool = Pool()
-                edit, edit_baton = svn.delta.make_editor(editor, pool)
 
                 if parent_revid is None:
                     branch_url = urlutils.join(repos_root, branch)
                     transport.reparent(branch_url)
                     assert transport.svn_url == branch_url.rstrip("/"), \
                         "Expected %r, got %r" % (transport.svn_url, branch_url)
-                    reporter = transport.do_update(
-                                   revnum, True, edit, edit_baton, pool)
+                    reporter = transport.do_update(revnum, True, editor,
+                                                   pool)
 
                     # Report status of existing paths
                     reporter.set_path("", revnum, True, None, pool)
@@ -552,10 +551,9 @@ class InterFromSvnRepository(InterRepository):
                         reporter = transport.do_switch(
                                    revnum, True, 
                                    urlutils.join(repos_root, branch), 
-                                   edit, edit_baton, pool)
+                                   editor, pool)
                     else:
-                        reporter = transport.do_update(
-                                   revnum, True, edit, edit_baton, pool)
+                        reporter = transport.do_update(revnum, True, editor)
 
                     # Report status of existing paths
                     reporter.set_path("", parent_revnum, False, None, pool)
index f962bd9975137adfdcf804d7c80c44080562cdf1..2750b4ea8a4309f0bbac0f41a53983bb28a42626 100644 (file)
@@ -334,12 +334,11 @@ class LogWalker(object):
                 pass
         pool = Pool()
         editor = TreeLister(path)
-        edit, baton = svn.delta.make_editor(editor, pool)
         old_base = transport.base
         try:
             root_repos = transport.get_svn_repos_root()
             transport.reparent(urlutils.join(root_repos, path))
-            reporter = transport.do_update(revnum,  True, edit, baton, pool)
+            reporter = transport.do_update(revnum, True, editor, pool)
             reporter.set_path("", revnum, True, None, pool)
             reporter.finish_report(pool)
         finally:
index 73938d8500e54aa3556be02e88fd890fa5f5d055..928193190fc32ac6ce2fc99a9d2e6f90ee4c534a 100644 (file)
@@ -307,13 +307,20 @@ class SvnRaTransport(Transport):
         self.mutter("svn get-latest-revnum")
         return svn.ra.get_latest_revnum(self._ra)
 
+    def _make_editor(self, editor, pool=None):
+        edit, edit_baton = svn.delta.make_editor(editor, pool)
+        self._edit = edit
+        self._edit_baton = edit_baton
+        return self._edit, self._edit_baton
+
     @convert_svn_error
-    def do_switch(self, switch_rev, recurse, switch_url, *args, **kwargs):
+    def do_switch(self, switch_rev, recurse, switch_url, editor, pool=None):
         self._open_real_transport()
         self.mutter('svn switch -r %d -> %r' % (switch_rev, switch_url))
         self._mark_busy()
+        edit, edit_baton = self._make_editor(editor, pool)
         return self.Reporter(self, svn.ra.do_switch(self._ra, switch_rev, "", 
-                             recurse, switch_url, *args, **kwargs))
+                             recurse, switch_url, edit, edit_baton, pool))
 
     @convert_svn_error
     @needs_busy
@@ -443,12 +450,13 @@ class SvnRaTransport(Transport):
             raise
 
     @convert_svn_error
-    def do_update(self, revnum, *args, **kwargs):
+    def do_update(self, revnum, recurse, editor, pool=None):
         self._open_real_transport()
         self.mutter('svn update -r %r' % revnum)
         self._mark_busy()
+        edit, edit_baton = self._make_editor(editor, pool)
         return self.Reporter(self, svn.ra.do_update(self._ra, revnum, "", 
-                             *args, **kwargs))
+                             recurse, edit, edit_baton, pool))
 
     def supports_custom_revprops(self):
         return has_attr(svn.ra, 'get_commit_editor3')
diff --git a/tree.py b/tree.py
index bb572238b951e00242e9309bdb41cb58cf501cf6..f15739f8550a9f9e2e5c713c476b452be6f7919a 100644 (file)
--- a/tree.py
+++ b/tree.py
@@ -65,13 +65,12 @@ class SvnRevisionTree(RevisionTree):
         self._inventory = Inventory()
         self.id_map = repository.get_fileid_map(self.revnum, self.branch_path, 
                                                 scheme)
-        self.editor = TreeBuildEditor(self, pool)
+        editor = TreeBuildEditor(self, pool)
         self.file_data = {}
-        editor, baton = svn.delta.make_editor(self.editor, pool)
         root_repos = repository.transport.get_svn_repos_root()
         reporter = repository.transport.do_switch(
                 self.revnum, True, 
-                urlutils.join(root_repos, self.branch_path), editor, baton, pool)
+                urlutils.join(root_repos, self.branch_path), editor, pool)
         reporter.set_path("", 0, True, None, pool)
         reporter.finish_report(pool)
         pool.destroy()