Author: rinrab
Date: Mon May 26 17:24:16 2025
New Revision: 1925834

URL: http://svn.apache.org/viewvc?rev=1925834&view=rev
Log:
On the 'utf8-cmdline-prototype' branch: Store utf8-ized message in opt_state.

* subversion/svn/cl.h
  (svn_cl__opt_state_t::message): Adjust comment.
* subversion/svn/svn.c
  (sub_main::--message): Use utf8_opt_arg instead of opt_arg.
  (sub_main::message-path-check): Use svn_io_stat() instead of apr_stat() to
   check path, because it accepts utf8 path, unlike apr.
* subversion/svn/util.c
  (svn_cl__make_log_msg_baton): Rework the function so --encoding is handled
   only when we are processing filedata log-message source. If --message is
   given, the encoding defaults to UTF-8 (this constant is defined in encoding
   conversion routines, so it will work).

Modified:
    subversion/branches/utf8-cmdline-prototype/subversion/svn/cl.h
    subversion/branches/utf8-cmdline-prototype/subversion/svn/svn.c
    subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c

Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/cl.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/cl.h?rev=1925834&r1=1925833&r2=1925834&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/svn/cl.h (original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/svn/cl.h Mon May 26 
17:24:16 2025
@@ -173,7 +173,7 @@ typedef struct svn_cl__opt_state_t
   /* Was --no-unlock specified? */
   svn_boolean_t no_unlock;
 
-  const char *message;           /* log message (not converted to UTF-8) */
+  const char *message;           /* log message */
   svn_boolean_t force;           /* be more forceful, as in "svn rm -f ..." */
   svn_boolean_t force_log;       /* force validity of a suspect log msg file */
   svn_boolean_t incremental;     /* yield output suitable for concatenation */

Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/svn.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/svn.c?rev=1925834&r1=1925833&r2=1925834&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/svn/svn.c (original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/svn/svn.c Mon May 26 
17:24:16 2025
@@ -2331,9 +2331,7 @@ sub_main(int *exit_code,
         }
         break;
       case 'm':
-        /* We store the raw message here.  We will convert it to UTF-8
-         * later, according to the value of the '--encoding' option. */
-        opt_state.message = apr_pstrdup(pool, opt_arg);
+        opt_state.message = apr_pstrdup(pool, utf8_opt_arg);
         break;
       case 'c':
         {
@@ -3167,8 +3165,10 @@ sub_main(int *exit_code,
       if (opt_state.message)
         {
           apr_finfo_t finfo;
-          if (apr_stat(&finfo, opt_state.message /* not converted to UTF-8 */,
-                       APR_FINFO_MIN, pool) == APR_SUCCESS)
+
+          err = svn_io_stat(&finfo, opt_state.message, APR_FINFO_MIN, pool);
+
+          if (!err)
             {
               if (subcommand->cmd_func != svn_cl__lock)
                 {
@@ -3185,6 +3185,7 @@ sub_main(int *exit_code,
                        "(was -F intended?); use '--force-log' to override"));
                 }
             }
+          svn_error_clear(err);
         }
     }
 

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=1925834&r1=1925833&r2=1925834&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c (original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c Mon May 26 
17:24:16 2025
@@ -220,28 +220,29 @@ svn_cl__make_log_msg_baton(void **baton,
                                   _("Log message contains a zero byte"));
         }
       lmb->message = opt_state->filedata->data;
+
+      if (opt_state->encoding)
+        {
+          lmb->message_encoding = opt_state->encoding;
+        }
+      else if (config)
+        {
+          svn_config_t *cfg =
+              svn_hash_gets(config, SVN_CONFIG_CATEGORY_CONFIG);
+          svn_config_get(cfg, &(lmb->message_encoding),
+                         SVN_CONFIG_SECTION_MISCELLANY,
+                         SVN_CONFIG_OPTION_LOG_ENCODING, NULL);
+        }
+      else
+        lmb->message_encoding = NULL;
     }
   else
     {
       lmb->message = opt_state->message;
+      lmb->message_encoding = "UTF-8";
     }
 
   lmb->editor_cmd = opt_state->editor_cmd;
-  if (opt_state->encoding)
-    {
-      lmb->message_encoding = opt_state->encoding;
-    }
-  else if (config)
-    {
-      svn_config_t *cfg = svn_hash_gets(config, SVN_CONFIG_CATEGORY_CONFIG);
-      svn_config_get(cfg, &(lmb->message_encoding),
-                     SVN_CONFIG_SECTION_MISCELLANY,
-                     SVN_CONFIG_OPTION_LOG_ENCODING,
-                     NULL);
-    }
-  else
-    lmb->message_encoding = NULL;
-
   lmb->base_dir = base_dir;
   lmb->tmpfile_left = NULL;
   lmb->config = config;


Reply via email to