Rev 972: Move constants to separate file. in file:///data/jelmer/bzr-svn/pyrex/

Jelmer Vernooij jelmer at samba.org
Fri Mar 14 13:19:29 GMT 2008


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

------------------------------------------------------------
revno: 972
revision-id:jelmer at samba.org-20080314131927-818n92rrq2ql3p86
parent: jelmer at samba.org-20080314114445-nzp99qzfzqhffo2q
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pyrex
timestamp: Fri 2008-03-14 14:19:27 +0100
message:
  Move constants to separate file.
modified:
  branch.py                      svnbranch.py-20051017135706-11c749eb0dab04a7
  branchprops.py                 branchprops.py-20061223204623-80lvm7pjrpsgk0dd-1
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
  constants.py                   constants.py-20080313210342-fuq3eruf2102bwml-1
  convert.py                     svn2bzr.py-20051018015439-cb4563bff29e632d
  core.pyx                       core.pyx-20080313210413-17k59slolpfe5kdq-1
  errors.py                      errors.py-20061226172623-w1sbj8ynpo0eojqp-1
  format.py                      format.py-20070917005147-94kb7zysotf82kqw-1
  logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
  ra.pyx                         ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
  repos.pyx                      repos.pyx-20080314114432-g2b5lqe776tkbl4k-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  setup.py                       setup.py-20060502115218-86950492da22353f
  tests/__init__.py              __init__.py-20060508151940-e9f4d914801a2535
  tests/test_errors.py           test_errors.py-20070129114605-ban03f32t6ja14ez-1
  transport.py                   transport.py-20060406231150-b3472d06b3a0818d
  tree.py                        tree.py-20060624222557-dudlwqcmkf22lt2s-1
  wc.pyx                         wc.pyx-20080313142018-10l8l23vha2j9e6b-1
  workingtree.py                 workingtree.py-20060306120941-b083cb0fdd4a69de
=== modified file 'branch.py'
--- a/branch.py	2008-03-14 00:47:07 +0000
+++ b/branch.py	2008-03-14 13:19:27 +0000
@@ -25,7 +25,7 @@
 from bzrlib.workingtree import WorkingTree
 
 import core
-from core import SubversionException, Pool
+from core import SubversionException
 
 from commit import push
 from errors import NotSvnBranchPath
@@ -78,7 +78,7 @@
                 self.get_revnum()) != core.svn_node_dir:
                 raise NotBranchError(self.base)
         except SubversionException, (_, num):
-            if num == core.SVN_ERR_FS_NO_SUCH_REVISION:
+            if num == constants.ERR_FS_NO_SUCH_REVISION:
                 raise NotBranchError(self.base)
             raise
         if not self.mapping.is_branch(branch_path):
@@ -176,7 +176,7 @@
             rev.kind = svn.core.svn_opt_revision_number
             rev.value.number = revnum
 
-        client_ctx = create_svn_client(Pool())
+        client_ctx = create_svn_client()
         svn.client.checkout(bzr_to_svn_url(self.base), to_location, rev, 
                             True, client_ctx)
 

=== modified file 'branchprops.py'
--- a/branchprops.py	2008-03-13 21:04:01 +0000
+++ b/branchprops.py	2008-03-14 13:19:27 +0000
@@ -21,7 +21,8 @@
 
 from cache import CacheTable
 
-from core import SubversionException, Pool
+import constants
+from core import SubversionException
 
 class BranchPropertyList(CacheTable):
     """Simple class that retrieves file properties set on branches."""
@@ -50,7 +51,7 @@
             (_, _, props) = self.log._get_transport().get_dir(path, 
                 revnum)
         except SubversionException, (_, num):
-            if num == core.SVN_ERR_FS_NO_SUCH_REVISION:
+            if num == constants.ERR_FS_NO_SUCH_REVISION:
                 raise NoSuchRevision(self, revnum)
             raise
 

