On 6/15/06, Madan U Sreenivasan <email@example.com> wrote:
> > pool=NULL is not a valid argument to create_svn_repos_t or
> > svn_repos_create.
> Is it? svn.repos.create() complains that it needs 5 parameters as input,
> when I give less than that. I cant figure out which five... Also, there is
> no apr_pool_create() function in svn.core (pool related functions are
> documented as deprecated)... so how do we create a pool to be passed to
The signature for svn.repos.create in the Python bindings is:
new_repos = svn.repos.create(path, unused_1, unused_2, config, fs_config, pool)
In the Python bindings, the pool argument is optional. If you do not
specify it, a temporary pool will be generated for you automatically.
To generate a new pool, use the svn.core.Pool() function. Pools are
only needed in the Python bindings if you want to have fine-grained
control over how Python manages memory, which you usually do not need.
On the other hand, in C, the 'Pool' argument is not optional, and must
be specified. If you supply 'NULL' as the pool value, you will likely
provoke a segfault.
In general, the differences between the regular Subversion library and
the Python bindings are not very well documented, so you will often be
left guessing while you are using the bindings. Still, guessing isn't
that bad -- you can often guess how a function works by looking at its
header and figuring out what its 'input' and 'output' parameters are.
Here's a conversion rule. In C, you might see:
svn_error_t * svn_lib_function(svn_foo_t **output1, svn_foo_t
*input1, svn_foo_t *input2, svn_foo_t **output2, apr_pool_t *pool)
In Python, this converts to:
output1, output2 = svn.lib.function(input1, input2, pool)
... where the "pool" argument is optional, and should probably be left
out in typical usage.
Note that output arguments in C tend to be doubly indirect pointers
(i.e. two asteriks).
For examples of scripts which use the Python bindings, see the tools
and contrib directories. If you're looking to write new test scripts,
I'd recommend looking at those scripts first, and checking what
functionality is exercised by those scripts (in tools and contrib)
that is not yet exercised by our test suite.
David James -- http://www.cs.toronto.edu/~james
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com
Received on Fri Jun 16 07:48:04 2006