Rev 987: More completeness. in file:///data/jelmer/bzr-svn/pyrex/

Jelmer Vernooij jelmer at samba.org
Sun Mar 16 05:24:23 GMT 2008


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

------------------------------------------------------------
revno: 987
revision-id:jelmer at samba.org-20080316052421-ua97xas37gg20ebn
parent: jelmer at samba.org-20080316043139-wamvi3s8dli6k887
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pyrex
timestamp: Sun 2008-03-16 06:24:21 +0100
message:
  More completeness.
modified:
  client.pyx                     client.pyx-20080313235339-wbyjbw2namuiql8f-1
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
  constants.py                   constants.py-20080313210342-fuq3eruf2102bwml-1
  core.pyx                       core.pyx-20080313210413-17k59slolpfe5kdq-1
  delta.py                       delta.py-20080316001917-xyng7m3jlxvdc4c9-1
  mapping.py                     mapping.py-20080128201303-6cp01phc0dmc0kiv-1
  ra.pyx                         ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
  transport.py                   transport.py-20060406231150-b3472d06b3a0818d
=== modified file 'client.pyx'
--- a/client.pyx	2008-03-16 02:16:20 +0000
+++ b/client.pyx	2008-03-16 05:24:21 +0000
@@ -26,6 +26,7 @@
 cdef extern from "Python.h":
     void Py_INCREF(object)
     void Py_DECREF(object)
+    object PyString_FromStringAndSize(char *, unsigned long)
 
 cdef extern from "svn_opt.h":
     ctypedef enum svn_opt_revision_kind:
@@ -134,6 +135,29 @@
                    svn_client_ctx_t *ctx,
                    apr_pool_t *pool)
 
+    svn_error_t *svn_client_revprop_get(char *propname,
+                       svn_string_t **propval,
+                       char *URL,
+                       svn_opt_revision_t *revision,
+                       svn_revnum_t *set_rev,
+                       svn_client_ctx_t *ctx,
+                       apr_pool_t *pool)
+
+    svn_error_t *svn_client_revprop_set(char *propname,
+                       svn_string_t *propval,
+                       char *URL,
+                       svn_opt_revision_t *revision,
+                       svn_revnum_t *set_rev,
+                       svn_boolean_t force,
+                       svn_client_ctx_t *ctx,
+                       apr_pool_t *pool)
+
+    svn_error_t *svn_client_revprop_list(apr_hash_t **props,
+                        char *URL,
+                        svn_opt_revision_t *revision,
+                        svn_revnum_t *set_rev,
+                        svn_client_ctx_t *ctx,
+                        apr_pool_t *pool)
      
 cdef svn_error_t *py_log_msg_func2(char **log_msg, char **tmp_file, apr_array_header_t *commit_items, baton, apr_pool_t *pool) except *:
     py_commit_items = []
@@ -227,3 +251,23 @@
                 string_list_to_apr_array(self.pool, paths), &c_rev, 
                 recurse, ignore_externals, self.client, self.pool))
         # FIXME: Convert and return result_revs
+
+    def revprop_get(self,propname, propval, url, rev=None):
+        cdef svn_revnum_t set_rev
+        cdef svn_opt_revision_t c_rev
+        cdef svn_string_t *c_val
+        to_opt_revision(rev, &c_rev)
+        check_error(svn_client_revprop_get(propname, &c_val, url, 
+                    &c_rev, &set_rev, self.client, self.pool))
+        return (PyString_FromStringAndSize(c_val.data, c_val.len), set_rev)
+
+    def revprop_set(self,propname, propval, url, rev=None, force=False):
+        cdef svn_revnum_t set_rev
+        cdef svn_opt_revision_t c_rev
+        cdef svn_string_t c_val
+        to_opt_revision(rev, &c_rev)
+        c_val.data = propval
+        c_val.len = len(propval)
+        check_error(svn_client_revprop_set(propname, &c_val, url, 
+                    &c_rev, &set_rev, force, self.client, self.pool))
+        return set_rev

=== modified file 'commit.py'
--- a/commit.py	2008-03-15 20:33:59 +0000
+++ b/commit.py	2008-03-16 05:24:21 +0000
@@ -182,28 +182,28 @@
         """See CommitBuilder.modified_directory()."""
         self.modified_dirs.add(file_id)
 