=== modified file 'commit.py'
--- a/commit.py	2008-03-14 00:47:07 +0000
+++ b/commit.py	2008-03-14 13:19:27 +0000
@@ -16,7 +16,7 @@
 """Committing and pushing to Subversion repositories."""
 
 import svn.delta
-from core import Pool, SubversionException, time_to_cstring
+from core import SubversionException, time_to_cstring
 
 from bzrlib import debug, osutils, urlutils
 from bzrlib.branch import Branch
@@ -77,7 +77,7 @@
     for (name, value) in revprops.items():
         try:
             transport.change_rev_prop(revnum, name, value)
-        except SubversionException, (_, core.SVN_ERR_REPOS_DISABLED_FEATURE):
+        except SubversionException, (_, constants.ERR_REPOS_DISABLED_FEATURE):
             raise RevpropChangeFailed(name)
 
 
@@ -693,7 +693,7 @@
     try:
         builder.commit(rev.message)
     except SubversionException, (_, num):
-        if num == core.SVN_ERR_FS_TXN_OUT_OF_DATE:
+        if num == constants.ERR_FS_TXN_OUT_OF_DATE:
             raise DivergedBranches(source, target)
         raise
     except ChangesRootLHSHistory:

=== modified file 'constants.py'
--- a/constants.py	2008-03-13 21:03:51 +0000
+++ b/constants.py	2008-03-14 13:19:27 +0000
@@ -14,4 +14,24 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 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

=== modified file 'convert.py'
--- a/convert.py	2008-03-14 11:44:45 +0000
+++ b/convert.py	2008-03-14 13:19:27 +0000
@@ -61,7 +61,7 @@
         created.
     """
     from cStringIO import StringIO
-    repos = repos.svn_repos_create(outputdir, '', '', None, None)
+    repos = repos.create(outputdir, '', '', None, None)
     if dumpfile.endswith(".gz"):
         import gzip
         file = gzip.GzipFile(dumpfile)
@@ -74,7 +74,7 @@
         svn.repos.load_fs2(repos, file, StringIO(), 
                 svn.repos.load_uuid_default, '', 0, 0, None)
     except core.SubversionException, (_, num):
-        if num == core.SVN_ERR_STREAM_MALFORMED_DATA:
+        if num == constants.ERR_STREAM_MALFORMED_DATA:
             raise NotDumpFile(dumpfile)
         raise
     return repos

=== modified file 'core.pyx'
--- a/core.pyx	2008-03-14 11:14:15 +0000
+++ b/core.pyx	2008-03-14 13:19:27 +0000
@@ -15,7 +15,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from types cimport svn_error_t
-from apr cimport apr_initialize, apr_status_t, apr_time_t
+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
 
 apr_initialize()
@@ -54,7 +54,7 @@
     svn_error_t *svn_time_from_cstring(apr_time_t *when, char *data, 
                                        apr_pool_t *pool)
 
-cdef object time_to_cstring(when):
+def time_to_cstring(when):
     """Convert a UNIX timestamp to a Subversion CString."""
     cdef apr_pool_t *pool
     pool = Pool(NULL)
@@ -62,7 +62,7 @@
     apr_pool_destroy(pool)
     return ret
 
-cdef apr_time_t time_from_cstring(data):
+def time_from_cstring(data):
     """Parse a Subversion time string and return a UNIX timestamp."""
     cdef apr_time_t when
     cdef apr_pool_t *pool
@@ -70,3 +70,29 @@
     apr_pool_destroy(pool)
     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,
+                                       apr_pool_t *pool)
+
+def get_config(config_dir=None):
+    cdef apr_pool_t *pool
+    cdef apr_hash_t *cfg_hash
+    cdef char *c_config_dir
+    pool = Pool(NULL)
+    if config_dir is None:
+        c_config_dir = NULL
+    else:
+        c_config_dir = config_dir
+    check_error(svn_config_get_config(&cfg_hash, c_config_dir, pool))
+    ret = {}
+    # FIXME: Convert cfghash to ret
+    apr_pool_destroy(pool)
+    return ret
+

=== modified file 'errors.py'
--- a/errors.py	2008-03-13 21:04:01 +0000
+++ b/errors.py	2008-03-14 13:19:27 +0000
@@ -81,17 +81,17 @@
     """
     (msg, num) = err.args
 
