Rev 1059: Fix some bugs in apr pool handling. in file:///data/jelmer/bzr-svn/cext/
Jelmer Vernooij
jelmer at samba.org
Tue Jun 3 01:00:54 BST 2008
At file:///data/jelmer/bzr-svn/cext/
------------------------------------------------------------
revno: 1059
revision-id: jelmer at samba.org-20080603000050-n1f02r4345b77nkj
parent: jelmer at samba.org-20080602231247-agqcn0isu6prnj3f
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: cext
timestamp: Tue 2008-06-03 02:00:50 +0200
message:
Fix some bugs in apr pool handling.
modified:
Makefile makefile.other-20080311181537-5svhje3v1flh1n4f-1
client.c client.pyx-20080313235339-wbyjbw2namuiql8f-1
core.c core.pyx-20080313210413-17k59slolpfe5kdq-1
ra.c ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
repos.c repos.pyx-20080314114432-g2b5lqe776tkbl4k-1
tests/test_ra.py test_ra.py-20080313141743-uzsm7ejitrlqone5-1
transport.py transport.py-20060406231150-b3472d06b3a0818d
util.c util.c-20080531154025-s8ef6ej9tytsnkkw-1
util.h util.h-20080531154025-s8ef6ej9tytsnkkw-2
wc.c wc.pyx-20080313142018-10l8l23vha2j9e6b-1
=== modified file 'Makefile'
--- a/Makefile 2008-06-02 23:12:47 +0000
+++ b/Makefile 2008-06-03 00:00:50 +0000
@@ -46,6 +46,9 @@
valgrind-check::
$(MAKE) check DEBUGGER="valgrind --suppressions=/usr/lib/valgrind/python.supp $(VALGRIND_OPTIONS)"
+gdb-check::
+ $(MAKE) check DEBUGGER="gdb --args $(GDB_OPTIONS)"
+
show-plugins::
BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(BZR) plugins
=== modified file 'client.c'
--- a/client.c 2008-06-02 23:12:41 +0000
+++ b/client.c 2008-06-03 00:00:50 +0000
@@ -112,7 +112,9 @@
if (ret == NULL)
return NULL;
- ret->pool = Pool(NULL);
+ ret->pool = Pool();
+ if (ret->pool == NULL)
+ return NULL;
if (!check_error(svn_client_create_context(&ret->client, ret->pool)))
return NULL;
return (PyObject *)ret;
=== modified file 'core.c'
--- a/core.c 2008-06-02 23:12:41 +0000
+++ b/core.c 2008-06-03 00:00:50 +0000
@@ -35,7 +35,7 @@
apr_time_t when;
if (!PyArg_ParseTuple(args, "l", &when))
return NULL;
- pool = Pool(NULL);
+ pool = Pool();
if (pool == NULL)
return NULL;
ret = PyString_FromString(svn_time_to_cstring(when, pool));
@@ -53,7 +53,9 @@
if (!PyArg_ParseTuple(args, "s", &data))
return NULL;
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(pool, svn_time_from_cstring(&when, data, pool));
apr_pool_destroy(pool);
return PyLong_FromLong(when);
@@ -73,7 +75,9 @@
if (!PyArg_ParseTuple(args, "|z", &config_dir))
return NULL;
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(pool,
svn_config_get_config(&cfg_hash, config_dir, pool));
ret = PyDict_New();
@@ -103,7 +107,9 @@
PyObject *mod;
apr_initialize();
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return;
svn_utf_initialize(pool);
mod = Py_InitModule3("core", core_methods, "Core functions");
=== modified file 'ra.c'
--- a/ra.c 2008-06-02 23:12:41 +0000
+++ b/ra.c 2008-06-03 00:00:50 +0000
@@ -20,6 +20,7 @@
#include <apr_general.h>
#include <svn_types.h>
#include <svn_ra.h>
+#include <apr_file_io.h>
#include "editor.h"
#include "util.h"
@@ -444,6 +445,7 @@
/** Connection to a remote Subversion repository. */
typedef struct {
+ PyObject_HEAD
svn_ra_session_t *ra;
apr_pool_t *pool;
char *url;
@@ -451,6 +453,14 @@
AuthObject *auth;
} RemoteAccessObject;
+static svn_error_t *py_open_tmp_file(apr_file_t **fp, void *callback,
+ apr_pool_t *pool)
+{
+ RemoteAccessObject *self = (RemoteAccessObject *)callback;
+ abort(); /* FIXME */
+ return NULL;
+}
+
static PyObject *ra_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
char *kwnames[] = { "url", "progress_cb", "auth", "config", NULL };
@@ -463,6 +473,7 @@
svn_ra_callbacks2_t *callbacks2;
Py_ssize_t idx = 0;
PyObject *key, *value;
+ svn_auth_baton_t *auth_baton;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|OOO", kwnames, &url, &progress_cb, (PyObject **)&auth, &config))
return NULL;
@@ -472,14 +483,18 @@
return NULL;
if ((PyObject *)auth == Py_None) {
- auth = PyObject_New(AuthObject, &Auth_Type);
+ auth_baton = NULL;
+ ret->auth = (AuthObject *)Py_None;
} else {
/* FIXME: check auth is an instance of Auth_Type */
Py_INCREF(auth);
+ ret->auth = auth;
+ auth_baton = ret->auth->auth_baton;
}
- ret->auth = auth;
- ret->pool = Pool(NULL);
+ ret->pool = Pool();
+ if (ret->pool == NULL)
+ return NULL;
ret->url = apr_pstrdup(ret->pool, url);
if (!check_error(svn_ra_create_callbacks(&callbacks2, ret->pool))) {
apr_pool_destroy(ret->pool);
@@ -488,16 +503,22 @@
}
callbacks2->progress_func = py_progress_func;
- callbacks2->auth_baton = ret->auth->auth_baton;
+ callbacks2->auth_baton = auth_baton;
+ callbacks2->open_tmp_file = py_open_tmp_file;
ret->progress_func = progress_cb;
callbacks2->progress_baton = (void *)ret->progress_func;
config_hash = apr_hash_make(ret->pool);
- while (PyDict_Next(config, &idx, &key, &value)) {
- apr_hash_set(config_hash, PyString_AsString(key),
- PyString_Size(key), PyString_AsString(value));
+ if (PyDict_Check(config)) {
+ while (PyDict_Next(config, &idx, &key, &value)) {
+ apr_hash_set(config_hash, PyString_AsString(key),
+ PyString_Size(key), PyString_AsString(value));
+ }
+ } else if (config != Py_None) {
+ PyErr_SetString(PyExc_TypeError, "Expected dictionary for config");
+ return NULL;
}
if (!check_error(svn_ra_open2(&ret->ra, url,
- callbacks2, NULL, config_hash, ret->pool))) {
+ callbacks2, ret, config_hash, ret->pool))) {
apr_pool_destroy(ret->pool);
PyObject_Del(ret);
return NULL;
@@ -514,7 +535,9 @@
RemoteAccessObject *ra = (RemoteAccessObject *)self;
PyObject *ret;
apr_pool_t *temp_pool;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_ra_get_uuid(ra->ra, &uuid, temp_pool));
ret = PyString_FromString(uuid);
apr_pool_destroy(temp_pool);
@@ -531,7 +554,9 @@
if (!PyArg_ParseTuple(args, "s", &url))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_ra_reparent(ra->ra, url, temp_pool));
apr_pool_destroy(temp_pool);
return Py_None;
@@ -546,7 +571,9 @@
RemoteAccessObject *ra = (RemoteAccessObject *)self;
long latest_revnum;
apr_pool_t *temp_pool;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool,
svn_ra_get_latest_revnum(ra->ra, &latest_revnum, temp_pool));
apr_pool_destroy(temp_pool);
@@ -571,7 +598,9 @@
&revprops))
return NULL;
- temp_pool = Pool(NULL);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_ra_get_log(ra->ra,
string_list_to_apr_array(temp_pool, paths), start, end, limit,
discover_changed_paths, strict_node_history, py_svn_log_wrapper,
@@ -587,7 +616,9 @@
{
RemoteAccessObject *ra = (RemoteAccessObject *)self;
const char *root;
- apr_pool_t *temp_pool = Pool(ra->pool);
+ apr_pool_t *temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool,
svn_ra_get_repos_root(ra->ra, &root, temp_pool));
apr_pool_destroy(temp_pool);
@@ -609,7 +640,9 @@
if (!PyArg_ParseTuple(args, "lsbO", &revision_to_update_to, &update_target, &recurse, &update_editor))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_ra_do_update(ra->ra, &reporter,
&report_baton,
revision_to_update_to,
@@ -641,7 +674,9 @@
if (!PyArg_ParseTuple(args, "lsbsO", &revision_to_update_to, &update_target,
&recurse, &switch_url, &update_editor))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_ra_do_switch(
ra->ra, &reporter, &report_baton,
revision_to_update_to, update_target,
@@ -667,7 +702,9 @@
if (!PyArg_ParseTuple(args, "llO|b", &revision, &low_water_mark, &update_editor, &send_deltas))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool,
svn_ra_replay(ra->ra, revision, low_water_mark,
send_deltas, &py_editor, update_editor,
@@ -687,7 +724,9 @@
if (!PyArg_ParseTuple(args, "l", &rev))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool,
svn_ra_rev_proplist(ra->ra, rev, &props, temp_pool));
py_props = prop_hash_to_dict(props);
@@ -710,7 +749,9 @@
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|Ob", kwnames, &revprops, &commit_callback, &lock_tokens, &keep_locks))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
if (lock_tokens == Py_None) {
hash_lock_tokens = NULL;
} else {
@@ -742,7 +783,9 @@
if (!PyArg_ParseTuple(args, "lss#", &rev, &name, &value, &vallen))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
val_string = svn_string_ncreate(value, vallen, temp_pool);
RUN_SVN_WITH_POOL(temp_pool,
svn_ra_change_rev_prop(ra->ra, rev, name, val_string,
@@ -770,7 +813,9 @@
if (!PyArg_ParseTuple(args, "s|li", &path, &revision, &dirent_fields))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
if (!check_error(svn_ra_get_dir2(ra->ra, &dirents, &fetch_rev, &props,
path, revision, dirent_fields, temp_pool))) {
@@ -825,7 +870,9 @@
if (!PyArg_ParseTuple(args, "s", &path))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool,
svn_ra_get_lock(ra->ra, &lock, path, temp_pool));
apr_pool_destroy(temp_pool);
@@ -842,7 +889,9 @@
if (!PyArg_ParseTuple(args, "sl", &path, &revision))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool,
svn_ra_check_path(ra->ra, path, revision, &kind,
temp_pool));
@@ -852,6 +901,7 @@
static PyObject *has_capability(PyObject *self, PyObject *args)
{
+#if SVN_VER_MAJOR >= 1 && SVN_VER_MINOR >= 5
char *capability;
apr_pool_t *temp_pool;
RemoteAccessObject *ra = (RemoteAccessObject *)self;
@@ -860,16 +910,17 @@
if (!PyArg_ParseTuple(args, "s", &capability))
return NULL;
- temp_pool = Pool(ra->pool);
-#if SVN_VER_MAJOR >= 1 && SVN_VER_MINOR >= 5
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool,
svn_ra_has_capability(ra->ra, &has, capability, temp_pool));
+ apr_pool_destroy(temp_pool);
+ return PyBool_FromLong(has);
#else
PyErr_SetNone(PyExc_NotImplementedError);
return NULL;
#endif
- apr_pool_destroy(temp_pool);
- return PyBool_FromLong(has);
}
static PyObject *ra_unlock(PyObject *self, PyObject *args)
@@ -884,7 +935,9 @@
if (!PyArg_ParseTuple(args, "ObO", &path_tokens, &break_lock, &lock_func))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
hash_path_tokens = apr_hash_make(temp_pool);
while (PyDict_Next(path_tokens, &idx, &k, &v)) {
apr_hash_set(hash_path_tokens, PyString_AsString(k), PyString_Size(k), (char *)PyString_AsString(v));
@@ -915,7 +968,9 @@
&lock_func))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
if (path_revs == Py_None) {
hash_path_revs = NULL;
} else {
@@ -952,7 +1007,9 @@
if (!PyArg_ParseTuple(args, "s", &path))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
if (!check_error(svn_ra_get_locks(ra->ra, &hash_locks, path, temp_pool))) {
apr_pool_destroy(temp_pool);
return NULL;
@@ -986,7 +1043,9 @@
if (!PyArg_ParseTuple(args, "slO", &path, &peg_revision, &location_revisions))
return NULL;
- temp_pool = Pool(NULL);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
if (!check_error(svn_ra_get_locations(ra->ra, &hash_locations,
path, peg_revision,
revnum_list_to_apr_array(temp_pool, location_revisions),
@@ -1016,7 +1075,9 @@
if (!PyArg_ParseTuple(args, "sllO", &path, &start, &end, &file_rev_handler))
return NULL;
- temp_pool = Pool(ra->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
if (!check_error(svn_ra_get_file_revs(ra->ra, path, start, end,
py_file_rev_handler, (void *)file_rev_handler,
@@ -1112,7 +1173,9 @@
if (ret == NULL)
return NULL;
- ret->pool = Pool(NULL);
+ ret->pool = Pool();
+ if (ret->pool == NULL)
+ return NULL;
ret->providers = providers;
Py_INCREF(providers);
@@ -1190,7 +1253,9 @@
if (!PyArg_ParseTuple(args, "Oi", &prompt_func, &retry_limit))
return NULL;
auth = PyObject_New(AuthProviderObject, &AuthProvider_Type);
- auth->pool = Pool(NULL);
+ auth->pool = Pool();
+ if (auth->pool == NULL)
+ return NULL;
svn_auth_get_username_prompt_provider(&auth->provider, py_username_prompt, (void *)prompt_func, retry_limit, auth->pool);
return (PyObject *)auth;
}
@@ -1218,7 +1283,9 @@
return NULL;
auth = PyObject_New(AuthProviderObject, &AuthProvider_Type);
- auth->pool = Pool(NULL);
+ auth->pool = Pool();
+ if (auth->pool == NULL)
+ return NULL;
svn_auth_get_simple_prompt_provider (&auth->provider, py_simple_prompt, (void *)prompt_func, retry_limit, auth->pool);
return (PyObject *)auth;
}
@@ -1255,7 +1322,9 @@
auth = PyObject_New(AuthProviderObject, &AuthProvider_Type);
if (auth == NULL)
return NULL;
- auth->pool = Pool(NULL);
+ auth->pool = Pool();
+ if (auth->pool == NULL)
+ return NULL;
svn_auth_get_ssl_server_trust_prompt_provider (&auth->provider, py_ssl_server_trust_prompt, (void *)prompt_func, auth->pool);
return (PyObject *)auth;
}
@@ -1284,7 +1353,9 @@
auth = PyObject_New(AuthProviderObject, &AuthProvider_Type);
if (auth == NULL)
return NULL;
- auth->pool = Pool(NULL);
+ auth->pool = Pool();
+ if (auth->pool == NULL)
+ return NULL;
svn_auth_get_ssl_client_cert_pw_prompt_provider (&auth->provider, py_ssl_client_cert_pw_prompt, (void *)prompt_func, retry_limit, auth->pool);
return (PyObject *)auth;
}
@@ -1295,7 +1366,9 @@
auth = PyObject_New(AuthProviderObject, &AuthProvider_Type);
if (auth == NULL)
return NULL;
- auth->pool = Pool(NULL);
+ auth->pool = Pool();
+ if (auth->pool == NULL)
+ return NULL;
svn_auth_get_username_provider(&auth->provider, auth->pool);
return (PyObject *)auth;
}
@@ -1304,7 +1377,9 @@
{
AuthProviderObject *auth = PyObject_New(AuthProviderObject,
&AuthProvider_Type);
- auth->pool = Pool(NULL);
+ auth->pool = Pool();
+ if (auth->pool == NULL)
+ return NULL;
svn_auth_get_simple_provider(&auth->provider, auth->pool);
return (PyObject *)auth;
}
@@ -1312,7 +1387,9 @@
static PyObject *get_ssl_server_trust_file_provider(PyObject *self)
{
AuthProviderObject *auth = PyObject_New(AuthProviderObject, &AuthProvider_Type);
- auth->pool = Pool(NULL);
+ auth->pool = Pool();
+ if (auth->pool == NULL)
+ return NULL;
svn_auth_get_ssl_server_trust_file_provider(&auth->provider, auth->pool);
return (PyObject *)auth;
}
@@ -1320,7 +1397,9 @@
static PyObject *get_ssl_client_cert_file_provider(PyObject *self)
{
AuthProviderObject *auth = PyObject_New(AuthProviderObject, &AuthProvider_Type);
- auth->pool = Pool(NULL);
+ auth->pool = Pool();
+ if (auth->pool == NULL)
+ return NULL;
svn_auth_get_ssl_client_cert_file_provider(&auth->provider, auth->pool);
return (PyObject *)auth;
}
@@ -1328,7 +1407,9 @@
static PyObject *get_ssl_client_cert_pw_file_provider(PyObject *self)
{
AuthProviderObject *auth = PyObject_New(AuthProviderObject, &AuthProvider_Type);
- auth->pool = Pool(NULL);
+ auth->pool = Pool();
+ if (auth->pool == NULL)
+ return NULL;
svn_auth_get_ssl_client_cert_pw_file_provider(&auth->provider, auth->pool);
return (PyObject *)auth;
}
@@ -1336,13 +1417,18 @@
static PyObject *txdelta_send_stream(PyObject *self, PyObject *args)
{
unsigned char digest[16];
- apr_pool_t *pool = Pool(NULL);
+ apr_pool_t *pool;
PyObject *stream;
TxDeltaWindowHandlerObject *py_txdelta;
if (!PyArg_ParseTuple(args, "OO", &stream, &py_txdelta))
return NULL;
+ pool = Pool();
+
+ if (pool == NULL)
+ return NULL;
+
if (!check_error(svn_txdelta_send_stream(new_py_stream(pool, stream), py_txdelta->txdelta_handler, py_txdelta->txdelta_baton, (unsigned char *)digest, pool))) {
apr_pool_destroy(pool);
return NULL;
@@ -1396,7 +1482,9 @@
return;
apr_initialize();
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return;
svn_ra_initialize(pool);
mod = Py_InitModule3("ra", ra_module_methods, "Remote Access");
=== modified file 'repos.c'
--- a/repos.c 2008-06-02 23:12:41 +0000
+++ b/repos.c 2008-06-03 00:00:50 +0000
@@ -45,7 +45,9 @@
if (!PyArg_ParseTuple(args, "s|OO", &path, &config, &fs_config))
return NULL;
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return NULL;
hash_config = NULL; /* FIXME */
hash_fs_config = NULL; /* FIXME */
RUN_SVN_WITH_POOL(pool, svn_repos_create(&repos, path, "", "",
@@ -81,7 +83,9 @@
if (ret == NULL)
return NULL;
- ret->pool = Pool(NULL);
+ ret->pool = Pool();
+ if (ret->pool == NULL)
+ return NULL;
if (!check_error(svn_repos_open(&ret->repos, path, ret->pool))) {
apr_pool_destroy(ret->pool);
PyObject_Del(ret);
@@ -125,7 +129,9 @@
PyObject *ret;
apr_pool_t *temp_pool;
- temp_pool = Pool(fsobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_fs_get_uuid(fsobj->fs, &uuid, temp_pool));
ret = PyString_FromString(uuid);
apr_pool_destroy(temp_pool);
@@ -173,7 +179,9 @@
&cancel_func))
return NULL;
- temp_pool = Pool(reposobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_repos_load_fs2(reposobj->repos,
new_py_stream(temp_pool, dumpstream),
new_py_stream(temp_pool, feedback_stream),
@@ -215,7 +223,9 @@
return;
apr_initialize();
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return;
svn_fs_initialize(pool);
mod = Py_InitModule3("repos", repos_module_methods, "Local repository management");
=== modified file 'tests/test_ra.py'
--- a/tests/test_ra.py 2008-03-13 15:50:52 +0000
+++ b/tests/test_ra.py 2008-06-03 00:00:50 +0000
@@ -29,6 +29,10 @@
self.repos_url = self.make_client("d", "dc")
self.ra = ra.RemoteAccess(self.repos_url)
+ def test_repr(self):
+ self.assertEquals("RemoteAccess(%s)" % self.repos_url,
+ repr(self.ra))
+
def test_latest_revnum(self):
self.assertEquals(0, self.ra.get_latest_revnum())
@@ -36,7 +40,7 @@
self.assertIsInstance(self.ra.get_uuid(), str)
def test_get_repos_root(self):
- self.assertEqual(self.repos_root, self.ra.get_repos_root())
+ self.assertEqual(self.repos_url, self.ra.get_repos_root())
def test_reparent(self):
self.ra.reparent(self.repos_url)
=== modified file 'transport.py'
--- a/transport.py 2008-06-02 20:15:47 +0000
+++ b/transport.py 2008-06-03 00:00:50 +0000
@@ -180,14 +180,6 @@
def get_lock(self, path):
return self._ra.get_lock(path)
- class SvnLock(object):
- def __init__(self, transport, tokens):
- self._tokens = tokens
- self._transport = transport
-
- def unlock(self):
- self.transport.unlock(self.locks)
-
@convert_svn_error
def unlock(self, locks, break_lock=False):
def lock_cb(baton, path, do_lock, lock, ra_err):
=== modified file 'util.c'
--- a/util.c 2008-06-02 23:12:20 +0000
+++ b/util.c 2008-06-03 00:00:50 +0000
@@ -30,13 +30,13 @@
(50 * SVN_ERR_CATEGORY_SIZE))
-apr_pool_t *Pool(apr_pool_t *parent)
+apr_pool_t *Pool()
{
apr_status_t status;
apr_pool_t *ret;
char errmsg[1024];
ret = NULL;
- status = apr_pool_create(&ret, parent);
+ status = apr_pool_create(&ret, NULL);
if (status != 0) {
PyErr_SetString(PyExc_Exception,
apr_strerror(status, errmsg, sizeof(errmsg)));
@@ -98,7 +98,9 @@
if (props == NULL) {
return Py_None;
}
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return NULL;
py_props = PyDict_New();
for (idx = apr_hash_first(pool, props); idx != NULL;
idx = apr_hash_next(idx)) {
=== modified file 'util.h'
--- a/util.h 2008-06-02 23:12:20 +0000
+++ b/util.h 2008-06-03 00:00:50 +0000
@@ -20,7 +20,7 @@
#ifndef _BZR_SVN_UTIL_H_
#define _BZR_SVN_UTIL_H_
-apr_pool_t *Pool(apr_pool_t *parent);
+__attribute__((warn_unused_result)) apr_pool_t *Pool(void);
__attribute__((warn_unused_result)) bool check_error(svn_error_t *error);
apr_array_header_t *string_list_to_apr_array(apr_pool_t *pool, PyObject *l);
PyObject *prop_hash_to_dict(apr_hash_t *props);
=== modified file 'wc.c'
--- a/wc.c 2008-06-02 21:12:51 +0000
+++ b/wc.c 2008-06-03 00:00:50 +0000
@@ -148,7 +148,9 @@
if (ret == NULL)
return NULL;
- ret->pool = Pool(NULL);
+ ret->pool = Pool();
+ if (ret->pool == NULL)
+ return NULL;
ret->entry = svn_wc_entry_dup(entry, ret->pool);
return (PyObject *)ret;
}
@@ -176,7 +178,9 @@
if (ret == NULL)
return NULL;
- ret->pool = Pool(NULL);
+ ret->pool = Pool();
+ if (ret->pool == NULL)
+ return NULL;
if (associated == Py_None) {
parent_wc = NULL;
} else {
@@ -213,7 +217,9 @@
if (!PyArg_ParseTuple(args, "ss", &name, &path))
return NULL;
- temp_pool = Pool(admobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_wc_prop_get(&value, name, path, admobj->adm, temp_pool));
if (value == NULL) {
ret = Py_None;
@@ -236,7 +242,9 @@
if (!PyArg_ParseTuple(args, "ss#s|b", &name, &value, &vallen, &path, &skip_checks))
return NULL;
- temp_pool = Pool(admobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
cvalue = svn_string_ncreate(value, vallen, temp_pool);
RUN_SVN_WITH_POOL(temp_pool, svn_wc_prop_set2(name, cvalue, path, admobj->adm,
skip_checks, temp_pool));
@@ -260,7 +268,9 @@
if (!PyArg_ParseTuple(args, "|b", &show_hidden))
return NULL;
- temp_pool = Pool(admobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_wc_entries_read(&entries, admobj->adm,
show_hidden, temp_pool));
py_entries = PyDict_New();
@@ -286,7 +296,9 @@
if (!PyArg_ParseTuple(args, "sO|bO", &path, &callbacks, &show_hidden, &cancel_func))
return NULL;
- temp_pool = Pool(admobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_wc_walk_entries2(path, admobj->adm,
&py_wc_entry_callbacks, (void *)callbacks,
show_hidden, py_cancel_func, (void *)cancel_func,
@@ -307,7 +319,9 @@
if (!PyArg_ParseTuple(args, "s|b", &path, &show_hidden))
return NULL;
- temp_pool = Pool(admobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_wc_entry(&entry, path, admobj->adm, show_hidden, temp_pool));
apr_pool_destroy(temp_pool);
@@ -332,7 +346,9 @@
if (!PyArg_ParseTuple(args, "s", &path))
return NULL;
- temp_pool = Pool(admobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_wc_get_prop_diffs(&propchanges, &original_props,
path, admobj->adm, temp_pool));
py_propchanges = PyList_New(propchanges->nelts);
@@ -360,7 +376,9 @@
AdmObject *admobj = (AdmObject *)self;
apr_pool_t *temp_pool;
- temp_pool = Pool(admobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
if (!PyArg_ParseTuple(args, "s|zlOO", &path, ©from_url, ©from_rev, &cancel_func, ¬ify_func))
return NULL;
@@ -386,7 +404,9 @@
if (!PyArg_ParseTuple(args, "ss|OO", &src, &dst, &cancel_func, ¬ify_func))
return NULL;
- temp_pool = Pool(admobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_wc_copy2(src, admobj->adm, dst,
py_cancel_func, (void *)cancel_func,
py_wc_notify_func, (void *)notify_func,
@@ -406,7 +426,9 @@
if (!PyArg_ParseTuple(args, "s|OO", &path, &cancel_func, ¬ify_func))
return NULL;
- temp_pool = Pool(admobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_wc_delete2(path, admobj->adm,
py_cancel_func, (void *)cancel_func,
py_wc_notify_func, (void *)notify_func,
@@ -430,7 +452,9 @@
¬ify_func))
return NULL;
- temp_pool = Pool(admobj->pool);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
traversal_info = svn_wc_init_traversal_info(temp_pool);
RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions2(path, admobj->adm,
&py_ra_reporter, (void *)reporter,
@@ -457,7 +481,9 @@
if (!PyArg_ParseTuple(args, "s|bbOOz", &target, &use_commit_times, &recurse, ¬ify_func, &cancel_func, &diff3_cmd))
return NULL;
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return NULL;
latest_revnum = (svn_revnum_t *)apr_palloc(pool, sizeof(svn_revnum_t));
if (!check_error(svn_wc_get_update_editor2(latest_revnum, admobj->adm, target,
use_commit_times, recurse, py_wc_notify_func, (void *)notify_func,
@@ -531,7 +557,9 @@
&cancel_func))
return NULL;
- temp_pool = Pool(NULL);
+ temp_pool = Pool();
+ if (temp_pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(temp_pool, svn_wc_revision_status(&revstatus, wc_path, trail_url,
committed, py_cancel_func, cancel_func, temp_pool));
ret = Py_BuildValue("(llbb)", revstatus->min_rev, revstatus->max_rev,
@@ -575,7 +603,9 @@
apr_pool_t *pool;
PyObject *ret;
const char *dir;
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return NULL;
dir = svn_wc_get_adm_dir(pool);
ret = PyString_FromString(dir);
apr_pool_destroy(pool);
@@ -592,7 +622,9 @@
if (!PyArg_ParseTuple(args, "s", &path))
return NULL;
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(pool, svn_wc_get_pristine_copy_path(path, &pristine_path, pool));
ret = PyString_FromString(pristine_path);
apr_pool_destroy(pool);
@@ -613,7 +645,9 @@
if (!PyArg_ParseTuple(args, "O", &config))
return NULL;
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return NULL;
hash_config = apr_hash_make(pool);
while (PyDict_Next(config, &idx, &pyk, &pyv))
apr_hash_set(hash_config, (char *)PyString_AsString(pyk), PyString_Size(pyk), (char *)PyString_AsString(pyv));
@@ -641,7 +675,9 @@
&path, &uuid, &url, &repos, &rev))
return NULL;
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(pool,
svn_wc_ensure_adm2(path, uuid, url, repos, rev, pool));
apr_pool_destroy(pool);
@@ -657,7 +693,9 @@
if (!PyArg_ParseTuple(args, "s", &path))
return NULL;
- pool = Pool(NULL);
+ pool = Pool();
+ if (pool == NULL)
+ return NULL;
RUN_SVN_WITH_POOL(pool, svn_wc_check_wc(path, &wc_format, pool));
apr_pool_destroy(pool);
return PyLong_FromLong(wc_format);
More information about the bazaar-commits
mailing list