[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: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2007-02-22 15:30:01 CET

Charles Duffy 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:
>
> {{{
> 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.

It's possible (likely, even) that we've not yet done the hand-coding magic
required to help SWIG do something sane with that reporter/report_baton
pair. (In other words, it ain't gonna work.)

> I'm interested only in copies, deletes and property changes -- not text
> diffs -- so the client.* bindings (and higher-level tools provided by
> pysvn) don't appear to be useful to me. I have code which does what I
> want using an editor driven by repos.dir_delta() [patterned off the
> useful example provided in svnlook.py]; my intent here is to add support
> for working against a remote URL, but it's appearing so far to be
> significantly more difficult than I've bargained for.

In a pinch, you could always write your program in C. Or, compromise --
hand-code a Python module (in C) which does the nasty reporter/baton stuff,
and call it from a Python script which handles all the not-so-nasty stuff.

Less performant (and far more complex) would be to have your script use the
svn_ra_get_logs() interface (which I know for sure works in Python) across
the range of revisions, tracking what changed in each and how they changed.

-- 
C. Michael Pilato <cmpilato@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on Thu Feb 22 15:30:25 2007

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.