[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: ctypes-python-bindings - list files in working copy issue

From: Konstantin Kolinko <knst.kolinko_at_gmail.com>
Date: Sun, 11 Mar 2012 02:45:03 +0400

2012/3/9 Martin Zibricky <mzibr.public_at_gmail.com>:
> Hi all,
>
> I'm trying to use csvn (ctypes based python bindings).
>
> I have a simple code example.
>
> But when trying to run this code I get the following error.
> I thested csvn with svn 1.6.17 and 1.7.3. The issue is still the same.
>
> Could anyone please confirm this issue?
> ---
>
> $ python list_working_copy.py
> AAAAAAAAAA
> Traceback (most recent call last):
>  File "_ctypes/callbacks.c", line 295, in 'calling callback function'
> TypeError: _list_wrapper() takes exactly 6 arguments (7 given)
> Segmentation fault
>
> ---
>
> # file: list_working_copy.py
> import csvn.core
> from csvn.wc import WC
>
> csvn.core.svn_cmdline_init("", csvn.core.stderr)
> working_copy = WC('path_to_wc')
> print 'A' * 10
> working_copy.list()
> print 'B' * 10
> working_copy.close()
>

I have not tested it, but just looking at the sources:

1. The callback used by WC.list() is actually the _list_wrapper
function in wc.py [1].

[1] http://svn.apache.org/repos/asf/subversion/trunk/subversion/bindings/ctypes-python/csvn/wc.py

_list_wrapper() in [1] is declared as
[[[
def _list_wrapper(self, baton, path, dirent, abs_path, pool):
]]]

It is prepared for use in __init__ in [1] as

[[[
self._list_func = \
            svn_client_list_func_t(self._list_wrapper)
]]]

But that does not match svn_client_list_func_t definition elsewhere
[2] http://subversion.apache.org/docs/api/1.6/group__List.html
[3] http://subversion.apache.org/docs/api/1.7/group__List.html

In [3]:

[[[
typedef svn_error_t *(* svn_client_list_func_t )(void *baton, const
char *path, const svn_dirent_t *dirent, const svn_lock_t *lock, const
char *abs_path, apr_pool_t *pool)
]]]

So the problem: the "const svn_lock_t *lock" argument is missing in
_list_wrapper method in Python.

2. The listing itself is performed by the following call in list() in wc.py [1]:

[[[
svn_client_list(self._build_path(path), byref(peg), byref(rev),
            recurse, SVN_DIRENT_ALL, fetch_locks, self._list_func,
            c_void_p(), self.client, self.iterpool)
]]]

There exists newer method, "svn_client_list2" since 1.5.

3. Regarding OP's example:

Is there a point of calling list() without passing a callback function into it?

The _list_wrapper() does nothing if your callback ("self._list") is
not initialized.

Best regards,
Konstantin Kolinko
Received on 2012-03-10 23:45:38 CET

This is an archived mail posted to the Subversion Dev mailing list.