Author: rinrab
Date: Mon May 26 22:05:14 2025
New Revision: 1925845

URL: http://svn.apache.org/viewvc?rev=1925845&view=rev
Log:
On the 'utf8-cmdline-prototype' branch: deprecate 
svn_client_args_to_target_array2
and rename svn_client_args_to_target_array_utf8 to 
svn_client_args_to_target_array3.

It also required to factor out something like svn_client__process_target_array()
from libsvn_client/cmdline.c. Yeah, it starts being messy due to all this 
backward
compat. I hate it, but it's life. Life is hard. I did my best to avoid as much
code duplication as I could.

* subversion/include/svn_client.h
  (svn_client_args_to_target_array_utf8): rename to 
svn_client_args_to_target_array3.
  (svn_client_args_to_target_array2): deprecate.
* subversion/libsvn_client/client.h
  (SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE): add define.
  (svn_client__process_target_array): declare func.
* subversion/libsvn_client/cmdline.c
  (DEFAULT_ARRAY_SIZE): moved to header.
  (args_to_target_array): rename to svn_client__process_target_array.
  (svn_client__process_target_array): Use SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE
   instead of DEFAULT_ARRAY_SIZE
  (svn_client_args_to_target_array2): moved to deprecated.c
* subversion/libsvn_client/deprecated.c
  (svn_client_args_to_target_array2): implement it here.
* subversion/svn/util.c
  (svn_cl__args_to_target_array_print_reserved): adjust to use renamed function.

Modified:
    subversion/branches/utf8-cmdline-prototype/subversion/include/svn_client.h
    subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/client.h
    
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
    
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/deprecated.c
    subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c

