From: Jelmer Vernooij Date: Fri, 11 Aug 2017 01:42:04 +0000 (+0000) Subject: Fix support for copyfrom_url in add(). X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=ec5a1cf9570a7938748d90387e98e8998c4ead11;p=jelmer%2Fsubvertpy.git Fix support for copyfrom_url in add(). --- diff --git a/subvertpy/wc_adm.c b/subvertpy/wc_adm.c index 02c70d86..023c23a0 100644 --- a/subvertpy/wc_adm.c +++ b/subvertpy/wc_adm.c @@ -431,16 +431,17 @@ static PyObject *adm_get_prop_diffs(PyObject *self, PyObject *args) static PyObject *adm_add(PyObject *self, PyObject *args, PyObject *kwargs) { const char *path; - char *copyfrom_url=NULL; + const char *copyfrom_url = NULL; svn_revnum_t copyfrom_rev=-1; char *kwnames[] = { "path", "copyfrom_url", "copyfrom_rev", "notify_func", "depth", NULL }; PyObject *notify_func=Py_None, *py_path; AdmObject *admobj = (AdmObject *)self; apr_pool_t *temp_pool; svn_depth_t depth = svn_depth_infinity; + PyObject *py_copyfrom_url = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|zlOi", kwnames, &py_path, - ©from_url, ©from_rev, ¬ify_func, &depth)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OlOi", kwnames, &py_path, + &py_copyfrom_url, ©from_rev, ¬ify_func, &depth)) return NULL; ADM_CHECK_CLOSED(admobj); @@ -456,10 +457,20 @@ static PyObject *adm_add(PyObject *self, PyObject *args, PyObject *kwargs) return NULL; } + if (py_copyfrom_url != Py_None) { + copyfrom_url = py_object_to_svn_uri(py_copyfrom_url, temp_pool); + if (copyfrom_url == NULL) { + apr_pool_destroy(temp_pool); + return NULL; + } + } else { + copyfrom_url = NULL; + } + #if ONLY_SINCE_SVN(1, 6) RUN_SVN_WITH_POOL(temp_pool, svn_wc_add3( path, admobj->adm, - depth, svn_uri_canonicalize(copyfrom_url, temp_pool), + depth, copyfrom_url, copyfrom_rev, py_cancel_check, NULL, py_wc_notify_func, (void *)notify_func,