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

Re: Python & RA

From: Роман Донченко <DXDragon_at_yandex.ru>
Date: Tue, 19 Jan 2010 21:19:36 +0300

(Sigh; resending to the list, as was initially intended.)

Daniel Eggert <eggert_at_macvaerk.dtu.dk> писал в своём письме Tue, 19 Jan
2010 20:12:50 +0300:

> On Jan 19, 2010, at 7:25 , Роман Донченко wrote:
>
>>> On Mon, 2010-01-18 at 20:12 -0600, Daniel Eggert wrote:
>> The config argument isn't passed to the C API correctly ATM... you can
>> use a NULL config if that's enough for your needs:
>>
>> svn.ra.open2("http://svn.example.com/svn", c, None)
>>
>> Roman (who didn't get the original mail because of the Gmane mishap).
>
> Thanks. That works. Should I file a bug about that not working?

Eh, probably not. I've entered it into my todo list and will probably get
around to it soon.

> I got svn.ra.open2() and svn.ra.get_dir() working, but I'm unable to
> make the receiver/baton part of
> l = svn.ra.get_log2(session, None, 1, 4, 0, False, False, [], receiver,
> None)
> work. The receiver is supposed to be a svn_log_entry_receiver_t. I tried
> to do
> def receiver(baton, entry):
> print entry
> but I get
> TypeError: argument number 8:

The immediate cause of this is that you forgot the
include_merged_revisions argument. 8=] But were you to include it, your
code would still be wrong, because...

> How does swig wrap svn_log_entry_receiver_t?

A callable Python object (which can be a function, or a class instance)
that you pass becomes both the C function and the C baton. Thus, your call
should look like:

svn.ra.get_log2(
       session, # session
       None, # paths
       1, # start
       4, # end
       0, # limit
       False, # discover_changed_paths
       False, # strict_node_history
       False, # include_merged_revisions
       [], # revprops
       receiver # receiver & receiver_baton
               # pool (is omitted)
)

And the receiver should look like:

def receiver(entry, pool):
         print entry

> I have not been able to find any python sample code that uses svn.ra.

Look at the bindings' testsuite at
<http://svn.apache.org/repos/asf/subversion/trunk/subversion/bindings/swig/python/tests/ra.py>.

Roman.
Received on 2010-01-19 19:20:44 CET

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.