svn_client_checkout3 crashes with EXC_BAD_ACCESS

228 Views Asked by At

I want to checkout a working copy:

apr_pool_t *pool = NULL;
apr_pool_create(&pool, NULL);
svn_client_ctx_t *context = NULL;
svn_client_create_context(&context, pool);
svn_opt_revision_t revision;
revision.kind = svn_opt_revision_head;
svn_client_checkout3(NULL,
                     repo.URL.absoluteString.UTF8String, // repo URL
                     localURL.path.UTF8String, // local path
                     &revision,
                     &revision,
                     svn_depth_infinity,
                     TRUE,
                     FALSE,
                     context,
                     pool);
apr_pool_destroy(pool);

It crashes at svn_client_checkout3 with EXC_BAD_ACCESS (probably a segmentation fault). I read the documentation but I can't find out what I'm doing wrong.

What could be the cause of this error?

1

There are 1 best solutions below

0
On

I assume you initialized APR, svn_utf, svn_fs, svn_ra, etc. before this code snippet?

There are some code examples in the Subversion repository that show how you should perform initialization and to take care of callback prompts for things like authorization.

If you would like to avoid all this I would recommend looking at some of the higher level bindings that exist for Python (part of Subversion), Java (JavaHL and SvnKit) and .Net (SharpSvn). Or if you just want to perform one command you could just shell out to svn.