-    def _file_process(self, file_id, contents, baton):
+    def _file_process(self, file_id, contents, file_editor):
         """Pass the changes to a file to the Subversion commit editor.
 
         :param file_id: Id of the file to modify.
         :param contents: Contents of the file.
-        :param baton: Baton under which the file is known to the editor.
+        :param file_editor: Editor for this file
         """
-        assert baton is not None
-        txdelta = self.editor.apply_textdelta(baton, None)
+        assert file_editor is not None
+        txdelta = file_editor.apply_textdelta(None)
         digest = txdelta_send_stream(StringIO(contents), txdelta)
         if 'validate' in debug.debug_flags:
             from fetch import md5_strings
             assert digest == md5_strings(contents)
 
-    def _dir_process(self, path, file_id, baton):
+    def _dir_process(self, path, file_id, dir_editor):
         """Pass the changes to a directory to the commit editor.
 
         :param path: Path (from repository root) to the directory.
         :param file_id: File id of the directory
-        :param baton: Baton of the directory for the editor.
+        :param dir_editor: Editor for the directory.
         """
-        assert baton is not None
+        assert dir_editor is not None
         # Loop over entries of file_id in self.old_inv
         # remove if they no longer exist with the same name
         # or parents
@@ -219,9 +219,9 @@
                     # ... name changed
                     self.new_inventory[child_ie.file_id].name != child_name):
                     self.mutter('removing %r(%r)' % (child_name, child_ie.file_id))
-                    self.editor.delete_entry(
+                    dir_editor.delete_entry(
                         urlutils.join(self.branch.get_branch_path(), path, child_name), 
-                        self.base_revnum, baton)
+                        self.base_revnum)
 
         # Loop over file children of file_id in self.new_inventory
         for child_name in self.new_inventory[file_id].children:
@@ -235,9 +235,9 @@
             # add them if they didn't exist in old_inv 
             if not child_ie.file_id in self.old_inv:
                 self.mutter('adding %s %r' % (child_ie.kind, new_child_path))
-                child_baton = self.editor.add_file(
+                child_editor = dir_editor.add_file(
                     urlutils.join(self.branch.get_branch_path(), 
-                                  new_child_path), baton, None, -1)
+                                  new_child_path))
 
 
             # copy if they existed at different location
@@ -246,8 +246,8 @@
                 self.mutter('copy %s %r -> %r' % (child_ie.kind, 
                                   self.old_inv.id2path(child_ie.file_id), 
                                   new_child_path))
-                child_baton = self.editor.add_file(
-                    urlutils.join(self.branch.get_branch_path(), new_child_path), baton, 
+                child_editor = dir_editor.add_file(
+                    urlutils.join(self.branch.get_branch_path(), new_child_path), 
                     urlutils.join(self.repository.transport.svn_url, self.base_path, self.old_inv.id2path(child_ie.file_id)),
                     self.base_revnum)
 
@@ -255,15 +255,14 @@
             elif child_ie.revision is None:
                 self.mutter('open %s %r' % (child_ie.kind, new_child_path))
 
-                child_baton = self.editor.open_file(
+                child_editor = dir_editor.open_file(
                     urlutils.join(self.branch.get_branch_path(), 
-                        new_child_path), 
-                    baton, self.base_revnum)
+                        new_child_path), self.base_revnum)
 
             else:
                 # Old copy of the file was retained. No need to send changes
                 assert child_ie.file_id not in self.modified_files
-                child_baton = None
+                child_editor = None
 
             if child_ie.file_id in self.old_inv:
                 old_executable = self.old_inv[child_ie.file_id].executable
@@ -272,14 +271,13 @@
                 old_special = False
                 old_executable = False
 
-            if child_baton is not None:
+            if child_editor is not None:
                 if old_executable != child_ie.executable:
                     if child_ie.executable:
                         value = core.SVN_PROP_EXECUTABLE_VALUE
                     else:
                         value = None
-                    self.editor.change_file_prop(child_baton, 
-                            core.SVN_PROP_EXECUTABLE, value)
+                    child_editor.change_prop(core.SVN_PROP_EXECUTABLE, value)
 
                 if old_special != (child_ie.kind == 'symlink'):
                     if child_ie.kind == 'symlink':
@@ -287,16 +285,15 @@
                     else:
                         value = None
 
-                    self.editor.change_file_prop(child_baton, 
-                            core.SVN_PROP_SPECIAL, value)
+                    child_editor.change_prop(core.SVN_PROP_SPECIAL, value)
 
             # handle the file
             if child_ie.file_id in self.modified_files:
                 self._file_process(child_ie.file_id, 
-                    self.modified_files[child_ie.file_id], child_baton)
+                    self.modified_files[child_ie.file_id], child_editor)
 
