diff options
author | Jelmer Vernooij <jelmer@jelmer.uk> | 2016-07-24 19:27:55 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@jelmer.uk> | 2016-07-24 19:27:55 +0000 |
commit | 041588068ae3719d2ac572ea5774ff19a20720b7 (patch) | |
tree | a80d657bea69123f6f8312d69663b3cffed1e4c8 /subvertpy | |
parent | f1f0f5178adfa203b09083bbdfa8ad71fccd071b (diff) |
svn_dirent_canonicalize doesn't actually appear to exist in 1.6.
Diffstat (limited to 'subvertpy')
-rw-r--r-- | subvertpy/_ra.c | 4 | ||||
-rw-r--r-- | subvertpy/repos.c | 13 | ||||
-rw-r--r-- | subvertpy/util.c | 22 | ||||
-rw-r--r-- | subvertpy/util.h | 10 |
4 files changed, 18 insertions, 31 deletions
diff --git a/subvertpy/_ra.c b/subvertpy/_ra.c index 061d5973..7d0bb0f0 100644 --- a/subvertpy/_ra.c +++ b/subvertpy/_ra.c @@ -503,7 +503,11 @@ static svn_error_t *py_open_tmp_file(apr_file_t **fp, void *callback, const char *path; SVN_ERR (svn_io_temp_dir (&path, pool)); +#if ONLY_SINCE_SVN(1, 7) path = svn_dirent_join (path, "subvertpy", pool); +#else + path = svn_path_join (path, "subvertpy", pool); +#endif #if ONLY_SINCE_SVN(1, 6) SVN_ERR (svn_io_open_unique_file3(fp, NULL, path, svn_io_file_del_on_pool_cleanup, pool, pool)); #else diff --git a/subvertpy/repos.c b/subvertpy/repos.c index 2ba97b6e..e54cbfbf 100644 --- a/subvertpy/repos.c +++ b/subvertpy/repos.c @@ -98,8 +98,9 @@ static PyObject *repos_init(PyTypeObject *type, PyObject *args, PyObject *kwargs char *kwnames[] = { "path", NULL }; svn_error_t *err; RepositoryObject *ret; + PyObject *py_path; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", kwnames, &path)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwnames, &py_path)) return NULL; ret = PyObject_New(RepositoryObject, &Repository_Type); @@ -111,9 +112,15 @@ static PyObject *repos_init(PyTypeObject *type, PyObject *args, PyObject *kwargs PyObject_DEL(ret); return NULL; } + + path = py_object_to_svn_dirent(py_path, ret->pool); + if (path == NULL) { + Py_DECREF(ret); + return NULL; + } + Py_BEGIN_ALLOW_THREADS - err = svn_repos_open(&ret->repos, svn_dirent_canonicalize(path, ret->pool), - ret->pool); + err = svn_repos_open(&ret->repos, path, ret->pool); Py_END_ALLOW_THREADS if (err != NULL) { diff --git a/subvertpy/util.c b/subvertpy/util.c index 122a0999..4e9a1ea4 100644 --- a/subvertpy/util.c +++ b/subvertpy/util.c @@ -59,24 +59,6 @@ svn_relpath_canonicalize(const char *relpath, #endif -#if ONLY_BEFORE_SVN(1, 6) -const char * -svn_dirent_canonicalize(const char *dirent, - apr_pool_t *result_pool) -{ - return svn_path_canonicalize(dirent, result_pool); -} - -char * -svn_dirent_join(const char *base, - const char *component, - apr_pool_t *result_pool) -{ - return svn_path_join(base, component, result_pool); -} - -#endif - const char *py_object_to_svn_dirent(PyObject *obj, apr_pool_t *pool) { const char *ret; @@ -90,7 +72,11 @@ const char *py_object_to_svn_dirent(PyObject *obj, apr_pool_t *pool) } if (PyBytes_Check(obj)) { +#if ONLY_SINCE_SVN(1, 7) ret = svn_dirent_canonicalize(PyBytes_AsString(obj), pool); +#else + ret = svn_path_canonicalize(PyBytes_AsString(obj), pool); +#endif Py_XDECREF(bytes_obj); return ret; } else { diff --git a/subvertpy/util.h b/subvertpy/util.h index ce75350a..cf4a42f0 100644 --- a/subvertpy/util.h +++ b/subvertpy/util.h @@ -137,16 +137,6 @@ typedef struct { extern PyTypeObject Stream_Type; -#if ONLY_BEFORE_SVN(1, 6) -const char * -svn_dirent_canonicalize(const char *dirent, - apr_pool_t *result_pool); -char * -svn_dirent_join(const char *base, - const char *component, - apr_pool_t *result_pool); -#endif - #if ONLY_BEFORE_SVN(1, 7) const char * svn_uri_canonicalize(const char *uri, |