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

Making a simple svn client

From: Timothy Place <tim_at_electrotap.com>
Date: 2006-11-15 07:34:42 CET


I am trying to make a very simple svn client which basically just
does one thing: a fresh svn checkout from a fixed url. For example,
in the code at the end of this email I am attempting to do the
equivalent of this command line:
        svn co https://svn.sourceforge.net/svnroot/ttblue/trunk/ttblue/dsplib/
I just want to do a checkout on program startup, then the program
ends. It is from sourceforge, meaning no username or password are
required. I don't need any sort of progress reporting. I am
building off of 1.3.x libraries.

The problem that I am having is that when I get to the bottom, the
checkout fails with an error like so:
        PROPFIND request failed on '/svnroot/ttblue/trunk/ttblue/dsplib'
I seem to be doing something wrong, but I'm not sure what that is.
Can anyone lend me a hand?

Many thanks,

        svn_auth_provider_object_t *username_wc_provider;
        apr_array_header_t *providers;
        svn_auth_baton_t *ab;
        svn_config_t *cfg;
        apr_allocator_t *allocator;
        apr_pool_t *pool;
        apr_pool_t *subpool;
        apr_array_header_t *received_opts;
        svn_client_ctx_t *ctx;
        svn_error_t *err;
        svn_revnum_t result_rev;
        svn_opt_revision_t revision;
        // Create our top-level pool. Use a seperate mutexless allocator,
        // given this application is single threaded.

        pool = svn_pool_create_ex(NULL, allocator);
        apr_allocator_owner_set(allocator, pool);
        received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
        err = svn_ra_initialize(pool);
                error("svn_ra_initialize(pool) FAILED");
        svn_client_create_context(&ctx, pool);

        err = svn_config_get_config(&(ctx->config), NULL, pool);
                error("svn_config_get_config() FAILED");
        cfg = (svn_config_t *)apr_hash_get(ctx->config,
        providers = apr_array_make(pool, 1, sizeof
(svn_auth_provider_object_t *));
        username_wc_provider = (svn_auth_provider_object_t *)apr_pcalloc
(pool, sizeof(*username_wc_provider));
        svn_client_get_username_provider(&username_wc_provider, pool);
        *(svn_auth_provider_object_t **)apr_array_push(providers) =

        // Build an authentication baton to give to libsvn_client.
        svn_auth_open(&ab, providers, pool);

        // Place any default --username or --password credentials into the
auth_baton's run-time parameter hash.
        svn_auth_set_parameter(ab, SVN_AUTH_PARAM_DEFAULT_USERNAME, "");
        svn_auth_set_parameter(ab, SVN_AUTH_PARAM_DEFAULT_PASSWORD, "");
        svn_auth_set_parameter(ab, SVN_AUTH_PARAM_NON_INTERACTIVE, "");
        svn_auth_set_parameter(ab, SVN_AUTH_PARAM_NO_AUTH_CACHE, "");

        ctx->auth_baton = ab;

        subpool = svn_pool_create(pool);

        revision.kind = svn_opt_revision_head;

        err = svn_client_checkout(

                error("svn_client_checkout error: %s", err->message);

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 15 07:34:58 2006

This is an archived mail posted to the Subversion Dev mailing list.