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

Help with Python SWIG bindings and callbacks

From: Lawrence Stewart <lstewart_at_room52.net>
Date: Sun, 24 Aug 2008 15:30:39 +1000

Hi all,

I'm playing with the Python SWIG bindings for SVN 1.5.1 and have run
into a brick wall. I want to update a working copy from a python script,
and have a python function callback executed for each item updated. The
python code below hopefully illustrates what I'm trying to do.

def update_callback(notify, pool):
        print "in callback"

def update(wc, rev):
        ctx = svn.client.svn_client_create_context()
        ctx.notify_func2 = update_callback
        r = svn.core.svn_opt_revision_t()
        r.kind = svn.core.svn_opt_revision_head
        result_rev = svn.client.svn_client_update(wc, r, True, ctx)
        print "result_rev: %d" % result_rev

The update function does work and my working copy does get updated the
HEAD, but my callback is never executed.

I'm basing this code on the statement in
http://svn.collab.net/svn-doxygen/group__Update.html that says if
ctx->notify_func2 is not NULL it will be called for each item updated.
This of course may not work or be applicable in Python land... someone
please tell me if this is the case.

I've tried countless variations of the above code and changing
parameters to the callback, changing the way the callback is assigned to
the context object (I tried following the way it was done in the
client.py unit test file for a different callback type that is used)
etc. etc. without success.

I suspect my problem is that I just don't grok the translation that SWIG
is doing from the C API up into Python and therein lies the problem.

Any help in understanding what I'm doing wrong or how I can achieve
something equivalent would be greatly appreciated.


To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-08-24 07:30:55 CEST

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

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