- if (svn_cmdline_init("terrasync", stderr) != EXIT_SUCCESS)
- return EXIT_FAILURE;
-#endif
- apr_pool_t *pool;
- apr_pool_create(&pool, NULL);
- svn_error_t *err = NULL;
- SVN_VERSION_DEFINE(mysvn_version);
- err = svn_ver_check_list(&mysvn_version, mysvn_checklist);
- if (err)
- return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
- err = svn_ra_initialize(pool);
- if (err)
- return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
- char *config_dir = NULL;
- err = svn_config_ensure(config_dir, pool);
- if (err)
- return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
- err = svn_client_create_context(&mysvn_ctx, pool);
- if (err)
- return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
- err = svn_config_get_config(&(mysvn_ctx->config),
- config_dir, pool);
- if (err)
- return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
- svn_config_t *cfg;
- cfg = ( svn_config_t*) apr_hash_get(
- mysvn_ctx->config,
- SVN_CONFIG_CATEGORY_CONFIG,
- APR_HASH_KEY_STRING);
- if (err)
- return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
- svn_auth_baton_t *ab;
- err = svn_cmdline_setup_auth_baton(&ab,
- TRUE, NULL, NULL, config_dir, TRUE, cfg,
- mysvn_ctx->cancel_func, mysvn_ctx->cancel_baton, pool);
- if (err)
- return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
- mysvn_ctx->auth_baton = ab;
- mysvn_ctx->conflict_func = NULL;
- mysvn_ctx->conflict_baton = NULL;
- // Now our magic revisions
- mysvn_rev = (svn_opt_revision_t*) apr_palloc(pool,
- sizeof(svn_opt_revision_t));
- if (!mysvn_rev)
- return EXIT_FAILURE;
- mysvn_rev_peg = (svn_opt_revision_t*) apr_palloc(pool,
- sizeof(svn_opt_revision_t));
- if (!mysvn_rev_peg)
- return EXIT_FAILURE;
- mysvn_rev->kind = svn_opt_revision_head;
- mysvn_rev_peg->kind = svn_opt_revision_unspecified;
- // Success if we got this far
- mysvn_pool = pool;
- return EXIT_SUCCESS;
-}
-