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

Re: Of SWIG Python bindings and batons provided via void** arguments

From: David James <james_at_cs.toronto.edu>
Date: 2007-02-22 16:44:28 CET

On 2/21/07, Charles Duffy <cduffy@spamcop.net> wrote:
> Howdy, all.
> I'm looking to use svn_ra_do_diff2() from the SWIG bindings, but I don't
> see how to do it: Even in trunk, this method's docstring indicates that
> it is just a direct passthrough to the C method:

These docstrings are autogenerated by SWIG, and can be quite
misleading. If we can't find a way to fix them, we might end up
turning them off because they tend to be confusing. You're better off
looking at the original documentation from
http://svn.collab.net/repos/svn/trunk/subversion/include/, following
the guidelines at

> {{{
> def svn_ra_do_diff2(*args):
> """
> svn_ra_do_diff2(svn_ra_session_t session, svn_ra_reporter2_t reporter,
> void report_baton, svn_revnum_t revision,
> char diff_target, svn_boolean_t recurse, svn_boolean_t
> ignore_ancestry,
> svn_boolean_t text_deltas,
> char versus_url, svn_delta_editor_t diff_editor,
> void diff_baton, apr_pool_t pool) -> svn_error_t
> """
> return apply(_ra.svn_ra_do_diff2, args)
> }}}
> At issue here is the report_baton: What Python object can I pass in this
> spot (and then later use as a parameter to reporter->foo() methods)?
> There is no native type corresponding to a void*, at least that I'm
> aware of.

Actually, you don't need to pass in a report baton at all -- contrary
to this misleading docstring, the "reporter" and "reporter_baton" are
actually returned to you from the method.

Here's an example:
   e_ptr, e_baton = delta.make_editor(editor)

   reporter, reporter_baton = ra.do_diff2(self.ra_ctx, fs_revnum,
REPOS_URL + "/trunk/README.txt", 0, 0, 1, REPOS_URL +
"/trunk/README.txt", e_ptr, e_baton)

  reporter.set_path(reporter_baton, "", fs_revnum, True, None)


For a more complete example, see the test_do_diff2 test, which I just
added to http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/python/tests/ra.py



To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Feb 22 16:44:44 2007

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