-    if num == core.SVN_ERR_RA_SVN_CONNECTION_CLOSED:
+    if num == constants.ERR_RA_SVN_CONNECTION_CLOSED:
         return ConnectionReset(msg=msg)
-    elif num == core.SVN_ERR_WC_LOCKED:
+    elif num == constants.ERR_WC_LOCKED:
         return LockError(message=msg)
-    elif num == core.SVN_ERR_RA_NOT_AUTHORIZED:
+    elif num == constants.ERR_RA_NOT_AUTHORIZED:
         return PermissionDenied('.', msg)
-    elif num == core.SVN_ERR_INCOMPLETE_DATA:
+    elif num == constants.ERR_INCOMPLETE_DATA:
         return UnexpectedEndOfContainerError()
-    elif num == core.SVN_ERR_RA_SVN_MALFORMED_DATA:
+    elif num == constants.ERR_RA_SVN_MALFORMED_DATA:
         return TransportError("Malformed data", msg)
-    elif num == core.SVN_ERR_RA_NOT_IMPLEMENTED:
+    elif num == constants.ERR_RA_NOT_IMPLEMENTED:
         return NotImplementedError("Function not implemented in remote server")
     elif num == constants.ERR_UNKNOWN_HOSTNAME:
         return ConnectionError(msg=msg)

=== modified file 'format.py'
--- a/format.py	2008-03-13 21:04:01 +0000
+++ b/format.py	2008-03-14 13:19:27 +0000
@@ -58,9 +58,9 @@
         try:
             transport = get_svn_ra_transport(transport)
         except core.SubversionException, (_, num):
-            if num in (core.SVN_ERR_RA_ILLEGAL_URL, \
-                       core.SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED, \
-                       core.SVN_ERR_BAD_URL):
+            if num in (constants.ERR_RA_ILLEGAL_URL, \
+                       constants.ERR_RA_LOCAL_REPOS_OPEN_FAILED, \
+                       constants.ERR_BAD_URL):
                 raise bzr_errors.NotBranchError(path=transport.base)
 
         return format
@@ -70,7 +70,7 @@
         try: 
             return remote.SvnRemoteAccess(transport, self)
         except core.SubversionException, (_, num):
-            if num == core.SVN_ERR_RA_DAV_REQUEST_FAILED:
+            if num == constants.ERR_RA_DAV_REQUEST_FAILED:
                 raise bzr_errors.NotBranchError(transport.base)
             raise
 
@@ -134,7 +134,7 @@
         try:
             return SvnCheckout(transport, self)
         except core.SubversionException, (_, num):
-            if num in (core.SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED,):
+            if num in (constants.ERR_RA_LOCAL_REPOS_OPEN_FAILED,):
                 raise errors.NoSvnRepositoryPresent(transport.base)
             raise
 

=== modified file 'logwalker.py'
--- a/logwalker.py	2008-03-13 21:04:01 +0000
+++ b/logwalker.py	2008-03-14 13:19:27 +0000
@@ -20,7 +20,7 @@
 import bzrlib.ui as ui
 from copy import copy
 
-from core import SubversionException, Pool
+from core import SubversionException
 from transport import SvnRaTransport
 import core
 
@@ -82,7 +82,7 @@
 
         pb = ui.ui_factory.nested_progress_bar()
 
-        def rcvr(log_entry, pool):
+        def rcvr(log_entry):
             pb.update('fetching svn revision info', log_entry.revision, to_revnum)
             orig_paths = log_entry.changed_paths
             if orig_paths is None:
@@ -95,8 +95,6 @@
                 self.db.execute(
                      "replace into changed_path (rev, path, action, copyfrom_path, copyfrom_rev) values (?, ?, ?, ?, ?)", 
                      (log_entry.revision, p.strip("/"), orig_paths[p].action, copyfrom_path, orig_paths[p].copyfrom_rev))
