FreeBSD/contrib/subversion/subversion/svnrdump/svnrdump.c
/* Initialize the RA layer, and set *CTX to a new client context baton
 * allocated from POOL.  Use CONFIG_DIR and pass USERNAME, PASSWORD,
 * CONFIG_DIR and NO_AUTH_CACHE to initialize the authorization baton.
 * CONFIG_OPTIONS (if not NULL) is a list of configuration overrides.
 * REPOS_URL is used to fiddle with server-specific configuration
 * options.
 */
Initialize the RA layer, and set *CTX to a new client context baton
allocated from POOL.  Use CONFIG_DIR and pass USERNAME, PASSWORD,
CONFIG_DIR and NO_AUTH_CACHE to initialize the authorization baton.
CONFIG_OPTIONS (if not NULL) is a list of configuration overrides.
REPOS_URL is used to fiddle with server-specific configuration
options.
Initialize the RA layer and set * CTX to a new client context baton allocated from POOL . Use CONFIG_DIR and pass USERNAME PASSWORD CONFIG_DIR and NO_AUTH_CACHE to initialize the authorization baton . CONFIG_OPTIONS ( if not NULL ) is a list of configuration overrides . REPOS_URL is used to fiddle with server - specific configuration options .
static svn_error_t *
init_client_context(svn_client_ctx_t **ctx_p,
                    svn_boolean_t non_interactive,
                    const char *username,
                    const char *password,
                    const char *config_dir,
                    const char *repos_url,
                    svn_boolean_t no_auth_cache,
                    svn_boolean_t trust_unknown_ca,
                    svn_boolean_t trust_cn_mismatch,
                    svn_boolean_t trust_expired,
                    svn_boolean_t trust_not_yet_valid,
                    svn_boolean_t trust_other_failure,
                    apr_array_header_t *config_options,
                    apr_pool_t *pool)
{
  svn_client_ctx_t *ctx = NULL;
  svn_config_t *cfg_config, *cfg_servers;
  SVN_ERR(svn_ra_initialize(pool));
  SVN_ERR(svn_config_ensure(config_dir, pool));
  SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
  SVN_ERR(svn_config_get_config(&(ctx->config), config_dir, pool));
  if (config_options)
    SVN_ERR(svn_cmdline__apply_config_options(ctx->config, config_options,
                                              "svnrdump: ", "--config-option"));
  cfg_config = svn_hash_gets(ctx->config, SVN_CONFIG_CATEGORY_CONFIG);
  cfg_servers = svn_hash_gets(ctx->config, SVN_CONFIG_CATEGORY_SERVERS);
  svn_config_set_bool(cfg_servers, SVN_CONFIG_SECTION_GLOBAL,
                      SVN_CONFIG_OPTION_HTTP_BULK_UPDATES, TRUE);
  svn_config_set_int64(cfg_servers, SVN_CONFIG_SECTION_GLOBAL,
                       SVN_CONFIG_OPTION_HTTP_MAX_CONNECTIONS, 2);
  if (cfg_servers)
    {
      apr_status_t status;
      apr_uri_t parsed_url;
      status = apr_uri_parse(pool, repos_url, &parsed_url);
      if (! status)
        {
          const char *server_group;
          server_group = svn_config_find_group(cfg_servers, parsed_url.hostname,
                                               SVN_CONFIG_SECTION_GROUPS, pool);
          if (server_group)
            {
              svn_config_set_bool(cfg_servers, server_group,
                                  SVN_CONFIG_OPTION_HTTP_BULK_UPDATES, TRUE);
              svn_config_set_int64(cfg_servers, server_group,
                                   SVN_CONFIG_OPTION_HTTP_MAX_CONNECTIONS, 2);
            }
        }
    }
  ctx->cancel_func = check_cancel;
  SVN_ERR(svn_cmdline_create_auth_baton2(&(ctx->auth_baton), non_interactive,
                                         username, password, config_dir,
                                         no_auth_cache, trust_unknown_ca,
                                         trust_cn_mismatch, trust_expired,
                                         trust_not_yet_valid,
                                         trust_other_failure,
                                         cfg_config, ctx->cancel_func,
                                         ctx->cancel_baton, pool));
  *ctx_p = ctx;
  return SVN_NO_ERROR;
}
static svn_error_t * init_client_context ( svn_client_ctx_t * * ctx_p , svn_boolean_t non_interactive , const char * username , const char * password , const char * config_dir , const char * repos_url , svn_boolean_t no_auth_cache , svn_boolean_t trust_unknown_ca , svn_boolean_t trust_cn_mismatch , svn_boolean_t trust_expired , svn_boolean_t trust_not_yet_valid , svn_boolean_t trust_other_failure , apr_array_header_t * config_options , apr_pool_t * pool ) { svn_client_ctx_t * ctx = NULL ; svn_config_t * cfg_config , * cfg_servers ; SVN_ERR ( svn_ra_initialize ( pool ) ) ; SVN_ERR ( svn_config_ensure ( config_dir , pool ) ) ; SVN_ERR ( svn_client_create_context2 ( & ctx , NULL , pool ) ) ; SVN_ERR ( svn_config_get_config ( & ( ctx -> config ) , config_dir , pool ) ) ; if ( config_options ) SVN_ERR ( svn_cmdline__apply_config_options ( ctx -> config , config_options , " " , " " ) ) ; cfg_config = svn_hash_gets ( ctx -> config , SVN_CONFIG_CATEGORY_CONFIG ) ; cfg_servers = svn_hash_gets ( ctx -> config , SVN_CONFIG_CATEGORY_SERVERS ) ; svn_config_set_bool ( cfg_servers , SVN_CONFIG_SECTION_GLOBAL , SVN_CONFIG_OPTION_HTTP_BULK_UPDATES , TRUE ) ; svn_config_set_int64 ( cfg_servers , SVN_CONFIG_SECTION_GLOBAL , SVN_CONFIG_OPTION_HTTP_MAX_CONNECTIONS , 2 ) ; if ( cfg_servers ) { apr_status_t status ; apr_uri_t parsed_url ; status = apr_uri_parse ( pool , repos_url , & parsed_url ) ; if ( ! status ) { const char * server_group ; server_group = svn_config_find_group ( cfg_servers , parsed_url . hostname , SVN_CONFIG_SECTION_GROUPS , pool ) ; if ( server_group ) { svn_config_set_bool ( cfg_servers , server_group , SVN_CONFIG_OPTION_HTTP_BULK_UPDATES , TRUE ) ; svn_config_set_int64 ( cfg_servers , server_group , SVN_CONFIG_OPTION_HTTP_MAX_CONNECTIONS , 2 ) ; } } } ctx -> cancel_func = check_cancel ; SVN_ERR ( svn_cmdline_create_auth_baton2 ( & ( ctx -> auth_baton ) , non_interactive , username , password , config_dir , no_auth_cache , trust_unknown_ca , trust_cn_mismatch , trust_expired , trust_not_yet_valid , trust_other_failure , cfg_config , ctx -> cancel_func , ctx -> cancel_baton , pool ) ) ; * ctx_p = ctx ; return SVN_NO_ERROR ; }
Initialize the RA layer, and set *CTX to a new client context baton
 allocated from POOL.
Initialize the RA layer and set * CTX to a new client context baton allocated from POOL .
/* ### FIXME: This is a hack to work around the fact that our dump
     ### editor simply can't handle the way ra_serf violates the
     ### editor v1 drive ordering requirements.
     ###
     ### We'll override both the global value and server-specific one
     ### for the 'http-bulk-updates' and 'http-max-connections'
     ### options in order to get ra_serf to try a bulk-update if the
     ### server will allow it, or at least try to limit all its
     ### auxiliary GETs/PROPFINDs to happening (well-ordered) on a
     ### single server connection.
     ###
     ### See http://subversion.tigris.org/issues/show_bug.cgi?id=4116.
  */ /* Set up our cancellation support. */ /* Default authentication providers for non-interactive use */