Daniel Eggert <eggert_at_macvaerk.dtu.dk> писал в своём письме Wed, 20 Jan
2010 19:54:40 +0300:
>>> 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:
>> 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
> Thanks. This is very helpful.
> Some of those crash for me, too:
>>>> root = svn.ra.get_repos_root(session)
> Assertion failed: (is_canonical(path, strlen(path))), function
> svn_path_is_empty, file
> line 414.
> It turns out that this was caused by my repository URL having a trailing
> "/". Not very elegant for the entire thing to simply crash, and not very
> easy to figure out what was causing this.
> It would be great if this would be handled more gracefully.
> I'm currently using version 1.6.5 (r38866).
This is a constraint of the C API. When you pass paths and URIs to
Subversion functions, they must be in the canonical internal form. Unless
the URI you use is an output of another Subversion function, you must use
core.svn_path_internal_style to prepare it.
Received on 2010-01-20 20:23:49 CET