-                # Work around nasty memory leak in Subversion
-                orig_paths[p]._parent_pool.destroy()
 
             self.saved_revnum = log_entry.revision
             if self.saved_revnum % 1000 == 0:
@@ -105,15 +103,13 @@
         try:
             try:
                 while self.saved_revnum < to_revnum:
-                    pool = Pool()
                     self._get_transport().get_log("", self.saved_revnum, 
                                              to_revnum, self._limit, True, 
-                                             True, [], rcvr, pool)
-                    pool.destroy()
+                                             True, [], rcvr)
             finally:
                 pb.finished()
         except SubversionException, (_, num):
-            if num == core.SVN_ERR_FS_NO_SUCH_REVISION:
+            if num == constants.ERR_FS_NO_SUCH_REVISION:
                 raise NoSuchRevision(branch=self, 
                     revision="Revision number %d" % to_revnum)
             raise
@@ -265,15 +261,15 @@
                 """See Editor.open_root()."""
                 return path
 
-            def add_directory(self, path, parent_baton, copyfrom_path, copyfrom_revnum, pool):
+            def add_directory(self, path, parent_baton, copyfrom_path, copyfrom_revnum):
                 """See Editor.add_directory()."""
                 self.files.append(urlutils.join(self.base, path))
                 return path
 
-            def change_dir_prop(self, id, name, value, pool):
+            def change_dir_prop(self, id, name, value):
                 pass
 
-            def change_file_prop(self, id, name, value, pool):
+            def change_file_prop(self, id, name, value):
                 pass
 
             def add_file(self, path, parent_id, copyfrom_path, copyfrom_revnum, baton):
@@ -294,15 +290,14 @@
 
             def apply_textdelta(self, file_id, base_checksum):
                 pass
-        pool = Pool()
         editor = TreeLister(path)
         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, editor, pool)
-            reporter.set_path("", revnum, True, None, pool)
-            reporter.finish_report(pool)
+            reporter = transport.do_update(revnum, True, editor)
+            reporter.set_path("", revnum, True, None)
+            reporter.finish_report()
         finally:
             transport.reparent(old_base)
         return editor.files

=== modified file 'ra.pyx'
--- a/ra.pyx	2008-03-14 11:14:15 +0000
+++ b/ra.pyx	2008-03-14 13:19:27 +0000
@@ -18,8 +18,10 @@
 from apr cimport apr_hash_t, apr_hash_make, apr_hash_index_t, apr_hash_first, apr_hash_next, apr_hash_this, apr_hash_set
 from apr cimport apr_array_header_t
 from apr cimport apr_file_t, apr_off_t
+from apr cimport apr_initialize
 from core cimport check_error, Pool, wrap_lock
 from core import SubversionException
+from core import SVN_PROP_REVISION_LOG, SVN_PROP_REVISION_AUTHOR, SVN_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
 
@@ -607,8 +609,9 @@
         cdef apr_pool_t *temp_pool
         cdef int has
         temp_pool = Pool(self.pool)
-        check_error(svn_ra_has_capability(self.ra, &has, capability, 
-                     temp_pool))
+		# FIXME: Svn 1.5 only
+        # check_error(svn_ra_has_capability(self.ra, &has, capability, 
+        #             temp_pool))
         apr_pool_destroy(temp_pool)
         return has
 
@@ -637,6 +640,3 @@
     def __repr__(self):
         return "%s(%r)" % (self.__class__.__name__, self.url)
 
-SVN_PROP_REVISION_LOG = "svn:log"
-SVN_PROP_REVISION_AUTHOR = "svn:author"
-SVN_PROP_REVISION_DATE = "svn:date"

=== modified file 'repos.pyx'
--- a/repos.pyx	2008-03-14 11:44:45 +0000
+++ b/repos.pyx	2008-03-14 13:19:27 +0000
@@ -14,11 +14,19 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from apr cimport apr_pool_t, apr_hash_t
+from apr cimport apr_pool_t, apr_hash_t, apr_pool_destroy
+from types cimport svn_error_t, svn_boolean_t, svn_cancel_func_t
+
+from core cimport Pool, check_error
 
 cdef extern from "svn_repos.h":
