The question
How do I call svn_client_list2
C API function from python via SVN API SWIG bindings?
Problem description
I can find that function from the svn.client
module, but calling it is the problem, because the callback function it uses is a typedef svn_client_list_func_t
and I don't know how to use that typedef in python.
Although I can find a class for it from svn.client.svn_client_list_func_t
along with svn.client.svn_client_list_func_tPtr
, but I can't find an example of how to use it.
Incorrect usage of svn.client.svn_client_list2
If you call the svn.client.svn_client_list2
function with a normal python function as callback parameter it gives you an error.
import svn.core, svn.client
path = svn.core.svn_path_canonicalize("/path/to/a/working_copy/")
pool = svn.core.Pool()
ctx = svn.client.svn_client_create_context(pool)
revision = svn.core.svn_opt_revision_t()
SVN_DIRENT_ALL = 0xffffffffl
def _handle_list(path, dirent, abs_path, pool):
print(path, dirent, abs_path, pool)
svn.client.svn_client_list2(path,
revision,
revision,
svn.core.svn_depth_infinity,
SVN_DIRENT_ALL,
True,
_handle_list,
ctx,
pool)
TypeError: argument number 7: a 'svn_client_list_func_t *' is expected, 'function(<function _handle_list at 0x01365270>)' is received
Incorrect usage of svn.client.svn_client_list_func_t
Trying to initialize the svn.client.svn_client_list_func_t
will result to an exception.
callback_function = svn.client.svn_client_list_func_t()
RuntimeError: No constructor defined
Ideas how I can proceed?
svn_client_list2
, are you?