-            if child_baton is not None:
-                self.editor.close_file(child_baton, None)
+            if child_editor is not None:
+                child_editor.close()
 
         # Loop over subdirectories of file_id in self.new_inventory
         for child_name in self.new_inventory[file_id].children:
@@ -308,17 +305,16 @@
             # add them if they didn't exist in old_inv 
             if not child_ie.file_id in self.old_inv:
                 self.mutter('adding dir %r' % child_ie.name)
-                child_baton = self.editor.add_directory(
+                child_editor = dir_editor.add_directory(
                     urlutils.join(self.branch.get_branch_path(), 
-                                  new_child_path), baton, None, -1)
+                                  new_child_path))
 
             # copy if they existed at different location
             elif self.old_inv.id2path(child_ie.file_id) != new_child_path:
                 old_child_path = self.old_inv.id2path(child_ie.file_id)
                 self.mutter('copy dir %r -> %r' % (old_child_path, new_child_path))
-                child_baton = self.editor.add_directory(
+                child_editor = dir_editor.add_directory(
                     urlutils.join(self.branch.get_branch_path(), new_child_path),
-                    baton, 
                     urlutils.join(self.repository.transport.svn_url, self.base_path, old_child_path), self.base_revnum)
 
             # open if they existed at the same location and 
@@ -326,24 +322,24 @@
             elif self.new_inventory[child_ie.file_id].revision is None:
                 self.mutter('open dir %r' % new_child_path)
 
-                child_baton = self.editor.open_directory(
+                child_editor = self.editor.open_directory(
                         urlutils.join(self.branch.get_branch_path(), new_child_path), 
-                        baton, self.base_revnum)
+                        self.base_revnum)
             else:
                 assert child_ie.file_id not in self.modified_dirs
                 continue
 
             # Handle this directory
             if child_ie.file_id in self.modified_dirs:
-                self._dir_process(new_child_path, child_ie.file_id, child_baton)
-
-            self.editor.close_directory(child_baton)
-
-    def open_branch_batons(self, root, elements, existing_elements, 
+                self._dir_process(new_child_path, child_ie.file_id, child_editor)
+
+            child_editor.close()
+
+    def open_branch_editors(self, root, elements, existing_elements, 
                            base_path, base_rev, replace_existing):
-        """Open a specified directory given a baton for the repository root.
+        """Open a specified directory given an editor for the repository root.
 
-        :param root: Baton for the repository root
+        :param root: Editor for the repository root
         :param elements: List of directory names to open
         :param existing_elements: List of directory names that exist
         :param base_path: Path to base top-level branch on
@@ -358,8 +354,7 @@
         # Open paths leading up to branch
         for i in range(0, len(elements)-1):
             # Does directory already exist?
-            ret.append(self.editor.open_directory(
-                "/".join(existing_elements[0:i+1]), ret[-1], -1))
+            ret.append(ret[-1].open_directory("/".join(existing_elements[0:i+1]), -1))
 
         if (len(existing_elements) != len(elements) and
             len(existing_elements)+1 != len(elements)):
@@ -372,8 +367,8 @@
         # branch_path.
         if (len(existing_elements) == len(elements) and 
             not replace_existing):
-            ret.append(self.editor.open_directory(
-                "/".join(elements), ret[-1], base_rev))
+            ret.append(ret[-1].open_directory(
+                "/".join(elements), base_rev))
         else: # Branch has to be created
             # Already exists, old copy needs to be removed
             name = "/".join(elements)
@@ -381,14 +376,14 @@
                 if name == "":
                     raise ChangesRootLHSHistory()
                 self.mutter("removing branch dir %r" % name)
-                self.editor.delete_entry(name, -1, ret[-1])
+                ret[-1].delete_entry(name, -1)
             if base_path is not None:
                 base_url = urlutils.join(self.repository.transport.svn_url, base_path)
             else:
                 base_url = None
             self.mutter("adding branch dir %r" % name)
-            ret.append(self.editor.add_directory(
-                name, ret[-1], base_url, base_rev))
+            ret.append(ret[-1].add_directory(
+                name, base_url, base_rev))
 
         return ret
 
@@ -469,21 +464,21 @@
                     replace_existing = True
 
             # TODO: Accept create_prefix argument (#118787)
-            branch_batons = self.open_branch_batons(root, bp_parts,
+            branch_editors = self.open_branch_editors(root, bp_parts,
                 existing_bp_parts, self.base_path, self.base_revnum, 
                 replace_existing)
 
             self._dir_process("", self.new_inventory.root.file_id, 
-                branch_batons[-1])
+                branch_editors[-1])
 
             # Set all the revprops
             for prop, value in self._svnprops.items():
                 if value is not None:
                     value = value.encode('utf-8')
-                self.editor.change_dir_prop(branch_batons[-1], prop, value)
+                branch_editors[-1].change_prop(prop, value)
 
-            for baton in reversed(branch_batons):
-                self.editor.close_directory(baton)
+            for dir_editor in reversed(branch_editors):
+                dir_editor.close()
 
             self.editor.close()
         finally:

=== modified file 'constants.py'
--- a/constants.py	2008-03-15 23:17:29 +0000
+++ b/constants.py	2008-03-16 05:24:21 +0000
@@ -59,3 +59,7 @@
 PROP_ENTRY_LAST_AUTHOR = 'svn:entry:last-author'
 PROP_ENTRY_LOCK_TOKEN = 'svn:entry:lock-token'
 PROP_ENTRY_UUID = 'svn:entry:uuid'
+
+PROP_REVISION_LOG = "svn:log"
+PROP_REVISION_AUTHOR = "svn:author"
+PROP_REVISION_DATE = "svn:date"

=== modified file 'core.pyx'
--- a/core.pyx	2008-03-16 02:46:33 +0000
+++ b/core.pyx	2008-03-16 05:24:21 +0000
@@ -18,6 +18,7 @@
 from apr cimport apr_initialize, apr_status_t, apr_time_t, apr_hash_t
 from apr cimport apr_pool_t, apr_pool_create, apr_pool_destroy
 from apr cimport apr_array_header_t, apr_array_make, apr_array_push
+from apr cimport apr_hash_index_t, apr_hash_this, apr_hash_first, apr_hash_next
 
 apr_initialize()
 
@@ -78,11 +79,6 @@
     return when
 
 
-SVN_PROP_REVISION_LOG = "svn:log"
-SVN_PROP_REVISION_AUTHOR = "svn:author"
-SVN_PROP_REVISION_DATE = "svn:date"
-
-
 cdef extern from "svn_config.h":
     svn_error_t *svn_config_get_config(apr_hash_t **cfg_hash,
                                        char *config_dir,
@@ -91,7 +87,11 @@
 def get_config(config_dir=None):
     cdef apr_pool_t *pool
     cdef apr_hash_t *cfg_hash
+    cdef apr_hash_index_t *idx
     cdef char *c_config_dir
+    cdef char *key
+    cdef char *val
+    cdef long klen
     pool = Pool(NULL)
     if config_dir is None:
         c_config_dir = NULL
@@ -99,7 +99,11 @@
         c_config_dir = config_dir
     check_error(svn_config_get_config(&cfg_hash, c_config_dir, pool))
     ret = {}
-    # FIXME: Convert cfghash to ret
+    idx = apr_hash_first(pool, cfg_hash)
+    while idx:
+        apr_hash_this(idx, <void **>&key, &klen, <void **>&val)
+        ret[key] = val
+        idx = apr_hash_next(idx)
     apr_pool_destroy(pool)
     return ret
 

=== modified file 'delta.py'
--- a/delta.py	2008-03-16 00:33:02 +0000
+++ b/delta.py	2008-03-16 05:24:21 +0000
@@ -19,7 +19,7 @@
     assert hasattr(src_stream, 'read')
     assert hasattr(target_stream, 'write')
 
-    def wrapper(window):
-        print window
+    def wrapper(*args):
+        print args
 
     return wrapper

=== modified file 'mapping.py'
--- a/mapping.py	2008-03-16 04:31:39 +0000
+++ b/mapping.py	2008-03-16 05:24:21 +0000
@@ -25,6 +25,7 @@
 import sha
 import time
 import urllib
+import constants
 
 MAPPING_VERSION = 3
 
@@ -139,12 +140,12 @@
     return filter(lambda x: x != "", line.split("\t"))
 
 def parse_svn_revprops(svn_revprops, rev):
-    if svn_revprops.has_key(core.SVN_PROP_REVISION_AUTHOR):
-        rev.committer = svn_revprops[core.SVN_PROP_REVISION_AUTHOR]
+    if svn_revprops.has_key(constants.PROP_REVISION_AUTHOR):
+        rev.committer = svn_revprops[constants.PROP_REVISION_AUTHOR]
     else:
         rev.committer = ""
 
-    rev.message = svn_revprops.get(core.SVN_PROP_REVISION_LOG)
+    rev.message = svn_revprops.get(constants.PROP_REVISION_LOG)
 
     if rev.message:
         try:
@@ -152,8 +153,8 @@
         except UnicodeDecodeError:
             pass
 
-    if svn_revprops.has_key(core.SVN_PROP_REVISION_DATE):
-        rev.timestamp = 1.0 * core.secs_from_timestr(svn_revprops[core.SVN_PROP_REVISION_DATE], None)
+    if svn_revprops.has_key(constants.PROP_REVISION_DATE):
+        rev.timestamp = 1.0 * core.secs_from_timestr(svn_revprops[constants.PROP_REVISION_DATE], None)
     else:
         rev.timestamp = 0.0 # FIXME: Obtain repository creation time
     rev.timezone = None

=== modified file 'ra.pyx'
--- a/ra.pyx	2008-03-16 04:31:39 +0000
+++ b/ra.pyx	2008-03-16 05:24:21 +0000
@@ -21,7 +21,7 @@
 from apr cimport apr_initialize
 from core cimport check_error, Pool, wrap_lock, string_list_to_apr_array
 from core import SubversionException
-from core import SVN_PROP_REVISION_LOG, SVN_PROP_REVISION_AUTHOR, SVN_PROP_REVISION_DATE
+from constants import PROP_REVISION_LOG, PROP_REVISION_AUTHOR, PROP_REVISION_DATE
 from types cimport svn_error_t, svn_revnum_t, svn_string_t, svn_version_t
 from types cimport svn_string_ncreate, svn_lock_t, svn_auth_baton_t, svn_auth_open, svn_auth_set_parameter, svn_auth_get_parameter, svn_node_kind_t, svn_commit_info_t, svn_stream_t, svn_filesize_t, svn_dirent_t
 
@@ -159,11 +159,11 @@
             idx = apr_hash_next(idx)
     revprops = {}    
     if message != NULL:
-        revprops[SVN_PROP_REVISION_LOG] = message
+        revprops[PROP_REVISION_LOG] = message
     if author != NULL:
-        revprops[SVN_PROP_REVISION_AUTHOR] = author
+        revprops[PROP_REVISION_AUTHOR] = author
     if date != NULL:
-        revprops[SVN_PROP_REVISION_DATE] = date
+        revprops[PROP_REVISION_DATE] = date
     baton(py_changed_paths, revision, revprops)
 
 cdef extern from "svn_ra.h":
@@ -175,7 +175,7 @@
                            long revision,
                            int start_empty,
                            char *lock_token,
-						   apr_pool_t *pool) except *
+                           apr_pool_t *pool) except *
 
         svn_error_t *(*delete_path)(void *report_baton, 
                 char *path, apr_pool_t *pool) except *
@@ -199,24 +199,24 @@
                                                   char *relpath,
                                                   char *name,
                                                   svn_string_t **value,
-                                                  apr_pool_t *pool)
+                                                  apr_pool_t *pool) except *
 
     ctypedef svn_error_t *(*svn_ra_set_wc_prop_func_t)(void *baton,
                                                   char *path,
                                                   char *name,
                                                   svn_string_t *value,
-                                                  apr_pool_t *pool)
+                                                  apr_pool_t *pool) except *
 
     ctypedef svn_error_t *(*svn_ra_push_wc_prop_func_t)(void *baton,
                                                    char *path,
                                                    char *name,
                                                    svn_string_t *value,
-                                                   apr_pool_t *pool)
+                                                   apr_pool_t *pool) except *
 
     ctypedef svn_error_t *(*svn_ra_invalidate_wc_props_func_t)(void *baton,
                                                           char *path,
                                                           char *name,
-                                                          apr_pool_t *pool)
+                                                          apr_pool_t *pool) except *
 
     ctypedef struct svn_ra_callbacks2_t:
         svn_error_t *(*open_tmp_file)(apr_file_t **fp, 
@@ -344,7 +344,7 @@
                                                int do_lock,
                                                svn_lock_t *lock,
                                                svn_error_t *ra_err,
-                                               apr_pool_t *pool)
+                                               apr_pool_t *pool) except *
 
     svn_error_t * svn_ra_unlock(svn_ra_session_t *session,
                   apr_hash_t *path_tokens,
@@ -364,7 +364,7 @@
 
 cdef svn_error_t *py_lock_func (baton, char *path, int do_lock, 
                                 svn_lock_t *lock, svn_error_t *ra_err, 
-                                apr_pool_t *pool):
+                                apr_pool_t *pool) except *:
     py_ra_err = None
     if ra_err != NULL:
         py_ra_err = SubversionException(ra_err.apr_err, ra_err.message)