-	ctypedef struct svn_repos_t
-	svn_error_t *svn_repos_create(svn_repos_t **repos_p, 
+    ctypedef struct svn_repos_t
+    ctypedef struct svn_stream_t
+    enum svn_repos_load_uuid:
+        svn_repos_load_uuid_default,
+        svn_repos_load_uuid_ignore,
+        svn_repos_load_uuid_force
+    svn_error_t *svn_repos_create(svn_repos_t **repos_p, 
                               char *path,
                               char *unused_1,
                               char *unused_2,
@@ -26,3 +34,25 @@
                               apr_hash_t *fs_config,
                               apr_pool_t *pool)
 
+    svn_error_t *svn_repos_load_fs2(svn_repos_t *repos,
+                                svn_stream_t *dumpstream,
+                                svn_stream_t *feedback_stream,
+                                svn_repos_load_uuid uuid_action,
+                                char *parent_dir,
+                                svn_boolean_t use_pre_commit_hook,
+                                svn_boolean_t use_post_commit_hook,
+                                svn_cancel_func_t cancel_func,
+                                void *cancel_baton,
+                                apr_pool_t *pool)
+
+def create(path, config=None, fs_config=None):
+    cdef svn_repos_t *repos
+    cdef apr_pool_t *pool
+    cdef apr_hash_t *hash_config, *hash_fs_config
+    pool = Pool(NULL)
+    hash_config = NULL # FIXME
+    hash_fs_config = NULL # FIXME
+    check_error(svn_repos_create(&repos, path, "", "", 
+                hash_config, hash_fs_config, pool))
+    apr_pool_destroy(pool)
+    return None # FIXM: repos

=== modified file 'repository.py'
--- a/repository.py	2008-03-14 00:47:07 +0000
+++ b/repository.py	2008-03-14 13:19:27 +0000
@@ -28,7 +28,7 @@
 from bzrlib.transport import Transport, get_transport
 from bzrlib.trace import info, mutter
 
-from core import SubversionException, Pool
+from core import SubversionException
 import core
 
 import os
@@ -354,7 +354,7 @@
         try:
             return (core.svn_node_dir == self.transport.check_path(path, revnum))
         except SubversionException, (_, num):
-            if num == core.SVN_ERR_FS_NO_SUCH_REVISION:
+            if num == constants.ERR_FS_NO_SUCH_REVISION:
                 return False
             raise
 
@@ -529,7 +529,7 @@
             (bzr_revno, revid) = mapping.get_revision_id(path, revprops, 
                                                          fileprops)
         except SubversionException, (_, num):
-            if num == core.SVN_ERR_FS_NO_SUCH_REVISION:
+            if num == constants.ERR_FS_NO_SUCH_REVISION:
                 raise NoSuchRevision(path, revnum)
             raise
 
@@ -601,7 +601,7 @@
                             revids.append(parse_revid_property(line))
                         except errors.InvalidPropertyValue, ie:
                             mutter(str(ie))
-                except SubversionException, (_, core.SVN_ERR_FS_NOT_DIRECTORY):
+                except SubversionException, (_, constants.ERR_FS_NOT_DIRECTORY):
                     continue
 
                 # If there are any new entries that are not yet in the cache, 
@@ -939,7 +939,7 @@
                                         elif (scheme.is_branch_parent(n) or 
                                               scheme.is_tag_parent(n)):
                                             parents.append(n)
-                                except SubversionException, (_, core.SVN_ERR_FS_NOT_DIRECTORY):
+                                except SubversionException, (_, constants.ERR_FS_NOT_DIRECTORY):
                                     pass
         finally:
             pb.finished()

=== modified file 'setup.py'
--- a/setup.py	2008-03-14 00:47:07 +0000
+++ b/setup.py	2008-03-14 13:19:27 +0000
@@ -40,6 +40,8 @@
                     include_dirs=[apr_include_dir(), svn_include_dir()]), 
           Extension("ra", ["ra.pyx"], libraries=["svn_ra-1"], 
                     include_dirs=[apr_include_dir(), svn_include_dir()]), 
