Merge error code improvements from 0.4.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 5 Jun 2008 18:08:34 +0000 (20:08 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 5 Jun 2008 18:08:34 +0000 (20:08 +0200)
18 files changed:
1  2 
auth.py
branch.py
branchprops.py
commit.py
convert.py
errors.py
fetch.py
format.py
logwalker.py
mapping.py
mapping3/__init__.py
repository.py
revids.py
tests/__init__.py
tests/test_errors.py
transport.py
tree.py
workingtree.py

diff --cc auth.py
index 0b9490063a4edb74963714e5cbc4416a5258a1b8,067d16798898e780bf0a80a0a53d105ba2679b55..a6dbaaf44e5a1640dd8b11f8069aab5c4c0da142
+++ b/auth.py
  
  from bzrlib.config import AuthenticationConfig
  from bzrlib.ui import ui_factory
 -import svn.core
 -from svn.core import (svn_auth_cred_username_t, 
 -                      svn_auth_cred_simple_t,
 -                      svn_auth_cred_ssl_client_cert_t,
 -                      svn_auth_cred_ssl_client_cert_pw_t,
 -                      svn_auth_cred_ssl_server_trust_t,
 -                      svn_auth_get_username_prompt_provider,
 -                      svn_auth_get_simple_prompt_provider,
 -                      svn_auth_get_ssl_server_trust_prompt_provider,
 -                      svn_auth_get_ssl_client_cert_pw_prompt_provider,
 -                      svn_auth_open)
 +from bzrlib.plugins.svn.ra import (get_username_prompt_provider,
 +                get_simple_prompt_provider,
 +                get_ssl_server_trust_prompt_provider,
 +                get_ssl_client_cert_pw_prompt_provider,
 +                get_simple_provider, get_username_provider, 
 +                get_ssl_client_cert_file_provider, 
 +                get_ssl_client_cert_pw_file_provider,
 +                get_ssl_server_trust_file_provider,
 +                Auth
 +                )
- from bzrlib.plugins.svn import constants, ra
++from bzrlib.plugins.svn import ra
  import urlparse
  import urllib
  
@@@ -80,15 -90,16 +80,15 @@@ class SubversionAuthenticationConfig(Au
          if (credentials is not None and 
              credentials.has_key("verify_certificates") and 
              credentials["verify_certificates"] == False):
 -            ssl_server_trust.accepted_failures = (
 -                    svn.core.SVN_AUTH_SSL_NOTYETVALID + 
 -                    svn.core.SVN_AUTH_SSL_EXPIRED +
 -                    svn.core.SVN_AUTH_SSL_CNMISMATCH +
 -                    svn.core.SVN_AUTH_SSL_UNKNOWNCA +
 -                    svn.core.SVN_AUTH_SSL_OTHER)
 +            accepted_failures = (
-                     constants.AUTH_SSL_NOTYETVALID + 
-                     constants.AUTH_SSL_EXPIRED +
-                     constants.AUTH_SSL_CNMISMATCH +
-                     constants.AUTH_SSL_UNKNOWNCA +
-                     constants.AUTH_SSL_OTHER)
++                    AUTH_SSL_NOTYETVALID + 
++                    AUTH_SSL_EXPIRED +
++                    AUTH_SSL_CNMISMATCH +
++                    AUTH_SSL_UNKNOWNCA +
++                    AUTH_SSL_OTHER)
          else:
 -            ssl_server_trust.accepted_failures = 0
 -        ssl_server_trust.may_save = False
 -        return ssl_server_trust
 +            accepted_failures = 0
 +        return (accepted_failures, False)
  
      def get_svn_username_prompt_provider(self, retries):
          """Return a Subversion auth provider for retrieving the username, as 
@@@ -173,11 -185,13 +173,11 @@@ def create_auth_baton(url)
          providers += auth_config.get_svn_auth_providers()
          providers += [get_ssl_client_cert_pw_provider(1)]
  
 -    auth_baton = svn.core.svn_auth_open(providers)
 +    auth_baton = Auth(providers)
      if creds is not None:
 -        (auth_baton.user, auth_baton.password) = urllib.splitpasswd(creds)
 -        if auth_baton.user is not None:
 -            svn.core.svn_auth_set_parameter(auth_baton, 
 -                svn.core.SVN_AUTH_PARAM_DEFAULT_USERNAME, auth_baton.user)
 -        if auth_baton.password is not None:
 -            svn.core.svn_auth_set_parameter(auth_baton, 
 -                svn.core.SVN_AUTH_PARAM_DEFAULT_PASSWORD, auth_baton.password)
 +        (user, password) = urllib.splitpasswd(creds)
 +        if user is not None:
-             auth_baton.set_parameter(constants.AUTH_PARAM_DEFAULT_USERNAME, user)
++            auth_baton.set_parameter(AUTH_PARAM_DEFAULT_USERNAME, user)
 +        if password is not None:
-             auth_baton.set_parameter(constants.AUTH_PARAM_DEFAULT_PASSWORD, password)
++            auth_baton.set_parameter(AUTH_PARAM_DEFAULT_PASSWORD, password)
      return auth_baton
diff --cc branch.py
index 30b589a7d1b0b98a48d7105b1d14cca646cce666,4da6fe9b902551d35702d9f3e54e8e54406c9e94..1afbaa3fcb8b0cc385617270ac0024cdd5af6975
+++ b/branch.py
@@@ -24,14 -24,15 +24,14 @@@ from bzrlib.inventory import (Inventory
  from bzrlib.revision import is_null, ensure_null, NULL_REVISION
  from bzrlib.workingtree import WorkingTree
  
- from bzrlib.plugins.svn import constants, core
 -import svn.client, svn.core
 -from svn.core import SubversionException
 -
++from bzrlib.plugins.svn import core
  from bzrlib.plugins.svn.commit import push
  from bzrlib.plugins.svn.config import BranchConfig
- from bzrlib.plugins.svn.errors import NotSvnBranchPath
 +from bzrlib.plugins.svn.core import SubversionException
+ from bzrlib.plugins.svn.errors import NotSvnBranchPath, ERR_FS_NO_SUCH_REVISION
  from bzrlib.plugins.svn.format import get_rich_root_format
  from bzrlib.plugins.svn.repository import SvnRepository
 -from bzrlib.plugins.svn.transport import bzr_to_svn_url, create_svn_client
 +from bzrlib.plugins.svn.transport import bzr_to_svn_url
  
  
  class FakeControlFiles(object):
@@@ -77,10 -78,10 +77,10 @@@ class SvnBranch(Branch)
              if revnum is None:
                  raise NotBranchError(self.base)
              if self.repository.transport.check_path(branch_path.strip("/"), 
 -                revnum) != svn.core.svn_node_dir:
 +                revnum) != core.NODE_DIR:
                  raise NotBranchError(self.base)
          except SubversionException, (_, num):
-             if num == constants.ERR_FS_NO_SUCH_REVISION:
+             if num == ERR_FS_NO_SUCH_REVISION:
                  raise NotBranchError(self.base)
              raise
          if not self.mapping.is_branch(branch_path):
diff --cc branchprops.py
index 81c4486a26c141236040ac515aed393433431ac2,f492dc2d1aa676802a053df833f0e3f08af273a6..9752e173bd9793ad959445747e1ac3633d925b5e
  from bzrlib.errors import NoSuchRevision
  from bzrlib.trace import mutter
  
- from bzrlib.plugins.svn import constants
 +from bzrlib.plugins.svn.core import SubversionException
+ from bzrlib.plugins.svn.errors import ERR_FS_NO_SUCH_REVISION
  
 -from svn.core import SubversionException
 -import svn.core
 -
  
  class PathPropertyProvider(object):
      def __init__(self, log):
diff --cc commit.py
index 916be849836b977495c0981794f23178934a39f6,32c4246a0d99b638e479aecf6b8b7b0bf70e053a..66e618f2b07d70219499c8630b6598b2322be8a4
+++ b/commit.py
@@@ -31,9 -30,7 +30,8 @@@ from bzrlib.trace import mutter, warnin
  from bzrlib.plugins.svn import properties
  
  from cStringIO import StringIO
- from bzrlib.plugins.svn import constants
- from bzrlib.plugins.svn.errors import ChangesRootLHSHistory, MissingPrefix, RevpropChangeFailed
 +
+ from bzrlib.plugins.svn.errors import ChangesRootLHSHistory, MissingPrefix, RevpropChangeFailed, ERR_FS_TXN_OUT_OF_DATE, ERR_REPOS_DISABLED_FEATURE
  from bzrlib.plugins.svn.svk import (generate_svk_feature, serialize_svk_features, 
                   parse_svk_features, SVN_PROP_SVK_MERGE)
  from bzrlib.plugins.svn.logwalker import lazy_dict
diff --cc convert.py
index a4816a8a07dc307dc008766e3a67e7e3c163f21c,c856b96b98bfd7e7d54dfc212c2073214bb007ce..4f80d58f74e1b476379e4bbc8148272e667a3554
@@@ -23,9 -23,11 +23,10 @@@ from bzrlib.repository import InterRepo
  from bzrlib.revision import ensure_null
  from bzrlib.transport import get_transport
  
+ from bzrlib.plugins.svn.errors import ERR_STREAM_MALFORMED_DATA
  from bzrlib.plugins.svn.format import get_rich_root_format
- from bzrlib.plugins.svn import core, repos, constants
 -
 -import svn.core, svn.repos
 -from svn.core import SubversionException
++from bzrlib.plugins.svn import core, repos
 +from bzrlib.plugins.svn.core import SubversionException
  
  def transport_makedirs(transport, location_url):
      """Create missing directories.
@@@ -71,12 -73,13 +72,12 @@@ def load_dumpfile(dumpfile, outputdir)
      else:
          file = open(dumpfile)
      try:
 -        svn.repos.load_fs2(repos, file, StringIO(), 
 -                svn.repos.load_uuid_default, '', 0, 0, None)
 +        r.load_fs(file, StringIO(), repos.LOAD_UUID_DEFAULT)
      except SubversionException, (_, num):
-         if num == constants.ERR_STREAM_MALFORMED_DATA:
+         if num == ERR_STREAM_MALFORMED_DATA:
              raise NotDumpFile(dumpfile)
          raise
 -    return repos
 +    return r
  
  
  def convert_repository(source_repos, output_url, scheme=None, layout=None,
diff --cc errors.py
index b7087a861dd8d63f3ce68a4dd9ea6a1b2c363341,3f736c6f967fbcdac72092079721871428784715..47911225006c78dca9a1a77fa0aa86f2fe8da2c3
+++ b/errors.py
@@@ -21,14 -21,41 +21,40 @@@ from bzrlib.errors import (BzrError, Co
                             TransportError, UnexpectedEndOfContainerError)
  
  import urllib
- import core
- from bzrlib.plugins.svn import constants
 -import svn.core
++from bzrlib.plugins.svn import core
  
  
  class InvalidExternalsDescription(BzrError):
      _fmt = """Unable to parse externals description."""
  
  
 -
+ ERR_UNKNOWN_HOSTNAME = 670002
+ ERR_UNKNOWN_HOSTNAME = 670002
+ ERR_RA_SVN_CONNECTION_CLOSED = 210002
+ ERR_WC_LOCKED = 155004
+ ERR_RA_NOT_AUTHORIZED = 170001
+ ERR_INCOMPLETE_DATA = 200003
+ ERR_RA_SVN_MALFORMED_DATA = 210004
+ ERR_RA_NOT_IMPLEMENTED = 170003
+ ERR_FS_NO_SUCH_REVISION = 160006
+ ERR_FS_TXN_OUT_OF_DATE = 160028
+ ERR_REPOS_DISABLED_FEATURE = 165006
+ ERR_STREAM_MALFORMED_DATA = 140001
+ ERR_RA_ILLEGAL_URL = 170000
+ ERR_RA_LOCAL_REPOS_OPEN_FAILED = 180001
+ ERR_BAD_URL = 125002
+ ERR_RA_DAV_REQUEST_FAILED = 175002
+ ERR_FS_NOT_DIRECTORY = 160016
+ ERR_FS_NOT_FOUND = 160013
+ ERR_FS_ALREADY_EXISTS = 160020
+ ERR_RA_SVN_REPOS_NOT_FOUND = 210005
+ ERR_WC_NOT_DIRECTORY = 155007
+ ERR_ENTRY_EXISTS = 150002
+ ERR_WC_PATH_NOT_FOUND = 155010
+ ERR_CANCELLED = 200015
+ ERR_WC_UNSUPPORTED_FORMAT = 155021
  class NotSvnBranchPath(NotBranchError):
      """Error raised when a path was specified that did not exist."""
      _fmt = """%(path)s is not a valid Subversion branch path. 
diff --cc fetch.py
index 720df1a28b693c996d228ab1bd4e6c9d35536ec8,fc91a59c3b077aff790d8dfae7a57cce188f9b8b..462102ad500d302e5ed16a98a96583d0541974fb
+++ b/fetch.py
@@@ -25,9 -25,9 +25,7 @@@ from bzrlib.trace import mutte
  from cStringIO import StringIO
  import md5
  
- import constants
 -from svn.core import Pool
 -import svn.core
--
 +from bzrlib.plugins.svn.delta import apply_txdelta_handler
  from bzrlib.plugins.svn import properties
  from bzrlib.plugins.svn.errors import InvalidFileName
  from bzrlib.plugins.svn.logwalker import lazy_dict
@@@ -294,78 -275,10 +292,78 @@@ class DirectoryBuildEditor
          elif name.startswith(properties.PROP_PREFIX):
              mutter('unsupported dir property %r' % name)
  
 -    def change_file_prop(self, id, name, value, pool):
 +    def add_file(self, path, copyfrom_path=None, copyfrom_revnum=-1):
 +        assert isinstance(path, str)
 +        path = path.decode("utf-8")
 +        check_filename(path)
 +        file_id = self.editor._get_new_id(self.new_id, path)
 +        if file_id in self.editor.inventory:
 +            # This file was moved here from somewhere else, but the 
 +            # other location hasn't been removed yet. 
 +            if copyfrom_path is None:
 +                # This should ideally never happen
 +                copyfrom_path = self.editor.old_inventory.id2path(file_id)
 +                mutter('no copyfrom path set, assuming %r' % copyfrom_path)
 +            assert copyfrom_path == self.editor.old_inventory.id2path(file_id)
 +            assert copyfrom_path not in self.editor._premature_deletes
 +            self.editor._premature_deletes.add(copyfrom_path)
 +            # No need to rename if it's already in the right spot
 +            self.editor._rename(file_id, self.new_id, path)
 +        return FileBuildEditor(self.editor, path, file_id)
 +
 +    def open_file(self, path, base_revnum):
 +        assert isinstance(path, str)
 +        path = path.decode("utf-8")
 +        base_file_id = self.editor._get_old_id(self.old_id, path)
 +        base_revid = self.editor.old_inventory[base_file_id].revision
 +        file_id = self.editor._get_existing_id(self.old_id, self.new_id, path)
 +        is_symlink = (self.editor.inventory[base_file_id].kind == 'symlink')
 +        file_data = self.editor._get_file_data(base_file_id, base_revid)
 +        if file_id == base_file_id:
 +            file_parents = [base_revid]
 +        else:
 +            # Replace
 +            del self.editor.inventory[base_file_id]
 +            file_parents = []
 +        return FileBuildEditor(self.editor, path, file_id, 
 +                               file_parents, file_data, is_symlink=is_symlink)
 +
 +    def delete_entry(self, path, revnum):
 +        assert isinstance(path, str)
 +        path = path.decode("utf-8")
 +        if path in self.editor._premature_deletes:
 +            # Delete recursively
 +            self.editor._premature_deletes.remove(path)
 +            for p in self.editor._premature_deletes.copy():
 +                if p.startswith("%s/" % path):
 +                    self.editor._premature_deletes.remove(p)
 +        else:
 +            self.editor.inventory.remove_recursive_id(self.editor._get_old_id(self.old_id, path))
 +
 +class FileBuildEditor:
 +    def __init__(self, editor, path, file_id, file_parents=[], data="", 
 +                 is_symlink=False):
 +        self.path = path
 +        self.editor = editor
 +        self.file_id = file_id
 +        self.file_data = data
 +        self.is_symlink = is_symlink
 +        self.file_parents = file_parents
 +        self.is_executable = None
 +        self.file_stream = None
 +
 +    def apply_textdelta(self, base_checksum=None):
 +        actual_checksum = md5.new(self.file_data).hexdigest()
 +        assert (base_checksum is None or base_checksum == actual_checksum,
 +            "base checksum mismatch: %r != %r" % (base_checksum, 
 +                                                  actual_checksum))
 +        self.file_stream = StringIO()
 +        return apply_txdelta_handler(self.file_data, self.file_stream)
 +
 +    def change_prop(self, name, value):
-         if name == constants.PROP_EXECUTABLE: 
+         if name == properties.PROP_EXECUTABLE: 
              # You'd expect executable to match 
 -            # properties.PROP_EXECUTABLE_VALUE, but that's not 
 +            # constants.PROP_EXECUTABLE_VALUE, but that's not 
              # how SVN behaves. It appears to consider the presence 
              # of the property sufficient to mark it executable.
              self.is_executable = (value != None)
diff --cc format.py
index 5cea113906c3793979a014c01237d0f23b582a5e,481953f5d8254ffb0d7e77de74e88fe31d91f489..b745380c8bc11f8b2af1d55b52e102a04131db15
+++ b/format.py
@@@ -23,7 -23,8 +23,7 @@@ from bzrlib.lockable_files import Trans
  import os
  
  lazy_import(globals(), """
- from bzrlib.plugins.svn import constants, errors, remote
 -from bzrlib.plugins.svn import errors
 -from bzrlib.plugins.svn import remote
++from bzrlib.plugins.svn import errors, remote
  
  from bzrlib import errors as bzr_errors
  """)
@@@ -51,25 -52,25 +51,25 @@@ class SvnRemoteFormat(BzrDirFormat)
      @classmethod
      def probe_transport(klass, transport):
          from transport import get_svn_ra_transport
-         import core
 -        import svn.core
++        from bzrlib.plugins.svn.core import SubversionException
          format = klass()
  
          try:
              transport = get_svn_ra_transport(transport)
-         except core.SubversionException, (_, num):
-             if num in (constants.ERR_RA_ILLEGAL_URL, \
-                        constants.ERR_RA_LOCAL_REPOS_OPEN_FAILED, \
-                        constants.ERR_BAD_URL):
 -        except svn.core.SubversionException, (_, num):
++        except SubversionException, (_, num):
+             if num in (errors.ERR_RA_ILLEGAL_URL, \
+                        errors.ERR_RA_LOCAL_REPOS_OPEN_FAILED, \
+                        errors.ERR_BAD_URL):
                  raise bzr_errors.NotBranchError(path=transport.base)
  
          return format
  
      def _open(self, transport):
-         import core
 -        import svn.core
++        from bzrlib.plugins.svn.core import SubversionException
          try: 
              return remote.SvnRemoteAccess(transport, self)
-         except core.SubversionException, (_, num):
-             if num == constants.ERR_RA_DAV_REQUEST_FAILED:
 -        except svn.core.SubversionException, (_, num):
++        except SubversionException, (_, num):
+             if num == errors.ERR_RA_DAV_REQUEST_FAILED:
                  raise bzr_errors.NotBranchError(transport.base)
              raise
  
@@@ -125,12 -126,15 +125,12 @@@ class SvnWorkingTreeDirFormat(BzrDirFor
          raise bzr_errors.NotBranchError(path=transport.base)
  
      def _open(self, transport):
-         import core
 -        import svn.core
++        from bzrlib.plugins.svn.core import SubversionException
          from workingtree import SvnCheckout
 -        subr_version = svn.core.svn_subr_version()
 -        if subr_version.major == 1 and subr_version.minor < 4:
 -            raise errors.NoCheckoutSupport()
          try:
              return SvnCheckout(transport, self)
-         except core.SubversionException, (_, num):
-             if num in (constants.ERR_RA_LOCAL_REPOS_OPEN_FAILED,):
 -        except svn.core.SubversionException, (_, num):
++        except SubversionException, (_, num):
+             if num in (errors.ERR_RA_LOCAL_REPOS_OPEN_FAILED,):
                  raise errors.NoSvnRepositoryPresent(transport.base)
              raise
  
diff --cc logwalker.py
index 06aa4608bf9bccd40b66175de419caea26f3703f,2f9e1682a2637f2d545f8e65688848b6615d0bca..407ef071bb974490b39f6616fe378c4997e53ee9
@@@ -20,13 -20,15 +20,14 @@@ from bzrlib.errors import NoSuchRevisio
  from bzrlib.trace import mutter
  import bzrlib.ui as ui
  
 -from svn.core import SubversionException, Pool
 -from transport import SvnRaTransport
 -import svn.core
 +from bzrlib.plugins.svn.core import SubversionException
 +from bzrlib.plugins.svn.transport import SvnRaTransport
- from bzrlib.plugins.svn import core, constants
++from bzrlib.plugins.svn import core
  
  from bzrlib.plugins.svn.cache import CacheTable
 -from bzrlib.plugins.svn import changes
+ from bzrlib.plugins.svn.errors import ERR_FS_NO_SUCH_REVISION, ERR_FS_NOT_FOUND
 -
 -LOG_CHUNK_LIMIT = 0
 +from bzrlib.plugins.svn import changes
 +from bzrlib.plugins.svn.ra import DIRENT_KIND
  
  class lazy_dict(object):
      def __init__(self, initial, create_fn, *args):
diff --cc mapping.py
index 8705cd294be16d993e3cd3e3c5508f301b1a67f9,4ef06563538e0b0914bcd7814b9a7530979fd3e9..955031c35e3cbe757f768847087d2550c0f11ee7
@@@ -19,9 -19,9 +19,9 @@@ from bzrlib import osutils, registr
  from bzrlib.errors import InvalidRevisionId
  from bzrlib.trace import mutter
  
- from bzrlib.plugins.svn import core, constants, version_info, constants, errors, properties
 -from bzrlib.plugins.svn import version_info, errors, properties
++from bzrlib.plugins.svn import core, constants, version_info, errors, properties
  import calendar
 -import svn
 +import sha
  import time
  import urllib
  
index 08393a851c38468e18b16eeb4364a01c46e730e0,034c75c2244d6726a7e6f625ef80bbc9edabfafa..773a879fcc77e21b1e27da98159d53fbbadf5377
@@@ -16,7 -16,8 +16,8 @@@
  from bzrlib import osutils, ui
  from bzrlib.errors import InvalidRevisionId
  from bzrlib.trace import mutter
- from bzrlib.plugins.svn import core, constants, mapping, properties
 -from bzrlib.plugins.svn import mapping, properties
++from bzrlib.plugins.svn import core, mapping, properties
+ from bzrlib.plugins.svn.errors import ERR_FS_NOT_DIRECTORY, ERR_FS_NOT_FOUND
  from bzrlib.plugins.svn.layout import RepositoryLayout
  from bzrlib.plugins.svn.mapping3.scheme import (BranchingScheme, guess_scheme_from_branch_path, 
                               guess_scheme_from_history, ListBranchingScheme, 
@@@ -65,15 -67,14 +66,15 @@@ class SchemeDerivedLayout(RepositoryLay
  
      def get_branches(self, revnum, project=""):
          def check_path(path):
 -            return self.repository.transport.check_path(path, revnum) == svn.core.svn_node_dir
 +            return self.repository.transport.check_path(path, revnum) == core.NODE_DIR
          def find_children(path):
              try:
 +                assert not path.startswith("/")
                  dirents = self.repository.transport.get_dir(path, revnum)[0]
-             except core.SubversionException, (msg, num):
-                 if num == constants.ERR_FS_NOT_DIRECTORY:
+             except SubversionException, (msg, num):
+                 if num == ERR_FS_NOT_DIRECTORY:
                      return None
-                 if num == constants.ERR_FS_NOT_FOUND:
+                 if num == ERR_FS_NOT_FOUND:
                      return None
                  raise
              return dirents.keys()
diff --cc repository.py
index 4062f701b9ccf8674e9cc0d6f877be9bb737da71,2dde852d3030b6f5609a381220f4a12fcd4dfbb3..cf592226aad6220d10a6daf6eb2d14f1109a85e1
@@@ -30,20 -29,19 +30,16 @@@ from bzrlib.revision import Revision, N
  from bzrlib.transport import Transport, get_transport
  from bzrlib.trace import info, mutter
  
- from core import SubversionException
- import core
- import constants
 -from svn.core import SubversionException
 -import svn.core
  
  import os
  
++from bzrlib.plugins.svn import changes, core, errors, logwalker
  from bzrlib.plugins.svn.branchprops import PathPropertyProvider
  from bzrlib.plugins.svn.cache import create_cache_dir, sqlite3
--from bzrlib.plugins.svn import changes
++from bzrlib.plugins.svn.core import SubversionException
  from bzrlib.plugins.svn.changes import changes_path, find_prev_location
  from bzrlib.plugins.svn.config import SvnRepositoryConfig
  from bzrlib.plugins.svn.parents import SqliteCachingParentsProvider
--from bzrlib.plugins.svn import errors
--from bzrlib.plugins.svn import logwalker
  from bzrlib.plugins.svn.mapping import (SVN_PROP_BZR_REVISION_ID, SVN_REVPROP_BZR_SIGNATURE,
                       parse_revision_metadata, parse_revid_property, 
                       parse_merge_property, BzrSvnMapping,
@@@ -380,9 -378,9 +376,9 @@@ class SvnRepository(Repository)
              return False
  
          try:
 -            return (svn.core.svn_node_dir == self.transport.check_path(path, revnum))
 +            return (core.NODE_DIR == self.transport.check_path(path, revnum))
          except SubversionException, (_, num):
-             if num == constants.ERR_FS_NO_SUCH_REVISION:
+             if num == ERR_FS_NO_SUCH_REVISION:
                  return False
              raise
  
diff --cc revids.py
index 155f98cfbe67e931ffe287c2fd4d3a8647886e5e,f042d77ce008f622a369dc4d2af9af1d02c8d9ce..f166e47bff479ce814d032f46112eeb8eac132a5
+++ b/revids.py
@@@ -20,10 -20,11 +20,10 @@@ from bzrlib import debu
  from bzrlib.errors import (InvalidRevisionId, NoSuchRevision)
  from bzrlib.trace import mutter
  
 -import svn.core
 -from svn.core import SubversionException
 -
 +from bzrlib.plugins.svn import core
 +from bzrlib.plugins.svn.core import SubversionException
  from bzrlib.plugins.svn.cache import CacheTable
- from bzrlib.plugins.svn.errors import InvalidPropertyValue
+ from bzrlib.plugins.svn.errors import InvalidPropertyValue, ERR_FS_NO_SUCH_REVISION, ERR_FS_NOT_DIRECTORY
  from bzrlib.plugins.svn.mapping import (parse_revision_id, BzrSvnMapping, 
                       SVN_PROP_BZR_REVISION_ID, parse_revid_property)
  from bzrlib.plugins.svn.mapping3 import BzrSvnMappingv3FileProps
index 0cc0ad149fc93848df9e6aded238479bd8ae69a7,7b44eb6f241175ea78843c65d9d7c256d57cdf98..d4eb639c1534957684a8d7a33b797166e5192a5d
@@@ -24,12 -24,13 +24,12 @@@ from cStringIO import StringI
  
  from bzrlib import osutils, urlutils
  from bzrlib.bzrdir import BzrDir
 +from bzrlib.plugins.svn.ra import RemoteAccess, txdelta_send_stream
  from bzrlib.tests import TestCaseInTempDir, TestSkipped
  from bzrlib.trace import mutter
 -from bzrlib.urlutils import local_path_to_url
  from bzrlib.workingtree import WorkingTree
  
- from bzrlib.plugins.svn import constants, repos, wc, client, ra
 -import svn.repos, svn.wc
 -from bzrlib.plugins.svn.errors import NoCheckoutSupport
++from bzrlib.plugins.svn import repos, wc, client, ra, properties
  
  class TestCaseWithSubversionRepository(TestCaseInTempDir):
      """A test case that provides the ability to build Subversion 
          
          :param relpath: Path to the files to add.
          """
 -        svn.client.add3(relpath, recursive, False, False, self.client_ctx)
 +        self.client_ctx.add(relpath, recursive, False, False)
  
 -    def revnum_to_opt_rev(self, revnum):
 -        rev = svn.core.svn_opt_revision_t()
 -        if revnum is None:
 -            rev.kind = svn.core.svn_opt_revision_head
 -        else:
 -            assert isinstance(revnum, int)
 -            rev.kind = svn.core.svn_opt_revision_number
 -            rev.value.number = revnum
 -        return rev
 -
 -    def client_log(self, path, start_revnum=None, stop_revnum=None):
 -        assert isinstance(path, str)
 +    def client_log(self, url, start_revnum=0, stop_revnum=-1):
 +        ra = RemoteAccess(url.encode("utf-8"))
          ret = {}
 -        def rcvr(orig_paths, rev, author, date, message, pool):
 -            ret[rev] = (orig_paths, author, date, message)
 -        svn.client.log([path], self.revnum_to_opt_rev(start_revnum),
 -                       self.revnum_to_opt_rev(stop_revnum),
 -                       True,
 -                       True,
 -                       rcvr,
 -                       self.client_ctx)
 +        def rcvr(orig_paths, rev, revprops):
 +            ret[rev] = (orig_paths, 
-                         revprops.get(constants.PROP_REVISION_AUTHOR),
-                         revprops.get(constants.PROP_REVISION_DATE),
-                         revprops.get(constants.PROP_REVISION_LOG))
++                        revprops.get(properties.PROP_REVISION_AUTHOR),
++                        revprops.get(properties.PROP_REVISION_DATE),
++                        revprops.get(properties.PROP_REVISION_LOG))
 +        if stop_revnum == -1:
 +            stop_revnum = ra.get_latest_revnum()
 +        ra.get_log(rcvr, None, start_revnum, stop_revnum, 0, True, True)
          return ret
  
      def client_delete(self, relpath):
index fd471d79201f8cd8335114e6f70fb53fa12df56e,5c6f93a4603545f0477c81484392f2c99f6f89a9..39d4925c51578c334ed93c38f9adca103b5ea1e9
@@@ -19,11 -19,10 +19,9 @@@ from bzrlib.errors import (ConnectionEr
                             UnexpectedEndOfContainerError)
  from bzrlib.tests import TestCase
  
- from bzrlib.plugins.svn import constants
 +from bzrlib.plugins.svn.core import SubversionException
- from bzrlib.plugins.svn.errors import (convert_svn_error, convert_error, InvalidPropertyValue, 
-                     InvalidSvnBranchPath, NotSvnBranchPath)
+ from bzrlib.plugins.svn.errors import *
  
 -import svn.core
 -from svn.core import SubversionException
  
  class TestConvertError(TestCase):
      def test_decorator_unknown(self):
                  SubversionException)
  
      def test_convert_malformed(self):
-         self.assertIsInstance(convert_error(SubversionException("foo", constants.ERR_RA_SVN_MALFORMED_DATA)), TransportError)
+         self.assertIsInstance(convert_error(SubversionException("foo", ERR_RA_SVN_MALFORMED_DATA)), TransportError)
  
      def test_convert_error_reset(self):
-         self.assertIsInstance(convert_error(SubversionException("Connection closed", constants.ERR_RA_SVN_CONNECTION_CLOSED)), ConnectionReset)
+         self.assertIsInstance(convert_error(SubversionException("Connection closed", ERR_RA_SVN_CONNECTION_CLOSED)), ConnectionReset)
  
      def test_convert_error_lock(self):
-         self.assertIsInstance(convert_error(SubversionException("Working copy locked", constants.ERR_WC_LOCKED)), LockError)
+         self.assertIsInstance(convert_error(SubversionException("Working copy locked", ERR_WC_LOCKED)), LockError)
  
      def test_convert_perm_denied(self):
-         self.assertIsInstance(convert_error(SubversionException("Permission Denied", constants.ERR_RA_NOT_AUTHORIZED)), PermissionDenied)
+         self.assertIsInstance(convert_error(SubversionException("Permission Denied", ERR_RA_NOT_AUTHORIZED)), PermissionDenied)
  
      def test_convert_unexpected_end(self):
-         self.assertIsInstance(convert_error(SubversionException("Unexpected end of stream", constants.ERR_INCOMPLETE_DATA)), UnexpectedEndOfContainerError)
+         self.assertIsInstance(convert_error(SubversionException("Unexpected end of stream", ERR_INCOMPLETE_DATA)), UnexpectedEndOfContainerError)
  
      def test_convert_unknown_hostname(self):
-         self.assertIsInstance(convert_error(SubversionException("Unknown hostname 'bla'", constants.ERR_UNKNOWN_HOSTNAME)), ConnectionError)
 -        self.assertIsInstance(convert_error(SubversionException("Unknown hostname 'bla'", SVN_ERR_UNKNOWN_HOSTNAME)), ConnectionError)
++        self.assertIsInstance(convert_error(SubversionException("Unknown hostname 'bla'", ERR_UNKNOWN_HOSTNAME)), ConnectionError)
  
      def test_not_implemented(self):
-         self.assertIsInstance(convert_error(SubversionException("Remote server doesn't support ...", constants.ERR_RA_NOT_IMPLEMENTED)), NotImplementedError)
+         self.assertIsInstance(convert_error(SubversionException("Remote server doesn't support ...", ERR_RA_NOT_IMPLEMENTED)), NotImplementedError)
  
      def test_decorator_nothrow(self):
          @convert_svn_error
diff --cc transport.py
index c6b71ab5314bae60fc58942f1344f24a19cc0bd2,3ba94851acb6dfc45633b15bb06afd0ea4f11d63..cdff8ba3120805b5032decd05ace9c794d7dab28
@@@ -21,14 -21,13 +21,11 @@@ from bzrlib.errors import (NoSuchFile, 
  from bzrlib.trace import mutter
  from bzrlib.transport import Transport
  
- from core import SubversionException
- from auth import create_auth_baton
- import ra
- import core
- import constants
- from bzrlib.plugins.svn import properties
- from bzrlib.plugins.svn.errors import convert_svn_error, NoSvnRepositoryPresent
 -from svn.core import SubversionException, Pool
 -import svn.ra
 -import svn.core
 -import svn.client
++from bzrlib.plugins.svn.core import SubversionException
++from bzrlib.plugins.svn.auth import create_auth_baton
 -from bzrlib.plugins.svn import properties
++from bzrlib.plugins.svn import core, properties, ra
+ from bzrlib.plugins.svn.errors import convert_svn_error, NoSvnRepositoryPresent, ERR_BAD_URL, ERR_RA_SVN_REPOS_NOT_FOUND, ERR_FS_ALREADY_EXISTS, ERR_FS_NOT_FOUND
  import urlparse
  import urllib
  
@@@ -93,23 -101,373 +90,23 @@@ def needs_busy(unbound)
      return convert
  
  
 -class Editor(object):
 -    """Simple object wrapper around the Subversion delta editor interface."""
 -    def __init__(self, connection, (editor, editor_baton)):
 -        self.editor = editor
 -        self.editor_baton = editor_baton
 -        self.recent_baton = []
 -        self._connection = connection
 -
 -    @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)
 -        self._connection._unmark_busy()
 -
 -    @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 Connection(object):
 -    """An single connection to a Subversion repository. This usually can 
 -    only do one operation at a time."""
 -    def __init__(self, url):
 -        self._busy = False
 -        self._root = None
 -        self._client = create_svn_client(url)
 -        self._unbusy_handler = None
 -        try:
 -            self.mutter('opening SVN RA connection to %r' % url)
 -            self._ra = svn.client.open_ra_session(url.encode('utf8'), 
 -                    self._client)
 -        except SubversionException, (_, num):
 -            if num == ERR_RA_SVN_REPOS_NOT_FOUND:
 -                raise NoSvnRepositoryPresent(url=url)
 -            if num == ERR_BAD_URL:
 -                raise InvalidURL(url)
 -            raise
 -        self.url = url
 -
 -    class Reporter(object):
 -        def __init__(self, connection, (reporter, report_baton)):
 -            self._reporter = reporter
 -            self._baton = report_baton
 -            self._connection = connection
 -
 -        @convert_svn_error
 -        def set_path(self, path, revnum, start_empty, lock_token, pool=None):
 -            svn.ra.reporter2_invoke_set_path(self._reporter, self._baton, 
 -                        path, revnum, start_empty, lock_token, pool)
 -
 -        @convert_svn_error
 -        def delete_path(self, path, pool=None):
 -            svn.ra.reporter2_invoke_delete_path(self._reporter, self._baton,
 -                    path, pool)
 -
 -        @convert_svn_error
 -        def link_path(self, path, url, revision, start_empty, lock_token, 
 -                      pool=None):
 -            svn.ra.reporter2_invoke_link_path(self._reporter, self._baton,
 -                    path, url, revision, start_empty, lock_token,
 -                    pool)
 -
 -        @convert_svn_error
 -        def finish_report(self, pool=None):
 -            try:
 -                svn.ra.reporter2_invoke_finish_report(self._reporter, 
 -                        self._baton, pool)
 -            finally:
 -                self._connection._unmark_busy()
 -
 -        @convert_svn_error
 -        def abort_report(self, pool=None):
 -            try:
 -                svn.ra.reporter2_invoke_abort_report(self._reporter, 
 -                        self._baton, pool)
 -            finally:
 -                self._connection._unmark_busy()
 -
 -    def is_busy(self):
 -        return self._busy
 -
 -    def _mark_busy(self):
 -        assert not self._busy, "already busy"
 -        self._busy = True
 -
 -    def set_unbusy_handler(self, handler):
 -        self._unbusy_handler = handler
 -
 -    def _unmark_busy(self):
 -        assert self._busy, "not busy"
 -        self._busy = False
 -        if self._unbusy_handler is not None:
 -            self._unbusy_handler()
 -            self._unbusy_handler = None
 -
 -    def mutter(self, text):
 -        if 'transport' in debug.debug_flags:
 -            mutter(text)
 -
 -    @convert_svn_error
 -    @needs_busy
 -    def get_uuid(self):
 -        self.mutter('svn get-uuid')
 -        return svn.ra.get_uuid(self._ra)
 -
 -    @convert_svn_error
 -    @needs_busy
 -    def get_repos_root(self):
 -        if self._root is None:
 -            self.mutter("svn get-repos-root")
 -            self._root = svn.ra.get_repos_root(self._ra)
 -        return self._root
 -
 -    @convert_svn_error
 -    @needs_busy
 -    def get_latest_revnum(self):
 -        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, editor, pool=None):
 -        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, edit, edit_baton, pool))
 -
 -    @convert_svn_error
 -    def change_rev_prop(self, revnum, name, value, pool=None):
 -        self.mutter('svn revprop -r%d --set %s=%s' % (revnum, name, value))
 -        svn.ra.change_rev_prop(self._ra, revnum, name, value)
 -
 -    @convert_svn_error
 -    @needs_busy
 -    def get_lock(self, path):
 -        return svn.ra.get_lock(self._ra, path)
 -
 -    @convert_svn_error
 -    @needs_busy
 -    def unlock(self, locks, break_lock=False):
 -        def lock_cb(baton, path, do_lock, lock, ra_err, pool):
 -            pass
 -        return svn.ra.unlock(self._ra, locks, break_lock, lock_cb)
 - 
 -    @convert_svn_error
 -    @needs_busy
 -    def get_dir(self, path, revnum, pool=None, kind=False):
 -        self.mutter("svn ls -r %d '%r'" % (revnum, path))
 -        assert len(path) == 0 or path[0] != "/"
 -        # ra_dav backends fail with strange errors if the path starts with a 
 -        # slash while other backends don't.
 -        if hasattr(svn.ra, 'get_dir2'):
 -            fields = 0
 -            if kind:
 -                fields += svn.core.SVN_DIRENT_KIND
 -            return svn.ra.get_dir2(self._ra, path, revnum, fields)
 -        else:
 -            return svn.ra.get_dir(self._ra, path, revnum)
 -
 -    @convert_svn_error
 -    @needs_busy
 -    def check_path(self, path, revnum):
 -        assert len(path) == 0 or path[0] != "/"
 -        self.mutter("svn check_path -r%d %s" % (revnum, path))
 -        return svn.ra.check_path(self._ra, path.encode('utf-8'), revnum)
 -
 -    @convert_svn_error
 -    @needs_busy
 -    def mkdir(self, relpath, mode=None):
 -        assert len(relpath) == 0 or relpath[0] != "/"
 -        path = urlutils.join(self.url, relpath)
 -        try:
 -            svn.client.mkdir([path.encode("utf-8")], self._client)
 -        except SubversionException, (msg, num):
 -            if num == ERR_FS_NOT_FOUND:
 -                raise NoSuchFile(path)
 -            if num == ERR_FS_ALREADY_EXISTS:
 -                raise FileExists(path)
 -            raise
 -
 -    @convert_svn_error
 -    def replay(self, revision, low_water_mark, send_deltas, editor, pool=None):
 -        self.mutter('svn replay -r%r:%r' % (low_water_mark, revision))
 -        self._mark_busy()
 -        edit, edit_baton = self._make_editor(editor, pool)
 -        svn.ra.replay(self._ra, revision, low_water_mark, send_deltas,
 -                      edit, edit_baton, pool)
 -
 -    @convert_svn_error
 -    def do_update(self, revnum, recurse, editor, pool=None):
 -        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, "", 
 -                             recurse, edit, edit_baton, pool))
 -
 -    @convert_svn_error
 -    def has_capability(self, cap):
 -        return svn.ra.has_capability(self._ra, cap)
 -
 -    @convert_svn_error
 -    def revprop_list(self, revnum, pool=None):
 -        self.mutter('svn revprop-list -r %r' % revnum)
 -        return svn.ra.rev_proplist(self._ra, revnum, pool)
 -
 -    @convert_svn_error
 -    def get_commit_editor(self, revprops, done_cb, lock_token, keep_locks):
 -        self._mark_busy()
 -        try:
 -            if hasattr(svn.ra, 'get_commit_editor3'):
 -                editor = svn.ra.get_commit_editor3(self._ra, revprops, done_cb, 
 -                                                  lock_token, keep_locks)
 -            elif revprops.keys() != [properties.PROP_REVISION_LOG]:
 -                raise NotImplementedError()
 -            else:
 -                editor = svn.ra.get_commit_editor2(self._ra, 
 -                            revprops[properties.PROP_REVISION_LOG],
 -                            done_cb, lock_token, keep_locks)
 -
 -            return Editor(self, editor)
 -        except:
 -            self._unmark_busy()
 -            raise
 +def Connection(url):
 +    try:
 +        mutter('opening SVN RA connection to %r' % url)
 +        ret = ra.RemoteAccess(url.encode('utf8'), 
 +                auth=create_auth_baton(url))
 +        # FIXME: Callbacks
 +    except SubversionException, (_, num):
-         if num in (constants.ERR_RA_SVN_REPOS_NOT_FOUND,):
++        if num in (ERR_RA_SVN_REPOS_NOT_FOUND,):
 +            raise NoSvnRepositoryPresent(url=url)
-         if num == constants.ERR_BAD_URL:
++        if num == ERR_BAD_URL:
 +            raise InvalidURL(url)
 +        raise
  
 -    class SvnLock(object):
 -        def __init__(self, connection, tokens):
 -            self._tokens = tokens
 -            self._connection = connection
 +    from bzrlib.plugins.svn import lazy_check_versions
 +    lazy_check_versions()
  
 -        def unlock(self):
 -            self._connection.unlock(self.locks)
 -
 -    @convert_svn_error
 -    @needs_busy
 -    def lock_write(self, path_revs, comment=None, steal_lock=False):
 -        tokens = {}
 -        def lock_cb(baton, path, do_lock, lock, ra_err, pool):
 -            tokens[path] = lock
 -        svn.ra.lock(self._ra, path_revs, comment, steal_lock, lock_cb)
 -        return SvnLock(self, tokens)
 -
 -    @convert_svn_error
 -    @needs_busy
 -    def get_log(self, paths, from_revnum, to_revnum, limit, 
 -                discover_changed_paths, strict_node_history, revprops, rcvr, 
 -                pool=None):
 -        # No paths starting with slash, please
 -        assert paths is None or all([not p.startswith("/") for p in paths])
 -        if (paths is None and 
 -            (svn.core.SVN_VER_MINOR < 6 or (
 -             svn.core.SVN_VER_REVISION < 31470 and svn.core.SVN_VER_REVISION != 0))):
 -            paths = ["/"]
 -        self.mutter('svn log %r:%r %r (limit: %r)' % (from_revnum, to_revnum, paths, limit))
 -        if hasattr(svn.ra, 'get_log2'):
 -            return svn.ra.get_log2(self._ra, paths, 
 -                           from_revnum, to_revnum, limit, 
 -                           discover_changed_paths, strict_node_history, False, 
 -                           revprops, rcvr, pool)
 -
 -        class LogEntry(object):
 -            def __init__(self, changed_paths, rev, author, date, message):
 -                self.changed_paths = changed_paths
 -                self.revprops = {}
 -                if properties.PROP_REVISION_AUTHOR in revprops:
 -                    self.revprops[properties.PROP_REVISION_AUTHOR] = author
 -                if properties.PROP_REVISION_LOG in revprops:
 -                    self.revprops[properties.PROP_REVISION_LOG] = message
 -                if properties.PROP_REVISION_DATE in revprops:
 -                    self.revprops[properties.PROP_REVISION_DATE] = date
 -                # FIXME: Check other revprops
 -                # FIXME: Handle revprops is None
 -                self.revision = rev
 -                self.has_children = None
 -
 -        def rcvr_convert(orig_paths, rev, author, date, message, pool):
 -            rcvr(LogEntry(orig_paths, rev, author, date, message), pool)
 -
 -        return svn.ra.get_log(self._ra, paths, 
 -                              from_revnum, to_revnum, limit, discover_changed_paths, 
 -                              strict_node_history, rcvr_convert, pool)
 -
 -    @convert_svn_error
 -    @needs_busy
 -    def reparent(self, url):
 -        if self.url == url:
 -            return
 -        if hasattr(svn.ra, 'reparent'):
 -            self.mutter('svn reparent %r' % url)
 -            svn.ra.reparent(self._ra, url)
 -            self.url = url
 -        else:
 -            raise NotImplementedError(self.reparent)
 +    return ret
  
  
  class ConnectionPool(object):
diff --cc tree.py
index e1f57ca1605d31075f90ae958c0a623c6de38b93,c1ac846b96411aaeb870fa5a9f321eb66f841ece..b9ce25b64ce057f77cb409fa3b76200d0623acbf
+++ b/tree.py
@@@ -28,8 -28,10 +28,8 @@@ import md
  from cStringIO import StringIO
  import urllib
  
 -import svn.core, svn.wc, svn.delta
 -from svn.core import Pool
 -
 -from bzrlib.plugins.svn import errors, properties
 +from bzrlib.plugins.svn.delta import apply_txdelta_handler
- from bzrlib.plugins.svn import core, constants, errors, wc, properties
++from bzrlib.plugins.svn import core, errors, wc, properties
  
  def parse_externals_description(base_url, val):
      """Parse an svn:externals property value.
diff --cc workingtree.py
index 0f51f1c1fbd4ad7b44a950d2b487a65a74abc407,e0f92f35efc1461e25cf758efc6715fed0f6e26a..33ac942951a87a4ebbb65cac92d067cf6f25db26
@@@ -35,7 -36,7 +35,7 @@@ from bzrlib.plugins.svn import properti
  from bzrlib.plugins.svn.branch import SvnBranch
  from bzrlib.plugins.svn.commit import _revision_id_to_svk_feature
  from bzrlib.plugins.svn.convert import SvnConverter
- from bzrlib.plugins.svn.errors import NoSvnRepositoryPresent
 -from bzrlib.plugins.svn.errors import LocalCommitsUnsupported, NoSvnRepositoryPresent, ERR_FS_TXN_OUT_OF_DATE, ERR_ENTRY_EXISTS, ERR_WC_PATH_NOT_FOUND, ERR_WC_NOT_DIRECTORY
++from bzrlib.plugins.svn.errors import NoSvnRepositoryPresent, ERR_FS_TXN_OUT_OF_DATE, ERR_ENTRY_EXISTS, ERR_WC_PATH_NOT_FOUND, ERR_WC_NOT_DIRECTORY, ERR_WC_UNSUPPORTED_FORMAT
  from bzrlib.plugins.svn.mapping import (SVN_PROP_BZR_ANCESTRY, SVN_PROP_BZR_FILEIDS, 
                       SVN_PROP_BZR_REVISION_ID, SVN_PROP_BZR_REVISION_INFO,
                       generate_revision_metadata)
@@@ -467,16 -533,17 +467,16 @@@ class SvnWorkingTree(WorkingTree)
              ids = iter(ids)
          assert isinstance(files, list)
          for f in files:
 -            wc = self._get_wc(os.path.dirname(f), write_lock=True)
 +            adm = self._get_wc(os.path.dirname(f), write_lock=True)
              try:
                  try:
 -                    svn.wc.add2(os.path.join(self.basedir, f), wc, None, 0, 
 -                            None, None, None)
 +                    adm.add(os.path.join(self.basedir, f))
                      if ids is not None:
 -                        self._change_fileid_mapping(ids.next(), f, wc)
 +                        self._change_fileid_mapping(ids.next(), f, adm)
                  except SubversionException, (_, num):
-                     if num == constants.ERR_ENTRY_EXISTS:
+                     if num == ERR_ENTRY_EXISTS:
                          continue
-                     elif num == constants.ERR_WC_PATH_NOT_FOUND:
+                     elif num == ERR_WC_PATH_NOT_FOUND:
                          raise NoSuchFile(path=f)
                      raise
              finally:
@@@ -695,14 -725,11 +695,14 @@@ class SvnCheckout(BzrDir)
          self.local_path = transport.local_abspath(".")
          
          # Open related remote repository + branch
 -        wc = svn.wc.adm_open3(None, self.local_path, False, 0, None)
          try:
 -            self.svn_url = svn.wc.entry(self.local_path, wc, True).url
 +            adm = wc.WorkingCopy(None, self.local_path)
-         except SubversionException, (msg, constants.ERR_WC_UNSUPPORTED_FORMAT):
++        except SubversionException, (msg, ERR_WC_UNSUPPORTED_FORMAT):
 +            raise UnsupportedFormatError(msg, kind='workingtree')
 +        try:
 +            self.svn_url = adm.entry(self.local_path, True).url
          finally:
 -            svn.wc.adm_close(wc)
 +            adm.close()
  
          self.remote_transport = SvnRaTransport(self.svn_url)
          self.remote_bzrdir = SvnRemoteAccess(self.remote_transport)