示例#1
0
文件: config.c 项目: aosm/subversion
svn_error_t *
svn_config_merge(svn_config_t *cfg, const char *file,
                 svn_boolean_t must_exist)
{
  /* The original config hash shouldn't change if there's an error
     while reading the confguration, so read into a temporary table.
     ### We could use a tmp subpool for this, since merge_cfg is going
     to be tossed afterwards.  Premature optimization, though? */
  svn_config_t *merge_cfg;
  SVN_ERR(svn_config_read(&merge_cfg, file, must_exist, cfg->pool));

  /* Now copy the new options into the original table. */
  for_each_option(merge_cfg, cfg, merge_cfg->pool, merge_callback);
  return SVN_NO_ERROR;
}
示例#2
0
/* fonction permettant d'initialiser le contexte avant toute opération svn */
svn_client_ctx_t *initialize_context(){  
  svn_error_t *err;
  svn_config_t *cfg;
  
  err = svn_config_ensure (NULL, pool);
  
  if (err) {
    svn_handle_error2 (err, stderr, FALSE, "svn_support: ");
    return NULL;
  }
  
  // -- Creation du contexte --
  svn_client_create_context(&ctx,pool);
  svn_config_get_config (&(ctx->config), NULL, pool);
 
  // -- Récupération du fichier de config dans ~/.subversion --
  const char *config_path;
  svn_config_get_user_config_path(&config_path,
                                  NULL,
                                  SVN_CONFIG_CATEGORY_CONFIG,
                                  pool);
  svn_config_read(&cfg,
		  config_path,
		  TRUE,
		  pool);
  
  // -- Initialisation des parametres d'authentification --
  svn_cmdline_create_auth_baton(&ctx->auth_baton,
                                TRUE,
                                NULL,
                                NULL,
                                config_path,
                                FALSE,
                                FALSE,
                                cfg,
                                cancel,
                                ctx->cancel_baton,
                                pool);
  return ctx;
}
示例#3
0
文件: config.c 项目: aosm/subversion
/* Read various configuration sources into *CFGP, in this order, with
 * later reads overriding the results of earlier ones:
 *
 *    1. SYS_REGISTRY_PATH   (only on Win32, but ignored if NULL)
 *
 *    2. SYS_FILE_PATH       (everywhere, but ignored if NULL)
 *
 *    3. USR_REGISTRY_PATH   (only on Win32, but ignored if NULL)
 *
 *    4. USR_FILE_PATH       (everywhere, but ignored if NULL)
 *
 * Allocate *CFGP in POOL.  Even if no configurations are read,
 * allocate an empty *CFGP.
 */
static svn_error_t *
read_all(svn_config_t **cfgp,
         const char *sys_registry_path,
         const char *usr_registry_path,
         const char *sys_file_path,
         const char *usr_file_path,
         apr_pool_t *pool)
{
  svn_boolean_t red_config = FALSE;  /* "red" is the past tense of "read" */

  /*** Read system-wide configurations first... ***/

#ifdef WIN32
  if (sys_registry_path)
    {
      SVN_ERR(svn_config_read(cfgp, sys_registry_path, FALSE, pool));
      red_config = TRUE;
    }
#endif /* WIN32 */

  if (sys_file_path)
    {
      if (red_config)
        SVN_ERR(svn_config_merge(*cfgp, sys_file_path, FALSE));
      else
        {
          SVN_ERR(svn_config_read(cfgp, sys_file_path, FALSE, pool));
          red_config = TRUE;
        }
    }

  /*** ...followed by per-user configurations. ***/

#ifdef WIN32
  if (usr_registry_path)
    {
      if (red_config)
        SVN_ERR(svn_config_merge(*cfgp, usr_registry_path, FALSE));
      else
        {
          SVN_ERR(svn_config_read(cfgp, usr_registry_path, FALSE, pool));
          red_config = TRUE;
        }
    }
#endif /* WIN32 */

  if (usr_file_path)
    {
      if (red_config)
        SVN_ERR(svn_config_merge(*cfgp, usr_file_path, FALSE));
      else
        {
          SVN_ERR(svn_config_read(cfgp, usr_file_path, FALSE, pool));
          red_config = TRUE;
        }
    }

  if (! red_config)
    *cfgp = NULL;

  return SVN_NO_ERROR;
}