+          Extension("repos", ["repos.pyx"], libraries=["svn_repos-1"], 
+                    include_dirs=[apr_include_dir(), svn_include_dir()]), 
           Extension("wc", ["wc.pyx"], libraries=["svn_wc-1"],
                      include_dirs=[apr_include_dir(), svn_include_dir()])],
       cmdclass = {'build_ext': build_ext},

=== modified file 'tests/__init__.py'
--- a/tests/__init__.py	2008-03-13 14:23:55 +0000
+++ b/tests/__init__.py	2008-03-14 13:19:27 +0000
@@ -26,7 +26,7 @@
 from bzrlib.urlutils import local_path_to_url
 from bzrlib.workingtree import WorkingTree
 
-import svn.repos, svn.wc
+import repos, wc, client
 from bzrlib.plugins.svn.errors import NoCheckoutSupport
 
 class TestCaseWithSubversionRepository(TestCaseInTempDir):
@@ -35,7 +35,7 @@
 
     def setUp(self):
         super(TestCaseWithSubversionRepository, self).setUp()
-        self.client_ctx = svn.client.create_context()
+        self.client_ctx = client.Client()
         self.client_ctx.log_msg_func2 = svn.client.svn_swig_py_get_commit_log_func
         self.client_ctx.log_msg_baton2 = self.log_message_func
 
