On Tue, 19 Apr 2005, Alan Knowles wrote:
> I just thought I'd have a quick go at doing the php bindings for
> libsvn_client, I'm baseing it on 1.1.4 and got a simple build enviroment
> going ok. but running into trouble understanding all the pre-requisites
> to actually run a command.
>
Just a hint: 1.2.0 is due in some weeks, so it might be a good idea to
base yur bindings on that. It adds some new APIs.
> the lack of configuration/auth parameters.. Any pointers as to what's
> missing and examples?
>
The authentication stuff is required. You can see how to set it up in the
cmdline client. You can trim it down to what you need and make it
non-interactive if you want.
Some other comments.
> Code snippet
> -----------------------------------------
>
> int
> set_up_client_ctx ()
> {
> apr_allocator_t *allocator;
> svn_error_t *err;
> if (apr_allocator_create (&allocator))
> return 1;
>
> apr_allocator_max_free_set (allocator,
> SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);
>
> SVN_G(pool) = svn_pool_create_ex (NULL, allocator);
> apr_allocator_owner_set (allocator, SVN_G(pool));
>
> if ((err = svn_client_create_context (&SVN_G(ctx), SVN_G(pool))))
> return 1;
>
You need to clear any errors, else they are leaked. In debugging builds,
the application will crash at termination if the error wasn't cleared.
Same applies below.
> if ((err = svn_config_get_config (&(SVN_G(ctx)->config),
> NULL, SVN_G(pool))))
> return 1;
>
>
>
> return 0;
> }
> ........
> and in the checkout bindings:
> revision.kind = svn_opt_revision_head;
>
> err = svn_client_checkout (NULL,
> repos_url,
> target_path,
> &revision,
> TRUE, /* yes, we want to recurse into the URL */
> SVN_G(ctx),
> SVN_G(pool));
>
>
Hope I've been to some help; feel free to ask again.
Regards,
//Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Apr 19 08:22:24 2005