subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phi...@apache.org
Subject svn commit: r1591015 - in /subversion/trunk/subversion: include/private/svn_subr_private.h libsvn_subr/config.c svn/svn.c svnmucc/svnmucc.c
Date Tue, 29 Apr 2014 16:09:40 GMT
Author: philip
Date: Tue Apr 29 16:09:40 2014
New Revision: 1591015

URL: http://svn.apache.org/r1591015
Log:
Move empty config creation code from svn to libsvn_subr and use it
in svnmucc as well.

* subversion/include/private/svn_subr_private.h
  (svn_config__get_default_config): New.

* subversion/libsvn_subr/config.c
  (svn_config__get_default_config): New.

* subversion/svn/svn.c
  (sub_main): Use svn_config__get_default_config, move hash get to just
   before use.

* subversion/svnmucc/svnmucc.c
  (sub_main): Use svn_config__get_default_config, move hash get to just
   before use.

Modified:
    subversion/trunk/subversion/include/private/svn_subr_private.h
    subversion/trunk/subversion/libsvn_subr/config.c
    subversion/trunk/subversion/svn/svn.c
    subversion/trunk/subversion/svnmucc/svnmucc.c

Modified: subversion/trunk/subversion/include/private/svn_subr_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_subr_private.h?rev=1591015&r1=1591014&r2=1591015&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_subr_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_subr_private.h Tue Apr 29 16:09:40 2014
@@ -608,6 +608,16 @@ svn_config__shallow_replace_section(svn_
                                     svn_config_t *source,
                                     const char *section);
 
+/* Allocate *CFG_HASH and populate it with default, empty,
+ * svn_config_t for the configuration categories (@c
+ * SVN_CONFIG_CATEGORY_SERVERS, @c SVN_CONFIG_CATEGORY_CONFIG, etc.).
+ * This returns a hash equivalent to svn_config_get_config when the
+ * config files are empty.
+ */
+void
+svn_config__get_default_config(apr_hash_t **cfg_hash,
+                               apr_pool_t *pool);
+
 /** @} */
 
 

Modified: subversion/trunk/subversion/libsvn_subr/config.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/config.c?rev=1591015&r1=1591014&r2=1591015&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/config.c (original)
+++ subversion/trunk/subversion/libsvn_subr/config.c Tue Apr 29 16:09:40 2014
@@ -307,6 +307,20 @@ svn_config_get_config(apr_hash_t **cfg_h
   return SVN_NO_ERROR;
 }
 
+void
+svn_config__get_default_config(apr_hash_t **cfg_hash,
+                               apr_pool_t *pool)
+{
+  svn_config_t *empty_cfg;
+  *cfg_hash = apr_hash_make(pool);
+
+  SVN_ERR(svn_config_create2(&empty_cfg, FALSE, FALSE, pool));
+  svn_hash_sets(*cfg_hash, SVN_CONFIG_CATEGORY_CONFIG, empty_cfg);
+
+  SVN_ERR(svn_config_create2(&empty_cfg, FALSE, FALSE, pool));
+  svn_hash_sets(*cfg_hash, SVN_CONFIG_CATEGORY_SERVERS, empty_cfg);
+}
+
 
 
 /* Iterate through CFG, passing BATON to CALLBACK for every (SECTION, OPTION)

Modified: subversion/trunk/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1591015&r1=1591014&r2=1591015&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Tue Apr 29 16:09:40 2014
@@ -2594,11 +2594,8 @@ sub_main(int *exit_code, int argc, const
 
           svn_handle_warning2(stderr, err, "svn: ");
           svn_error_clear(err);
-          cfg_hash = apr_hash_make(pool);
-          SVN_ERR(svn_config_create2(&empty_cfg, FALSE, FALSE, pool));
-          svn_hash_sets(cfg_hash, SVN_CONFIG_CATEGORY_CONFIG, empty_cfg);
-          SVN_ERR(svn_config_create2(&empty_cfg, FALSE, FALSE, pool));
-          svn_hash_sets(cfg_hash, SVN_CONFIG_CATEGORY_SERVERS, empty_cfg);
+
+          svn_config__get_default_config(&cfg_hash, pool);
         }
       else
         return err;
@@ -2659,8 +2656,6 @@ sub_main(int *exit_code, int argc, const
         }
     }
 
-  cfg_config = svn_hash_gets(cfg_hash, SVN_CONFIG_CATEGORY_CONFIG);
-
   /* Update the options in the config */
   if (opt_state.config_options)
     {
@@ -2670,6 +2665,7 @@ sub_main(int *exit_code, int argc, const
                                             "svn: ", "--config-option"));
     }
 
+  cfg_config = svn_hash_gets(cfg_hash, SVN_CONFIG_CATEGORY_CONFIG);
 #if !defined(SVN_CL_NO_EXCLUSIVE_LOCK)
   {
     const char *exclusive_clients_option;

Modified: subversion/trunk/subversion/svnmucc/svnmucc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnmucc/svnmucc.c?rev=1591015&r1=1591014&r2=1591015&view=diff
==============================================================================
--- subversion/trunk/subversion/svnmucc/svnmucc.c (original)
+++ subversion/trunk/subversion/svnmucc/svnmucc.c Tue Apr 29 16:09:40 2014
@@ -56,6 +56,7 @@
 #include "svn_version.h"
 
 #include "private/svn_cmdline_private.h"
+#include "private/svn_subr_private.h"
 
 /* Version compatibility check */
 static svn_error_t *
@@ -640,13 +641,13 @@ sub_main(int *exit_code, int argc, const
         {
           svn_handle_warning2(stderr, err, "svnmucc: ");
           svn_error_clear(err);
-          cfg_hash = NULL;
+
+          svn_config__get_default_config(&cfg_hash, pool);
         }
       else
         return err;
     }
 
-  cfg_config = svn_hash_gets(cfg_hash, SVN_CONFIG_CATEGORY_CONFIG);
   if (config_options)
     {
       svn_error_clear(
@@ -656,6 +657,7 @@ sub_main(int *exit_code, int argc, const
 
   SVN_ERR(svn_client_create_context2(&ctx, cfg_hash, pool));
 
+  cfg_config = svn_hash_gets(cfg_hash, SVN_CONFIG_CATEGORY_CONFIG);
   SVN_ERR(svn_cmdline_create_auth_baton(&ctx->auth_baton,
                                         non_interactive,
                                         username,



Mime
View raw message