@@ -49,7 +49,7 @@
         """
         abspath = os.path.join(self.test_dir, relpath)
 
-        svn.repos.create(abspath, '', '', None, None)
+        repos.create(abspath)
 
         if allow_revprop_changes:
             if sys.platform == 'win32':

=== modified file 'tests/test_errors.py'
--- a/tests/test_errors.py	2008-03-12 15:01:25 +0000
+++ b/tests/test_errors.py	2008-03-14 13:19:27 +0000
@@ -20,8 +20,8 @@
 from bzrlib.tests import TestCase
 
 from errors import (convert_svn_error, convert_error, InvalidPropertyValue, 
-                    InvalidSvnBranchPath, NotSvnBranchPath, 
-                    SVN_ERR_UNKNOWN_HOSTNAME)
+                    InvalidSvnBranchPath, NotSvnBranchPath)
+from constants import ERR_UNKNOWN_HOSTNAME
 
 import svn.core
 from svn.core import SubversionException

=== modified file 'transport.py'
--- a/transport.py	2008-03-14 11:14:15 +0000
+++ b/transport.py	2008-03-14 13:19:27 +0000
@@ -28,7 +28,7 @@
 
 from errors import convert_svn_error, NoSvnRepositoryPresent
 
-svn_config = core.svn_config_get_config(None)
+svn_config = core.get_config(None)
 
 def get_client_string():
     """Return a string that can be send as part of the User Agent string."""
@@ -210,9 +210,9 @@
             self.mutter('opening SVN RA connection to %r' % self._backing_url)
             self._ra = self._client.open_ra_session(self._backing_url.encode('utf8'))
         except SubversionException, (_, num):
-            if num in (core.SVN_ERR_RA_SVN_REPOS_NOT_FOUND,):
+            if num in (constants.ERR_RA_SVN_REPOS_NOT_FOUND,):
                 raise NoSvnRepositoryPresent(url=url)
-            if num == core.SVN_ERR_BAD_URL:
+            if num == constants.ERR_BAD_URL:
                 raise InvalidURL(url)
             raise
 
@@ -339,7 +339,7 @@
             (dirents, _, _) = self.get_dir(self._request_path(relpath),
                                            self.get_latest_revnum())
         except SubversionException, (msg, num):
-            if num == core.SVN_ERR_FS_NOT_DIRECTORY:
+            if num == constants.ERR_FS_NOT_DIRECTORY:
                 raise NoSuchFile(relpath)
             raise
         return dirents.keys()
@@ -385,9 +385,9 @@
         try:
             self._client.mkdir([path.encode("utf-8")])
         except SubversionException, (msg, num):
-            if num == core.SVN_ERR_FS_NOT_FOUND:
+            if num == constants.ERR_FS_NOT_FOUND:
                 raise NoSuchFile(path)
-            if num == core.SVN_ERR_FS_ALREADY_EXISTS:
+            if num == constants.ERR_FS_ALREADY_EXISTS:
                 raise FileExists(path)
             raise
 

=== modified file 'tree.py'
--- a/tree.py	2008-03-14 00:47:07 +0000
+++ b/tree.py	2008-03-14 13:19:27 +0000
@@ -27,27 +27,26 @@
 import urllib
 
 import core, wc, svn.delta
-from core import Pool
 
 # Deal with Subversion 1.5 and the patched Subversion 1.4 (which are 
 # slightly different).
 
 if hasattr(svn.delta, 'tx_invoke_window_handler'):
-    def apply_txdelta_handler(src_stream, target_stream, pool):
+    def apply_txdelta_handler(src_stream, target_stream):
         assert hasattr(src_stream, 'read')
         assert hasattr(target_stream, 'write')
         window_handler, baton = svn.delta.tx_apply(src_stream, target_stream, 
-                                                   None, pool)
+                                                   None)
 
         def wrapper(window):
             window_handler(window, baton)
 
         return wrapper
 else:
-    def apply_txdelta_handler(src_stream, target_stream, pool):
+    def apply_txdelta_handler(src_stream, target_stream):
         assert hasattr(src_stream, 'read')
         assert hasattr(target_stream, 'write')
-        ret = svn.delta.svn_txdelta_apply(src_stream, target_stream, None, pool)
+        ret = svn.delta.svn_txdelta_apply(src_stream, target_stream, None)
 
         def wrapper(window):
             svn.delta.invoke_txdelta_window_handler(
@@ -60,20 +59,18 @@
     def __init__(self, repository, revision_id):
         self._repository = repository
         self._revision_id = revision_id
-        pool = Pool()
         (self.branch_path, self.revnum, mapping) = repository.lookup_revision_id(revision_id)
         self._inventory = Inventory()
         self.id_map = repository.get_fileid_map(self.revnum, self.branch_path, 
                                                 mapping)
-        editor = TreeBuildEditor(self, pool)
+        editor = TreeBuildEditor(self)
         self.file_data = {}
         root_repos = repository.transport.get_svn_repos_root()
         reporter = repository.transport.do_switch(
                 self.revnum, True, 
-                urlutils.join(root_repos, self.branch_path), editor, pool)
-        reporter.set_path("", 0, True, None, pool)
-        reporter.finish_report(pool)
-        pool.destroy()
+                urlutils.join(root_repos, self.branch_path), editor)
+        reporter.set_path("", 0, True, None)
+        reporter.finish_report()
 
     def get_file_lines(self, file_id):
         return osutils.split_lines(self.file_data[file_id])
@@ -81,13 +78,12 @@
 
 class TreeBuildEditor(svn.delta.Editor):
     """Builds a tree given Subversion tree transform calls."""
-    def __init__(self, tree, pool):
+    def __init__(self, tree):
         self.tree = tree
         self.repository = tree._repository
         self.last_revnum = {}
         self.dir_revnum = {}
         self.dir_ignores = {}
-        self.pool = pool
 
     def set_target_revision(self, revnum):
         self.revnum = revnum
@@ -99,14 +95,14 @@
         self.tree._inventory.revision_id = revision_id
         return file_id
 
-    def add_directory(self, path, parent_baton, copyfrom_path, copyfrom_revnum, pool):
+    def add_directory(self, path, parent_baton, copyfrom_path, copyfrom_revnum):
         path = path.decode("utf-8")
         file_id, revision_id = self.tree.id_map[path]
         ie = self.tree._inventory.add_path(path, 'directory', file_id)
         ie.revision = revision_id
         return file_id
 
-    def change_dir_prop(self, id, name, value, pool):
+    def change_dir_prop(self, id, name, value):
         from mapping import (SVN_PROP_BZR_ANCESTRY, 
                         SVN_PROP_BZR_PREFIX, SVN_PROP_BZR_REVISION_INFO, 
                         SVN_PROP_BZR_FILEIDS, SVN_PROP_BZR_REVISION_ID,
@@ -141,7 +137,7 @@
               name.startswith(SVN_PROP_BZR_PREFIX)):
             mutter('unsupported dir property %r' % name)
 
-    def change_file_prop(self, id, name, value, pool):
+    def change_file_prop(self, id, name, value):
         from mapping import SVN_PROP_BZR_PREFIX
 
         if name == core.SVN_PROP_EXECUTABLE:
@@ -212,7 +208,7 @@
 
     def apply_textdelta(self, file_id, base_checksum):
         self.file_stream = StringIO()
-        return apply_txdelta_handler(StringIO(""), self.file_stream, self.pool)
+        return apply_txdelta_handler(StringIO(""), self.file_stream)
 
 
 class SvnBasisTree(RevisionTree):

=== modified file 'wc.pyx'
--- a/wc.pyx	2008-03-14 11:44:45 +0000
+++ b/wc.pyx	2008-03-14 13:19:27 +0000
@@ -21,6 +21,9 @@
 
 apr_initialize()
 
+cdef extern from "Python.h":
+    object PyString_FromStringAndSize(char *, long len)
+
 cdef extern from "svn_wc.h":
     ctypedef struct svn_wc_adm_access_t
     svn_version_t *svn_wc_version()
@@ -73,8 +76,8 @@
 
     :return: tuple with major, minor, patch version number and tag.
     """
