svn commit: r1926037 - in /subversion/branches/utf8-cmdline-prototype: ./ subversion/svnmucc/svnmucc.c

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <[email protected]>
Author: rinrab
Date: Sun Jun  1 11:56:55 2025
New Revision: 1926037

URL: http://svn.apache.org/viewvc?rev=1926037&view=rev
Log:
On the 'utf8-cmdline-prototype' branch: sync with trunk.

Modified:
    subversion/branches/utf8-cmdline-prototype/   (props changed)
    subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c

Propchange: subversion/branches/utf8-cmdline-prototype/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1926015-1926036

Modified: subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c
URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c?rev=1926037&r1=1926036&r2=1926037&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c (original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c Sun Jun  1 11:56:55 2025
@@ -105,9 +105,41 @@ typedef enum action_code_t {
   ACTION_PROPSETF,
   ACTION_PROPDEL,
   ACTION_PUT,
-  ACTION_RM
+  ACTION_RM,
+  ACTION_HELP
 } action_code_t;
 
+/* Parses action_code_t from @a action_string into @a action. */
+static svn_error_t *
+action_code_from_word(action_code_t *action, const char *action_string,
+                      apr_pool_t *pool)
+{
+  if (!strcmp(action_string, "mv"))
+    *action = ACTION_MV;
+  else if (!strcmp(action_string, "cp"))
+    *action = ACTION_CP;
+  else if (!strcmp(action_string, "mkdir"))
+    *action = ACTION_MKDIR;
+  else if (!strcmp(action_string, "rm"))
+    *action = ACTION_RM;
+  else if (!strcmp(action_string, "put"))
+    *action = ACTION_PUT;
+  else if (!strcmp(action_string, "propset"))
+    *action = ACTION_PROPSET;
+  else if (!strcmp(action_string, "propsetf"))
+    *action = ACTION_PROPSETF;
+  else if (!strcmp(action_string, "propdel"))
+    *action = ACTION_PROPDEL;
+  else if (!strcmp(action_string, "?") || !strcmp(action_string, "h") ||
+           !strcmp(action_string, "help"))
+    *action = ACTION_HELP;
+  else
+    return svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
+                             "'%s' is not an action\n", action_string);
+
+  return SVN_NO_ERROR;
+}
+
 /* Return the portion of URL that is relative to ANCHOR (URI-decoded). */
 static const char *
 subtract_anchor(const char *anchor, const char *url, apr_pool_t *pool)
@@ -244,6 +276,8 @@ read_propvalue_file(const svn_string_t *
   apr_pool_t *scratch_pool = svn_pool_create(pool);
 
   SVN_ERR(svn_stringbuf_from_file2(&value, filename, scratch_pool));
+  SVN_ERR(svn_utf_stringbuf_to_utf8(&value, value, scratch_pool));
+
   *value_p = svn_string_create_from_buf(value, pool);
   svn_pool_destroy(scratch_pool);
   return SVN_NO_ERROR;
@@ -770,32 +804,14 @@ sub_main(int *exit_code,
       struct action *action = apr_pcalloc(pool, sizeof(*action));
 
       /* First, parse the action. */
-      if (! strcmp(action_string, "mv"))
-        action->action = ACTION_MV;
-      else if (! strcmp(action_string, "cp"))
-        action->action = ACTION_CP;
-      else if (! strcmp(action_string, "mkdir"))
-        action->action = ACTION_MKDIR;
-      else if (! strcmp(action_string, "rm"))
-        action->action = ACTION_RM;
-      else if (! strcmp(action_string, "put"))
-        action->action = ACTION_PUT;
-      else if (! strcmp(action_string, "propset"))
-        action->action = ACTION_PROPSET;
-      else if (! strcmp(action_string, "propsetf"))
-        action->action = ACTION_PROPSETF;
-      else if (! strcmp(action_string, "propdel"))
-        action->action = ACTION_PROPDEL;
-      else if (! strcmp(action_string, "?") || ! strcmp(action_string, "h")
-               || ! strcmp(action_string, "help"))
+      SVN_ERR(action_code_from_word(&action->action, action_string, pool));
+
+      if (action->action == ACTION_HELP)
         {
           help(stdout, pool);
           return SVN_NO_ERROR;
         }
-      else
-        return svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
-                                 "'%s' is not an action\n",
-                                 action_string);
+
       if (++i == action_args->nelts)
         return insufficient();
 
@@ -867,9 +883,9 @@ sub_main(int *exit_code,
               && svn_prop_needs_translation(action->prop_name))
             {
               svn_string_t *translated_value;
-              SVN_ERR_W(svn_subst_translate_string2(&translated_value, NULL,
-                                                    NULL, action->prop_value,
-                                                    NULL, FALSE, pool, pool),
+              SVN_ERR_W(svn_subst_translate_string2(
+                            &translated_value, NULL, NULL, action->prop_value,
+                            "UTF-8", FALSE, pool, pool),
                         "Error normalizing property value");
               action->prop_value = translated_value;
             }
@@ -938,7 +954,7 @@ sub_main(int *exit_code,
   if (! actions->nelts)
     {
       *exit_code = EXIT_FAILURE;
-      help(stderr, pool);
+      usage(pool);
       return SVN_NO_ERROR;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.