Modified: 
subversion/branches/utf8-cmdline-prototype/subversion/include/svn_client.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/include/svn_client.h?rev=1925845&r1=1925844&r2=1925845&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/include/svn_client.h 
(original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/include/svn_client.h 
Mon May 26 22:05:14 2025
@@ -1138,9 +1138,9 @@ svn_client_create_context(svn_client_ctx
  */
 
 /**
- * Pull remaining target arguments from @a os into @a *targets_p,
- * converting them to UTF-8, followed by targets from @a known_targets
- * (which might come from, for example, the "--targets" command line option).
+ * Pull remaining target arguments from @a os into @a *targets_p, followed by
+ * targets from @a known_targets (which might come from, for example, the
+ * "--targets" command line option).
  *
  * Process each target in one of the following ways.  For a repository-
  * relative URL: resolve to a full URL, contacting the repository if
@@ -1170,8 +1170,25 @@ svn_client_create_context(svn_client_ctx
  * literal path "@abc" with no peg revision, or the form ".@abc" to refer to
  * the empty path with peg revision "abc".
  *
+ * @since New in 1.15
+ */
+svn_error_t *
+svn_client_args_to_target_array3(apr_array_header_t **targets_p,
+                                 apr_getopt_t *os,
+                                 const apr_array_header_t *known_targets,
+                                 svn_client_ctx_t *ctx,
+                                 svn_boolean_t 
keep_last_origpath_on_truepath_collision,
+                                 apr_pool_t *pool);
+
+/**
+ * Similar to svn_client_args_to_target_array3() but also converts the
+ * targets to UTF-8.
+ *
  * @since New in 1.7
+ *
+ * @deprecated Provided for backward compatibility with the 1.14 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_client_args_to_target_array2(apr_array_header_t **targets_p,
                                  apr_getopt_t *os,
@@ -1197,20 +1214,6 @@ svn_client_args_to_target_array(apr_arra
                                 svn_client_ctx_t *ctx,
                                 apr_pool_t *pool);
 
-/**
- * Similar to svn_client_args_to_target_array2() but assuming that the targets
- * in @a os are already UTF-8 encoded.
- *
- * @since New in 1.15.0
- */
-svn_error_t *
-svn_client_args_to_target_array_utf8(apr_array_header_t **targets_p,
-                                     apr_getopt_t *os,
-                                     const apr_array_header_t *known_targets,
-                                     svn_client_ctx_t *ctx,
-                                     svn_boolean_t 
keep_last_origpath_on_truepath_collision,
-                                     apr_pool_t *pool);
-
 /** @} group end: Client command-line processing */
 
 /** @} */

Modified: 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/client.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/client.h?rev=1925845&r1=1925844&r2=1925845&view=diff
==============================================================================
--- 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/client.h 
(original)
+++ 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/client.h 
Mon May 26 22:05:14 2025
@@ -1280,6 +1280,20 @@ svn_client__textbase_sync(svn_ra_session
 const svn_version_t *
 svn_client__compatible_wc_version_optional_pristine(apr_pool_t *result_pool);
 
+#define SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE 5
+
+/* Helper for svn_client_args_to_target_array2 and
+ * svn_client_args_to_target_array3.
+ */
+svn_error_t *
+svn_client__process_target_array(apr_array_header_t **targets_p,
+                                 apr_array_header_t *utf8_targets,
+                                 const apr_array_header_t *known_targets,
+                                 svn_client_ctx_t *ctx,
+                                 svn_boolean_t 
keep_last_origpath_on_truepath_collision,
+                                 apr_pool_t *pool);
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c?rev=1925845&r1=1925844&r2=1925845&view=diff
==============================================================================
--- 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c 
(original)
+++ 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c 
Mon May 26 22:05:14 2025
@@ -41,8 +41,6 @@
 
 /*** Code. ***/
 
-#define DEFAULT_ARRAY_SIZE 5
-
 
 /* Attempt to find the repository root url for TARGET, possibly using CTX for
  * authentication.  If one is found and *ROOT_URL is not NULL, then just check
@@ -110,26 +108,23 @@ check_root_url_of_target(const char **ro
    return SVN_NO_ERROR;
 }
 
-/* Internal helper for public interfaces svn_client_args_to_target_array2
- * and svn_client_args_to_target_array_utf8.
- *
- * Note: This is substantially copied from svn_opt__args_to_target_array() in
+/* Note: This is substantially copied from svn_opt__args_to_target_array() in
  * order to move to libsvn_client while maintaining backward compatibility. */
-static svn_error_t *
-args_to_target_array(apr_array_header_t **targets_p,
-                     apr_array_header_t *utf8_targets,
-                     const apr_array_header_t *known_targets,
-                     svn_client_ctx_t *ctx,
-                     svn_boolean_t keep_last_origpath_on_truepath_collision,
-                     apr_pool_t *pool)
+svn_error_t *
+svn_client__process_target_array(apr_array_header_t **targets_p,
+                                 apr_array_header_t *utf8_targets,
+                                 const apr_array_header_t *known_targets,
+                                 svn_client_ctx_t *ctx,
+                                 svn_boolean_t 
keep_last_origpath_on_truepath_collision,
+                                 apr_pool_t *pool)
 {
   int i;
   svn_boolean_t rel_url_found = FALSE;
   const char *root_url = NULL;
-  apr_array_header_t *input_targets =
-    apr_array_make(pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
-  apr_array_header_t *output_targets =
-    apr_array_make(pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
+  apr_array_header_t *input_targets = apr_array_make(
+      pool, SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE, sizeof(const char *));
+  apr_array_header_t *output_targets = apr_array_make(
+      pool, SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE, sizeof(const char *));
   apr_array_header_t *reserved_names = NULL;
 
   /* Step 1:  create a master array of targets that are in UTF-8
@@ -276,8 +271,9 @@ args_to_target_array(apr_array_header_t
               if (svn_wc_is_adm_dir(base_name, pool))
                 {
                   if (!reserved_names)
-                    reserved_names = apr_array_make(pool, DEFAULT_ARRAY_SIZE,
-                                                    sizeof(const char *));
+                    reserved_names = apr_array_make(
+                        pool, SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE,
+                        sizeof(const char *));
 
                   APR_ARRAY_PUSH(reserved_names, const char *) = utf8_target;
 
@@ -368,44 +364,17 @@ args_to_target_array(apr_array_header_t
 
   return SVN_NO_ERROR;
 }
+
 svn_error_t *
-svn_client_args_to_target_array2(apr_array_header_t **targets_p,
+svn_client_args_to_target_array3(apr_array_header_t **targets_p,
                                  apr_getopt_t *os,
                                  const apr_array_header_t *known_targets,
                                  svn_client_ctx_t *ctx,
                                  svn_boolean_t 
keep_last_origpath_on_truepath_collision,
                                  apr_pool_t *pool)
 {
-  apr_array_header_t *utf8_input_targets =
-      apr_array_make(pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
-
-  for (; os->ind < os->argc; os->ind++)
-    {
-      /* The apr_getopt targets are still in native encoding. */
-      const char *raw_target = os->argv[os->ind];
-      const char *utf8_target;
-
-      SVN_ERR(svn_utf_cstring_to_utf8(&utf8_target,
-                                      raw_target, pool));
-
-      APR_ARRAY_PUSH(utf8_input_targets, const char *) = utf8_target;
-    }
-
-  return svn_error_trace(
-      args_to_target_array(targets_p, utf8_input_targets, known_targets, ctx,
-                           keep_last_origpath_on_truepath_collision, pool));
-}
-
-svn_error_t *
-svn_client_args_to_target_array_utf8(apr_array_header_t **targets_p,
-                                     apr_getopt_t *os,
-                                     const apr_array_header_t *known_targets,
-                                     svn_client_ctx_t *ctx,
-                                     svn_boolean_t 
keep_last_origpath_on_truepath_collision,
-                                     apr_pool_t *pool)
-{
-  apr_array_header_t *utf8_input_targets =
-      apr_array_make(pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
+  apr_array_header_t *utf8_input_targets = apr_array_make(
+      pool, SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE, sizeof(const char *));
 
   for (; os->ind < os->argc; os->ind++)
     {
@@ -413,6 +382,6 @@ svn_client_args_to_target_array_utf8(apr
     }
 
   return svn_error_trace(
-      args_to_target_array(targets_p, utf8_input_targets, known_targets, ctx,
+      svn_client__process_target_array(targets_p, utf8_input_targets, 
known_targets, ctx,
                            keep_last_origpath_on_truepath_collision, pool));
 }

Modified: 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/deprecated.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/deprecated.c?rev=1925845&r1=1925844&r2=1925845&view=diff
==============================================================================
--- 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/deprecated.c
 (original)
+++ 
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/deprecated.c
 Mon May 26 22:05:14 2025
@@ -443,6 +443,34 @@ svn_client_blame(const char *target,
 
 /*** From cmdline.c ***/
 svn_error_t *
+svn_client_args_to_target_array2(apr_array_header_t **targets_p,
+                                 apr_getopt_t *os,
+                                 const apr_array_header_t *known_targets,
+                                 svn_client_ctx_t *ctx,
+                                 svn_boolean_t 
keep_last_origpath_on_truepath_collision,
+                                 apr_pool_t *pool)
+{
+  apr_array_header_t *utf8_input_targets = apr_array_make(
+      pool, SVN_CLIENT__CMDLINE_DEFAULT_ARRAY_SIZE, sizeof(const char *));
+
+  for (; os->ind < os->argc; os->ind++)
+    {
+      /* The apr_getopt targets are still in native encoding. */
+      const char *raw_target = os->argv[os->ind];
+      const char *utf8_target;
+
+      SVN_ERR(svn_utf_cstring_to_utf8(&utf8_target,
+                                      raw_target, pool));
+
+      APR_ARRAY_PUSH(utf8_input_targets, const char *) = utf8_target;
+    }
+
+  return svn_error_trace(svn_client__process_target_array(
+      targets_p, utf8_input_targets, known_targets, ctx,
+      keep_last_origpath_on_truepath_collision, pool));
+}
+
+svn_error_t *
 svn_client_args_to_target_array(apr_array_header_t **targets_p,
                                 apr_getopt_t *os,
                                 const apr_array_header_t *known_targets,

Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c?rev=1925845&r1=1925844&r2=1925845&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c (original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c Mon May 26 
22:05:14 2025
@@ -803,7 +803,7 @@ svn_cl__args_to_target_array_print_reser
                                             svn_boolean_t 
keep_last_origpath_on_truepath_collision,
                                             apr_pool_t *pool)
 {
-  svn_error_t *err = svn_client_args_to_target_array_utf8(
+  svn_error_t *err = svn_client_args_to_target_array3(
       targets, os, known_targets, ctx,
       keep_last_origpath_on_truepath_collision, pool);
 


Reply via email to