subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1624238 - /subversion/branches/log-message-templates/subversion/svn/util.c
Date Thu, 11 Sep 2014 09:41:31 GMT
Author: rhuijben
Date: Thu Sep 11 09:41:30 2014
New Revision: 1624238

URL: http://svn.apache.org/r1624238
Log:
On the log-message-templates branch: Don't fetch log message templates
when we are not going to use them, to avoid doing unneeded (potentially
expensive) work.

This handles cases like
$ svn ci -m "My message"

* subversion/svn/util.c
  (svn_cl__get_log_message): Only create a default message if we are actually
    going to use it. Remove unnecessary initialization.

Modified:
    subversion/branches/log-message-templates/subversion/svn/util.c

Modified: subversion/branches/log-message-templates/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-message-templates/subversion/svn/util.c?rev=1624238&r1=1624237&r2=1624238&view=diff
==============================================================================
--- subversion/branches/log-message-templates/subversion/svn/util.c (original)
+++ subversion/branches/log-message-templates/subversion/svn/util.c Thu Sep 11 09:41:30 2014
@@ -333,11 +333,35 @@ svn_cl__get_log_message(const char **log
                         void *baton,
                         apr_pool_t *pool)
 {
-  svn_stringbuf_t *default_msg = NULL;
+  svn_stringbuf_t *default_msg;
   struct log_msg_baton *lmb = baton;
   svn_stringbuf_t *message = NULL;
   apr_hash_t *log_message_templates;
 
+  *tmp_file = NULL;
+  if (lmb->message)
+    {
+      svn_string_t *log_msg_str = svn_string_create(lmb->message, pool);
+
+      SVN_ERR_W(svn_subst_translate_string2(&log_msg_str, NULL, NULL,
+                                            log_msg_str, lmb->message_encoding,
+                                            FALSE, pool, pool),
+                _("Error normalizing log message to internal format"));
+
+      /* Strip off the EOF marker text and the junk that follows it. */
+      truncate_buffer_at_prefix(&(log_msg_str->len), (char *)log_msg_str->data,
+                                EDITOR_EOF_PREFIX);
+
+      *log_msg = log_msg_str->data;
+      return SVN_NO_ERROR;
+    }
+
+  if (! commit_items->nelts)
+    {
+      *log_msg = "";
+      return SVN_NO_ERROR;
+    }
+
   /* Set default message.  */
   SVN_ERR(svn_client_get_log_message_templates_for_commit_items(
             &log_message_templates, commit_items, lmb->ctx, pool, pool));
@@ -385,30 +409,6 @@ svn_cl__get_log_message(const char **log
   svn_stringbuf_appendcstr(default_msg, EDITOR_EOF_PREFIX);
   svn_stringbuf_appendcstr(default_msg, APR_EOL_STR APR_EOL_STR);
 
-  *tmp_file = NULL;
-  if (lmb->message)
-    {
-      svn_string_t *log_msg_str = svn_string_create(lmb->message, pool);
-
-      SVN_ERR_W(svn_subst_translate_string2(&log_msg_str, NULL, NULL,
-                                            log_msg_str, lmb->message_encoding,
-                                            FALSE, pool, pool),
-                _("Error normalizing log message to internal format"));
-
-      /* Strip off the EOF marker text and the junk that follows it. */
-      truncate_buffer_at_prefix(&(log_msg_str->len), (char *)log_msg_str->data,
-                                EDITOR_EOF_PREFIX);
-
-      *log_msg = log_msg_str->data;
-      return SVN_NO_ERROR;
-    }
-
-  if (! commit_items->nelts)
-    {
-      *log_msg = "";
-      return SVN_NO_ERROR;
-    }
-
   while (! message)
     {
       /* We still don't have a valid commit message.  Use $EDITOR to



Mime
View raw message