@@ -754,7 +754,7 @@
 
     def get_log(self, callback, paths, start, end, limit=0, 
                 discover_changed_paths=True, strict_node_history=True,
-                revprops=[SVN_PROP_REVISION_LOG,SVN_PROP_REVISION_AUTHOR,SVN_PROP_REVISION_DATE]):
+                revprops=[PROP_REVISION_LOG,PROP_REVISION_AUTHOR,PROP_REVISION_DATE]):
         cdef apr_pool_t *temp_pool
         temp_pool = Pool(NULL)
         check_error(svn_ra_get_log(self.ra, 
@@ -815,10 +815,18 @@
     def rev_proplist(self, rev):
         cdef apr_pool_t *temp_pool
         cdef apr_hash_t *props
+        cdef apr_hash_index_t *idx
+        cdef char *key
+        cdef long klen
+        cdef svn_string_t *val
         temp_pool = Pool(self.pool)
         check_error(svn_ra_rev_proplist(self.ra, rev, &props, temp_pool))
         py_props = {}
-        # FIXME: Convert props to py_props
+        idx = apr_hash_first(temp_pool, props)
+        while idx:
+            apr_hash_this(idx, <void **>&key, &klen, <void **>&val)
+            py_props[key] = PyString_FromStringAndSize(val.data, val.len)
+            idx = apr_hash_next(idx)
         apr_pool_destroy(temp_pool)
         return py_props
 
@@ -837,7 +845,7 @@
             for k, v in lock_tokens.items():
                 apr_hash_set(hash_lock_tokens, k, len(k), <char *>v)
         check_error(svn_ra_get_commit_editor2(self.ra, &editor, 
-            &edit_baton, revprops[SVN_PROP_REVISION_LOG], py_commit_callback, 
+            &edit_baton, revprops[PROP_REVISION_LOG], py_commit_callback, 
             commit_callback, hash_lock_tokens, keep_locks, temp_pool))
         apr_pool_destroy(temp_pool)
         py_editor = Editor()
@@ -935,7 +943,9 @@
         cdef apr_pool_t *temp_pool
         cdef apr_hash_t *hash_path_tokens
         temp_pool = Pool(self.pool)
-        # FIXME: Convert path_tokens to a apr_hash
+        hash_path_tokens = apr_hash_make(temp_pool)
+        for k, v in path_tokens:
+            apr_hash_set(hash_path_tokens, k, len(k), <char *>v)
         check_error(svn_ra_unlock(self.ra, hash_path_tokens, break_lock,
                      py_lock_func, lock_func, temp_pool))
         apr_pool_destroy(temp_pool)

=== modified file 'transport.py'
--- a/transport.py	2008-03-15 19:13:59 +0000
+++ b/transport.py	2008-03-16 05:24:21 +0000
@@ -71,93 +71,6 @@
     return url.rstrip('/')
 
 
-class Editor:
-    """Simple object wrapper around the Subversion delta editor interface."""
-    def __init__(self, transport, (editor, editor_baton)):
-        self.editor = editor
-        self.editor_baton = editor_baton
-        self.recent_baton = []
-        self._transport = transport
-
-    @convert_svn_error
-    def open_root(self, base_revnum):
-        assert self.recent_baton == [], "root already opened"
-        baton = svn.delta.editor_invoke_open_root(self.editor, 
-                self.editor_baton, base_revnum)
-        self.recent_baton.append(baton)
-        return baton
-
-    @convert_svn_error
-    def close_directory(self, baton, *args, **kwargs):
-        assert self.recent_baton.pop() == baton, \
-                "only most recently opened baton can be closed"
-        svn.delta.editor_invoke_close_directory(self.editor, baton, *args, **kwargs)
-
-    @convert_svn_error
-    def close(self):
-        assert self.recent_baton == []
-        svn.delta.editor_invoke_close_edit(self.editor, self.editor_baton)
-
-    @convert_svn_error
-    def apply_textdelta(self, baton, *args, **kwargs):
-        assert self.recent_baton[-1] == baton
-        return svn.delta.editor_invoke_apply_textdelta(self.editor, baton,
-                *args, **kwargs)
-
-    @convert_svn_error
-    def change_dir_prop(self, baton, name, value, pool=None):
-        assert self.recent_baton[-1] == baton
-        return svn.delta.editor_invoke_change_dir_prop(self.editor, baton, 
-                                                       name, value, pool)
-
-    @convert_svn_error
-    def delete_entry(self, *args, **kwargs):
-        return svn.delta.editor_invoke_delete_entry(self.editor, *args, **kwargs)
-
-    @convert_svn_error
-    def add_file(self, path, parent_baton, *args, **kwargs):
-        assert self.recent_baton[-1] == parent_baton
-        baton = svn.delta.editor_invoke_add_file(self.editor, path, 
-            parent_baton, *args, **kwargs)
-        self.recent_baton.append(baton)
-        return baton
-
-    @convert_svn_error
-    def open_file(self, path, parent_baton, *args, **kwargs):
-        assert self.recent_baton[-1] == parent_baton
-        baton = svn.delta.editor_invoke_open_file(self.editor, path, 
-                                                 parent_baton, *args, **kwargs)
-        self.recent_baton.append(baton)
-        return baton
-
-    @convert_svn_error
-    def change_file_prop(self, baton, name, value, pool=None):
-        assert self.recent_baton[-1] == baton
-        svn.delta.editor_invoke_change_file_prop(self.editor, baton, name, 
-                                                 value, pool)
-
-    @convert_svn_error
-    def close_file(self, baton, *args, **kwargs):
-        assert self.recent_baton.pop() == baton
-        svn.delta.editor_invoke_close_file(self.editor, baton, *args, **kwargs)
-
-    @convert_svn_error
-    def add_directory(self, path, parent_baton, *args, **kwargs):
-        assert self.recent_baton[-1] == parent_baton
-        baton = svn.delta.editor_invoke_add_directory(self.editor, path, 
-            parent_baton, *args, **kwargs)
-        self.recent_baton.append(baton)
-        return baton
-
-    @convert_svn_error
-    def open_directory(self, path, parent_baton, *args, **kwargs):
-        assert self.recent_baton[-1] == parent_baton
-        baton = svn.delta.editor_invoke_open_directory(self.editor, path, 
-            parent_baton, *args, **kwargs)
-        self.recent_baton.append(baton)
-        return baton
-
-
 class SvnRaTransport(Transport):
     """Fake transport for Subversion-related namespaces.
     
@@ -235,7 +148,7 @@
         return self._ra.get_latest_revnum()
 
     @convert_svn_error
-    def do_switch(self, switch_rev, recurse, switch_url, editor, pool=None):
+    def do_switch(self, switch_rev, recurse, switch_url, editor):
         self._open_real_transport()
         self.mutter('svn switch -r %d -> %r' % (switch_rev, switch_url))
         return self._ra.do_switch(switch_rev, "", recurse, switch_url, editor)
@@ -281,7 +194,7 @@
         self._backing_url = self.svn_url
 
     @convert_svn_error
-    def get_dir(self, path, revnum, pool=None, kind=False):
+    def get_dir(self, path, revnum, kind=False):
         self.mutter("svn ls -r %d '%r'" % (revnum, path))
         assert len(path) == 0 or path[0] != "/"
         path = self._request_path(path)
@@ -329,7 +242,7 @@
 
     @convert_svn_error
     def unlock(self, locks, break_lock=False):
-        def lock_cb(baton, path, do_lock, lock, ra_err, pool):
+        def lock_cb(baton, path, do_lock, lock, ra_err):
             pass
         return self._ra.unlock(locks, break_lock, lock_cb)
 
@@ -337,7 +250,7 @@
     def lock_write(self, path_revs, comment=None, steal_lock=False):
         return self.PhonyLock() # FIXME
         tokens = {}
-        def lock_cb(baton, path, do_lock, lock, ra_err, pool):
+        def lock_cb(baton, path, do_lock, lock, ra_err):
             tokens[path] = lock
         self._ra.lock(path_revs, comment, steal_lock, lock_cb)
         return SvnLock(self, tokens)




More information about the bazaar-commits mailing list