-    return (svn_ra_version().major, svn_ra_version().minor, 
-            svn_ra_version().minor, svn_ra_version().tag)
+    return (svn_wc_version().major, svn_wc_version().minor, 
+            svn_wc_version().minor, svn_wc_version().tag)
 
 cdef class WorkingCopy:
     cdef svn_wc_adm_access_t *adm

=== modified file 'workingtree.py'
--- a/workingtree.py	2008-03-13 21:04:01 +0000
+++ b/workingtree.py	2008-03-14 13:19:27 +0000
@@ -51,8 +51,8 @@
 import os
 import urllib
 
-import core. svn.wc
-from core.import SubversionException, Pool, svn_time_to_cstring
+import core, svn.wc
+from core import SubversionException, time_to_cstring
 
 from errors import NoCheckoutSupport
 from format import get_rich_root_format
@@ -458,7 +458,7 @@
                 commit_info = svn.client.commit3(specific_files, True, False, 
                                                  self.client_ctx)
             except SubversionException, (_, num):
-                if num == core.SVN_ERR_FS_TXN_OUT_OF_DATE:
+                if num == constants.ERR_FS_TXN_OUT_OF_DATE:
                     raise OutOfDateTree(self)
                 raise
         except:
@@ -544,9 +544,9 @@
                     if ids is not None:
                         self._change_fileid_mapping(ids.next(), f, wc)
                 except SubversionException, (_, num):
-                    if num == core.SVN_ERR_ENTRY_EXISTS:
+                    if num == constants.ERR_ENTRY_EXISTS:
                         continue
-                    elif num == core.SVN_ERR_WC_PATH_NOT_FOUND:
+                    elif num == constants.ERR_WC_PATH_NOT_FOUND:
                         raise NoSuchFile(path=f)
                     raise
             finally:
@@ -798,7 +798,7 @@
             branch = SvnBranch(self.svn_root_transport.base, repos, 
                                self.remote_bzrdir.branch_path)
         except SubversionException, (_, num):
-            if num == core.SVN_ERR_WC_NOT_DIRECTORY:
+            if num == constants.ERR_WC_NOT_DIRECTORY:
                 raise NotBranchError(path=self.base)
             raise
 




More information about the bazaar-commits mailing list