Rev 969: Fix cimports, avoid using stock python subversion bindings. in file:///data/jelmer/bzr-svn/pyrex/
Jelmer Vernooij
jelmer at samba.org
Fri Mar 14 00:47:09 GMT 2008
At file:///data/jelmer/bzr-svn/pyrex/
------------------------------------------------------------
revno: 969
revision-id:jelmer at samba.org-20080314004707-zsccmxh4tmes1wgn
parent: jelmer at samba.org-20080313210401-0b7crv6p9x3fzpjd
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pyrex
timestamp: Fri 2008-03-14 01:47:07 +0100
message:
Fix cimports, avoid using stock python subversion bindings.
added:
client.pyx client.pyx-20080313235339-wbyjbw2namuiql8f-1
core.pxd core.pxd-20080314004625-ng663dn07ewpc26a-1
core.pyx core.pyx-20080313210413-17k59slolpfe5kdq-1
renamed:
apr.pxi => apr.pxd apr.pxd-20080313192457-r08q1i1681oz4fqp-1
types.pxi => types.pxd types.pxi-20080313202425-vtt1ry64o98kgpg8-1
modified:
.bzrignore bzrignore-20060516185138-862ea098064007af
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
auth.py auth.py-20071209174622-w8d42k6nm5yhxvi8-1
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
commit.py commit.py-20060607190346-qvq128wgfubhhgm2-1
ra.pyx ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
setup.py setup.py-20060502115218-86950492da22353f
transport.py transport.py-20060406231150-b3472d06b3a0818d
tree.py tree.py-20060624222557-dudlwqcmkf22lt2s-1
wc.pyx wc.pyx-20080313142018-10l8l23vha2j9e6b-1
apr.pxd apr.pxd-20080313192457-r08q1i1681oz4fqp-1
types.pxd types.pxi-20080313202425-vtt1ry64o98kgpg8-1
=== modified file '.bzrignore'
--- a/.bzrignore 2008-03-13 19:22:29 +0000
+++ b/.bzrignore 2008-03-14 00:47:07 +0000
@@ -6,3 +6,7 @@
.plugins
ra.c
wc.c
+core.c
+ra.h
+core.h
+client.c
=== modified file '__init__.py'
--- a/__init__.py 2008-03-12 19:05:25 +0000
+++ b/__init__.py 2008-03-14 00:47:07 +0000
@@ -64,24 +64,6 @@
if not (bzrlib_version[0], bzrlib_version[1]-1) in desired:
raise BzrError('Version mismatch')
-def check_subversion_version():
- """Check that Subversion is compatible.
-
- """
- try:
- import svn.delta
- except ImportError:
- warning('No Python bindings for Subversion installed. See the '
- 'bzr-svn README for details.')
- raise bzrlib.errors.BzrError("missing python subversion bindings")
- if (not hasattr(svn.delta, 'svn_delta_invoke_txdelta_window_handler') and
- not hasattr(svn.delta, 'tx_invoke_window_handler')):
- warning('Installed Subversion version does not have updated Python '
- 'bindings. See the bzr-svn README for details.')
- raise bzrlib.errors.BzrError("incompatible python subversion bindings")
-
-check_subversion_version()
-
register_transport_proto('svn+ssh://',
help="Access using the Subversion smart server tunneled over SSH.")
register_transport_proto('svn+file://',
=== renamed file 'apr.pxi' => 'apr.pxd'
--- a/apr.pxi 2008-03-13 21:04:01 +0000
+++ b/apr.pxd 2008-03-14 00:47:07 +0000
@@ -25,6 +25,7 @@
cdef extern from "apr_file_io.h":
ctypedef struct apr_file_t
+ ctypedef long long apr_off_t
cdef extern from "apr_pools.h":
ctypedef struct apr_pool_t
=== modified file 'auth.py'
--- a/auth.py 2008-03-13 21:04:01 +0000
+++ b/auth.py 2008-03-14 00:47:07 +0000
@@ -17,7 +17,7 @@
from bzrlib.config import AuthenticationConfig
from bzrlib.ui import ui_factory
-from svn.core import (svn_auth_cred_username_t,
+from 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,
=== modified file 'branch.py'
--- a/branch.py 2008-03-13 21:04:01 +0000
+++ b/branch.py 2008-03-14 00:47:07 +0000
@@ -24,7 +24,7 @@
from bzrlib.revision import ensure_null
from bzrlib.workingtree import WorkingTree
-import svn.client, core
+import core
from core import SubversionException, Pool
from commit import push
=== added file 'client.pyx'
--- a/client.pyx 1970-01-01 00:00:00 +0000
+++ b/client.pyx 2008-03-14 00:47:07 +0000
@@ -0,0 +1,54 @@
+# Copyright (C) 2008 Jelmer Vernooij <jelmer at samba.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# 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_initialize, apr_hash_t
+from apr cimport apr_array_header_t, apr_array_make, apr_array_push
+from apr cimport apr_pool_t
+from types cimport svn_error_t
+from core cimport Pool, check_error
+
+apr_initialize()
+
+cdef extern from "svn_client.h":
+ ctypedef struct svn_client_ctx_t
+ ctypedef struct svn_client_commit_info_t
+ svn_error_t *svn_client_create_context(svn_client_ctx_t **ctx,
+ apr_pool_t *pool)
+
+ svn_error_t *svn_client_mkdir(svn_client_commit_info_t **commit_info_p,
+ apr_array_header_t *paths,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+
+
+cdef class Client:
+ cdef svn_client_ctx_t *client
+ cdef apr_pool_t *pool
+ def __init__(self):
+ self.pool = Pool(NULL)
+ check_error(svn_client_create_context(&self.client, self.pool))
+
+ def mkdir(self, paths):
+ cdef apr_array_header_t *apr_paths
+ cdef char **el
+ cdef svn_client_commit_info_t *commit_info
+ apr_paths = apr_array_make(self.pool, len(paths), 4)
+ for p in paths:
+ el = <char **>apr_array_push(apr_paths)
+ # FIXME: *el = p
+ check_error(svn_client_mkdir(&commit_info, apr_paths, self.client,
+ self.pool))
+
=== modified file 'commit.py'
--- a/commit.py 2008-03-13 21:04:01 +0000
+++ b/commit.py 2008-03-14 00:47:07 +0000
@@ -16,9 +16,7 @@
"""Committing and pushing to Subversion repositories."""
import svn.delta
-from svn.core import Pool, SubversionException
-
-from core import time_to_cstring
+from core import Pool, SubversionException, time_to_cstring
from bzrlib import debug, osutils, urlutils
from bzrlib.branch import Branch
@@ -456,7 +454,7 @@
raise
# Try without bzr: revprops
self.editor = self.repository.transport.get_commit_editor({
- core.SVN_PROP_REVISION_LOG: self._svn_revprops[svn.core.SVN_PROP_REVISION_LOG]},
+ core.SVN_PROP_REVISION_LOG: self._svn_revprops[core.SVN_PROP_REVISION_LOG]},
done, None, False)
del self._svn_revprops[core.SVN_PROP_REVISION_LOG]
=== added file 'core.pxd'
--- a/core.pxd 1970-01-01 00:00:00 +0000
+++ b/core.pxd 2008-03-14 00:47:07 +0000
@@ -0,0 +1,22 @@
+# Copyright (C) 2008 Jelmer Vernooij <jelmer at samba.org>
+# vim: ft=pyrex
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# 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
+from types cimport svn_error_t
+cdef apr_pool_t *Pool(apr_pool_t *parent)
+cdef check_error(svn_error_t *error)
+cdef svn_error_t *py_cancel_func(cancel_baton)
=== added file 'core.pyx'
--- a/core.pyx 1970-01-01 00:00:00 +0000
+++ b/core.pyx 2008-03-14 00:47:07 +0000
@@ -0,0 +1,69 @@
+# Copyright (C) 2008 Jelmer Vernooij <jelmer at samba.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# 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_pool_t, apr_pool_create, apr_pool_destroy
+
+apr_initialize()
+
+cdef svn_error_t *py_cancel_func(cancel_baton):
+ cancel_baton()
+ return NULL
+
+class SubversionException(Exception):
+ def __init__(self, num, msg):
+ self.num = num
+ self.msg = msg
+
+
+cdef check_error(svn_error_t *error):
+ if error:
+ raise SubversionException(error.apr_err, errormessage)
+
+
+cdef apr_pool_t *Pool(apr_pool_t *parent):
+ cdef apr_status_t status
+ cdef apr_pool_t *ret
+ ret = NULL
+ status = apr_pool_create(&ret, parent)
+ if status != 0:
+ # FIXME: Clearer error
+ raise Exception("APR Error")
+ return ret
+
+
+cdef extern from "svn_time.h":
+ char *svn_time_to_cstring(apr_time_t when, apr_pool_t *pool)
+ svn_error_t *svn_time_from_cstring(apr_time_t *when, char *data,
+ apr_pool_t *pool)
+
+cdef object time_to_cstring(when):
+ """Convert a UNIX timestamp to a Subversion CString."""
+ cdef apr_pool_t *pool
+ pool = Pool(NULL)
+ ret = svn_time_to_cstring(when, pool)
+ apr_pool_destroy(pool)
+ return ret
+
+cdef apr_time_t time_from_cstring(data):
+ """Parse a Subversion time string and return a UNIX timestamp."""
+ cdef apr_time_t when
+ cdef apr_pool_t *pool
+ check_error(svn_time_from_cstring(&when, data, pool))
+ apr_pool_destroy(pool)
+ return when
+
=== modified file 'ra.pyx'
--- a/ra.pyx 2008-03-13 21:04:01 +0000
+++ b/ra.pyx 2008-03-14 00:47:07 +0000
@@ -14,8 +14,13 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-include "apr.pxi"
-include "types.pxi"
+from apr cimport apr_pool_t, apr_pool_destroy
+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 core cimport check_error, Pool
+from types cimport svn_error_t, svn_revnum_t, svn_string_t, svn_version_t
+from types cimport svn_string_ncreate
apr_initialize()
@@ -72,8 +77,8 @@
ctypedef struct svn_delta_editor_t:
svn_error_t *(*set_target_revision)(void *edit_baton,
- svn_revnum_t target_revision, apr_pool_t *pool)
- svn_error_t *(*open_root)(void *edit_baton, long base_revision,
+ svn_revnum_t target_revision, apr_pool_t *pool)
+ svn_error_t *(*open_root)(void *edit_baton, svn_revnum_t base_revision,
apr_pool_t *dir_pool, void **root_baton)
svn_error_t *(*delete_entry)(char *path, long revision,
@@ -198,10 +203,41 @@
svn_error_t *(*abort_report)(void *report_baton, apr_pool_t *pool)
+ ctypedef void (*svn_ra_progress_notify_func_t)(apr_off_t progress, apr_off_t total, void *baton, apr_pool_t *pool)
+
+ ctypedef svn_error_t *(*svn_ra_get_wc_prop_func_t)(void *baton,
+ char *relpath,
+ char *name,
+ svn_string_t **value,
+ apr_pool_t *pool)
+
+ 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)
+
+ 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)
+
+ ctypedef svn_error_t *(*svn_ra_invalidate_wc_props_func_t)(void *baton,
+ char *path,
+ char *name,
+ apr_pool_t *pool)
+
ctypedef struct svn_ra_callbacks2_t:
svn_error_t *(*open_tmp_file)(apr_file_t **fp,
void *callback_baton, apr_pool_t *pool)
svn_auth_baton_t *auth_baton
+ svn_ra_get_wc_prop_func_t get_wc_prop
+ svn_ra_set_wc_prop_func_t set_wc_prop
+ svn_ra_push_wc_prop_func_t push_wc_prop
+ svn_ra_invalidate_wc_props_func_t invalidate_wc_props
+ svn_ra_progress_notify_func_t progress_func
+ void *progress_baton
svn_error_t *svn_ra_create_callbacks(svn_ra_callbacks2_t **callbacks,
apr_pool_t *pool)
@@ -349,6 +385,10 @@
cdef void *report_baton
cdef apr_pool_t *pool
+ cdef void set_reporter(self, svn_ra_reporter2_t *reporter, void *baton):
+ self.reporter = reporter
+ self.report_baton = baton
+
def set_path(self, path, revision, start_empty, lock_token):
check_error(self.reporter.set_path(self.report_baton, path, revision,
start_empty, lock_token, self.pool))
@@ -367,6 +407,9 @@
def abort_report(self):
check_error(self.reporter.abort_report(self.report_baton, self.pool))
+ def __dealloc__(self):
+ apr_pool_destroy(self.pool)
+
def version():
"""Get libsvn_ra version information.
@@ -460,11 +503,9 @@
check_error(svn_ra_do_update(self.ra, &reporter, &report_baton,
revision_to_update_to, update_target, recurse,
editor, update_editor, temp_pool))
- apr_pool_destroy(temp_pool)
ret = Reporter()
- ret.reporter = reporter
- ret.report_baton = report_baton
- ret.pool = temp_pool
+ ret.set_reporter(reporter, report_baton)
+ ret.set_pool(temp_pool)
return ret
def do_switch(self, revision_to_update_to, update_target, recurse,
@@ -477,19 +518,18 @@
check_error(svn_ra_do_update(self.ra, &reporter, &report_baton,
revision_to_update_to, update_target, recurse,
editor, update_editor, temp_pool))
- apr_pool_destroy(temp_pool)
- return Reporter(reporter, report_baton, temp_pool)
+ ret = Reporter()
+ ret.set_reporter(reporter, report_baton)
+ ret.set_pool(temp_pool)
+ return ret
def replay(self, revision, low_water_mark, send_deltas, update_editor):
- cdef svn_ra_reporter2_t *reporter
- cdef void *report_baton
cdef apr_pool_t *temp_pool
cdef svn_delta_editor_t *editor
temp_pool = Pool(self.pool)
check_error(svn_ra_replay(self.ra, revision, low_water_mark,
send_deltas, editor, update_editor, temp_pool))
apr_pool_destroy(temp_pool)
- return Reporter(reporter, report_baton, temp_pool)
def rev_proplist(self, rev):
cdef apr_pool_t *temp_pool
=== modified file 'repository.py'
--- a/repository.py 2008-03-13 21:04:01 +0000
+++ b/repository.py 2008-03-14 00:47:07 +0000
@@ -601,7 +601,7 @@
revids.append(parse_revid_property(line))
except errors.InvalidPropertyValue, ie:
mutter(str(ie))
- except SubversionException, (_, svn.core.SVN_ERR_FS_NOT_DIRECTORY):
+ except SubversionException, (_, core.SVN_ERR_FS_NOT_DIRECTORY):
continue
# If there are any new entries that are not yet in the cache,
=== modified file 'setup.py'
--- a/setup.py 2008-03-13 21:04:01 +0000
+++ b/setup.py 2008-03-14 00:47:07 +0000
@@ -36,6 +36,8 @@
ext_modules=[
Extension("core", ["core.pyx"], libraries=["svn_subr-1"],
include_dirs=[apr_include_dir(), svn_include_dir()]),
+ Extension("client", ["client.pyx"], libraries=["svn_client-1"],
+ 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("wc", ["wc.pyx"], libraries=["svn_wc-1"],
=== modified file 'transport.py'
--- a/transport.py 2008-03-13 21:04:01 +0000
+++ b/transport.py 2008-03-14 00:47:07 +0000
@@ -24,7 +24,7 @@
from core import SubversionException, Pool
import ra
import core
-import svn.client
+import client
from errors import convert_svn_error, NoSvnRepositoryPresent
@@ -47,27 +47,27 @@
providers += [auth.get_ssl_client_cert_pw_provider(1)]
providers += [
- svn.client.get_simple_provider(pool),
- svn.client.get_username_provider(pool),
- svn.client.get_ssl_client_cert_file_provider(pool),
- svn.client.get_ssl_client_cert_pw_file_provider(pool),
- svn.client.get_ssl_server_trust_file_provider(pool),
+ client.get_simple_provider(pool),
+ client.get_username_provider(pool),
+ client.get_ssl_client_cert_file_provider(pool),
+ client.get_ssl_client_cert_pw_file_provider(pool),
+ client.get_ssl_server_trust_file_provider(pool),
]
- if hasattr(svn.client, 'get_windows_simple_provider'):
- providers.append(svn.client.get_windows_simple_provider(pool))
-
- if hasattr(svn.client, 'get_keychain_simple_provider'):
- providers.append(svn.client.get_keychain_simple_provider(pool))
-
- if hasattr(svn.client, 'get_windows_ssl_server_trust_provider'):
- providers.append(svn.client.get_windows_ssl_server_trust_provider(pool))
+ if hasattr(client, 'get_windows_simple_provider'):
+ providers.append(client.get_windows_simple_provider(pool))
+
+ if hasattr(client, 'get_keychain_simple_provider'):
+ providers.append(client.get_keychain_simple_provider(pool))
+
+ if hasattr(client, 'get_windows_ssl_server_trust_provider'):
+ providers.append(client.get_windows_ssl_server_trust_provider(pool))
return core.svn_auth_open(providers, pool)
def create_svn_client(pool):
- client = svn.client.create_context(pool)
+ client = client.create_context(pool)
client.auth_baton = _create_auth_baton(pool)
client.config = svn_config
return client
@@ -209,8 +209,7 @@
self._client = create_svn_client(self.pool)
try:
self.mutter('opening SVN RA connection to %r' % self._backing_url)
- self._ra = svn.client.open_ra_session(self._backing_url.encode('utf8'),
- self._client, self.pool)
+ 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,):
raise NoSvnRepositoryPresent(url=url)
@@ -308,8 +307,7 @@
self._ra.reparent(self.svn_url, self.pool)
else:
self.mutter('svn reparent (reconnect) %r' % url)
- self._ra = svn.client.open_ra_session(self.svn_url.encode('utf8'),
- self._client, self.pool)
+ self._ra = self._client.open_ra_session(self.svn_url.encode('utf8'))
self._backing_url = self.svn_url
@convert_svn_error
@@ -386,7 +384,7 @@
assert len(relpath) == 0 or relpath[0] != "/"
path = urlutils.join(self.svn_url, relpath)
try:
- svn.client.mkdir([path.encode("utf-8")], self._client)
+ self._client.mkdir([path.encode("utf-8")])
except SubversionException, (msg, num):
if num == core.SVN_ERR_FS_NOT_FOUND:
raise NoSuchFile(path)
=== modified file 'tree.py'
--- a/tree.py 2008-03-13 21:04:01 +0000
+++ b/tree.py 2008-03-14 00:47:07 +0000
@@ -26,7 +26,7 @@
from cStringIO import StringIO
import urllib
-import core, svn.wc, svn.delta
+import core, wc, svn.delta
from core import Pool
# Deal with Subversion 1.5 and the patched Subversion 1.4 (which are
@@ -229,7 +229,7 @@
self._repository = workingtree.branch.repository
def add_file_to_inv(relpath, id, revid, wc):
- props = svn.wc.get_prop_diffs(self.workingtree.abspath(relpath), wc)
+ props = wc.get_prop_diffs(self.workingtree.abspath(relpath))
if isinstance(props, list): # Subversion 1.5
props = props[1]
if props.has_key(core.SVN_PROP_SPECIAL):
@@ -250,14 +250,14 @@
def find_ids(entry):
relpath = urllib.unquote(entry.url[len(entry.repos):].strip("/"))
- if entry.schedule in (svn.wc.schedule_normal,
- svn.wc.schedule_delete,
- svn.wc.schedule_replace):
+ if entry.schedule in (wc.schedule_normal,
+ wc.schedule_delete,
+ wc.schedule_replace):
return self.id_map[workingtree.branch.unprefix(relpath)]
return (None, None)
def add_dir_to_inv(relpath, wc, parent_id):
- entries = svn.wc.entries_read(wc, False)
+ entries = wc.entries_read(False)
entry = entries[""]
(id, revid) = find_ids(entry)
if id == None:
@@ -279,13 +279,13 @@
assert entry
if entry.kind == core.svn_node_dir:
- subwc = svn.wc.adm_open3(wc,
+ subwc = wc.WorkingCopy(
self.workingtree.abspath(subrelpath),
False, 0, None)
try:
add_dir_to_inv(subrelpath, subwc, id)
finally:
- svn.wc.adm_close(subwc)
+ subwc.close()
else:
(subid, subrevid) = find_ids(entry)
if subid is not None:
@@ -295,10 +295,10 @@
try:
add_dir_to_inv("", wc, None)
finally:
- svn.wc.adm_close(wc)
+ wc.adm_close()
def _abspath(self, relpath):
- return svn.wc.get_pristine_copy_path(self.workingtree.abspath(relpath))
+ return wc.get_pristine_copy_path(self.workingtree.abspath(relpath))
def get_file_lines(self, file_id):
base_copy = self._abspath(self.id2path(file_id))
=== renamed file 'types.pxi' => 'types.pxd'
--- a/types.pxi 2008-03-13 21:04:01 +0000
+++ b/types.pxd 2008-03-14 00:47:07 +0000
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import apr
+from apr cimport apr_status_t, apr_pool_t
cdef extern from "svn_version.h":
ctypedef struct svn_version_t:
=== modified file 'wc.pyx'
--- a/wc.pyx 2008-03-13 21:04:01 +0000
+++ b/wc.pyx 2008-03-14 00:47:07 +0000
@@ -14,14 +14,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-include "apr.pxi"
-include "types.pxi"
-
-from core import check_error, Pool
-
-cdef svn_error_t *py_cancel_func(cancel_baton):
- cancel_baton()
- return NULL
+from apr cimport apr_pool_t, apr_initialize, apr_hash_t, apr_pool_destroy
+from types cimport svn_error_t, svn_version_t, svn_boolean_t, svn_cancel_func_t , svn_string_t
+
+from core cimport check_error, Pool, py_cancel_func
apr_initialize()
@@ -34,7 +30,7 @@
svn_boolean_t write_lock,
int depth,
svn_cancel_func_t cancel_func,
- cancel_baton,
+ object cancel_baton,
apr_pool_t *pool)
svn_error_t *svn_wc_adm_close(svn_wc_adm_access_t *adm_access)
char *svn_wc_adm_access_path(svn_wc_adm_access_t *adm_access)
@@ -50,7 +46,7 @@
char *trail_url,
svn_boolean_t committed,
svn_cancel_func_t cancel_func,
- void *cancel_baton,
+ object cancel_baton,
apr_pool_t *pool)
svn_error_t *svn_wc_prop_get(svn_string_t **value,
char *name,
@@ -73,10 +69,11 @@
cdef class WorkingCopy:
cdef svn_wc_adm_access_t *adm
cdef apr_pool_t *pool
- def __init__(self, path, associated=None, write_lock=False, depth=0,
+ def __init__(self, associated, path, write_lock=False, depth=0,
cancel_func=None):
self.pool = Pool(NULL)
- check_error(svn_wc_adm_open3(&self.adm, associated, path,
+ # FIXME: Use associated
+ check_error(svn_wc_adm_open3(&self.adm, NULL, path,
write_lock, depth, py_cancel_func, cancel_func,
self.pool))
@@ -88,15 +85,22 @@
def prop_get(self, name, path):
cdef svn_string_t *value
+ cdef apr_pool_t *temp_pool
+ temp_pool = Pool(self.pool)
check_error(svn_wc_prop_get(&value, name, path, self.adm, temp_pool))
- return PyString_FromStringAndSize(value.data, value.len)
+ ret = PyString_FromStringAndSize(value.data, value.len)
+ apr_pool_destroy(temp_pool)
+ return ret
def entries_read(self, show_hidden):
cdef apr_hash_t *entries
+ cdef apr_pool_t *temp_pool
+ temp_pool = Pool(self.pool)
check_error(svn_wc_entries_read(&entries, self.adm,
show_hidden, temp_pool))
# FIXME: Create py_entries
py_entries = {}
+ apr_pool_destroy(temp_pool)
return py_entries
def __dealloc__(self):
@@ -105,9 +109,13 @@
def revision_status(wc_path, trail_url, committed, cancel_func=None):
cdef svn_wc_revision_status_t *revstatus
+ cdef apr_pool_t *temp_pool
+ temp_pool = Pool(NULL)
check_error(svn_wc_revision_status(&revstatus, wc_path, trail_url,
committed, py_cancel_func, cancel_func, temp_pool))
- return (revstatus.min_rev, revstatus.max_rev,
+ ret = (revstatus.min_rev, revstatus.max_rev,
revstatus.switched, revstatus.modified)
+ apr_pool_destroy(temp_pool)
+ return ret
More information about the bazaar-commits
mailing list