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

Client library usage

From: Alan Knowles <alan_at_akbkhome.com>
Date: 2005-04-19 07:28:54 CEST

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.

based on looking at cmdline/main.c and what looks like slightly outdated
docs at
http://www.linuxdevcenter.com/pub/a/linux/2003/04/24/libsvn1.html?page=2

I've got something like the code below (SVN_G is php's way of doing
thread safe globals BTW)

It currently segfaults on calling the checkout, I'm guessing it's due to
the lack of configuration/auth parameters.. Any pointers as to what's
missing and examples?

Thanks
Alan

Backtrace
-----------------------------------------
0x404965be in svn_auth_set_parameter () from /usr/lib/libsvn_subr-1.so.0
(gdb) up
#1 0x405c64f8 in svn_ra_dav__do_check_path ()
from /usr/lib/libsvn_ra_dav-1.so.0
(gdb) up
#2 0x4045a628 in svn_client__open_ra_session ()
from /usr/lib/libsvn_client-1.so.0
(gdb) up
#3 0x404498ed in svn_client__checkout_internal ()
from /usr/lib/libsvn_client-1.so.0
(gdb) up
#4 0x40449daf in svn_client_checkout ()
from /usr/lib/libsvn_client-1.so.0
(gdb) up
#5 0x40019026 in zif_svn_checkout (ht=0, return_value=0x8352464,
this_ptr=0x0,

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;

        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));
        

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Apr 19 07:30:45 2005

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.