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

How do I call svn_client_list2 C API function from python via SVN API SWIG bindings?

From: Tarmo Aidantausta <bleadof_at_gmail.com>
Date: Wed, 19 Aug 2009 15:23:29 +0300

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()' 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?

This question is on StackOverflow as well:
http://stackoverflow.com/questions/1298869/how-can-i-call-the-svn-client-svnclientlist2-with-python-svn-api-swig-bindings

-- 
 //
 Tarmo Aidantausta
 bleadof_at_gmail.com
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2385205
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-08-19 14:30:45 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.