subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1623822 - /subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c
Date Tue, 09 Sep 2014 13:44:15 GMT
Author: stsp
Date: Tue Sep  9 13:44:15 2014
New Revision: 1623822

URL: http://svn.apache.org/r1623822
Log:
On the log-message-templates branch, fix mishandling of relative or
unversioned paths in the commit target list.

* subversion/libsvn_client/commit_util.c
  (svn_client_get_log_message_templates): Make paths absolute before handing
   them off to svn_client_propget5(), else we'll run into an assert.
   If an unversioned path in the commit target list is found, which
   will happen during 'svn import', just skip it instead of erroring out.

Found by: basic_tests.py

Modified:
    subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c

Modified: subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c?rev=1623822&r1=1623821&r2=1623822&view=diff
==============================================================================
--- subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c (original)
+++ subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c Tue Sep
 9 13:44:15 2014
@@ -468,8 +468,8 @@ svn_client_get_log_message_templates(apr
     {
       const char *path_or_url =
         APR_ARRAY_IDX(paths_or_urls, i, const char *);
-      apr_hash_t *props;
-      apr_array_header_t *inherited_props;
+      apr_hash_t *props = NULL;
+      apr_array_header_t *inherited_props = NULL;
       const svn_string_t *propval = NULL;
       const char *defining_path_or_url = NULL;
       const char *defining_repos_relpath;
@@ -482,6 +482,10 @@ svn_client_get_log_message_templates(apr
         {
           svn_error_t *err;
 
+          if (!svn_path_is_url(path_or_url))
+            SVN_ERR(svn_dirent_get_absolute(&path_or_url,
+                                            path_or_url,
+                                            iterpool));
           err = svn_client_propget5(&props, &inherited_props,
                                     SVN_PROP_INHERITABLE_LOG_TEMPLATE,
                                     path_or_url,
@@ -493,28 +497,44 @@ svn_client_get_log_message_templates(apr
                                     ctx,
                                     iterpool, iterpool);
 
-          /* When adding new URLs we must query their nearest
-           * existing parent for log templates. */
-          if (err && svn_path_is_url(path_or_url) &&
-              err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
+          if (err && err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
             {
-              const char *repos_root_url;
-              const char *child_relpath;
-
-              SVN_ERR(svn_client_get_repos_root(&repos_root_url, NULL,
-                                                path_or_url, ctx,
-                                                iterpool, iterpool));
-
-              /* Check if we've already reached the repository root. */
-              child_relpath = svn_uri_skip_ancestor(repos_root_url,
-                                                    path_or_url,
-                                                    iterpool);
-              if (child_relpath && child_relpath[0] != '\0')
+              if (svn_path_is_url(path_or_url))
                 {
-                  /* We didn't reach the root yet, so step up. */
-                  path_or_url = svn_uri_dirname(path_or_url, scratch_pool);
-                  svn_error_clear(err);
-                  continue;
+                  /* When adding new URLs we must query their nearest
+                   * existing parent for log templates. */
+                  const char *repos_root_url;
+                  const char *child_relpath;
+
+                  SVN_ERR(svn_client_get_repos_root(&repos_root_url, NULL,
+                                                    path_or_url, ctx,
+                                                    iterpool, iterpool));
+
+                  /* Check if we've already reached the repository root. */
+                  child_relpath = svn_uri_skip_ancestor(repos_root_url,
+                                                        path_or_url,
+                                                        iterpool);
+                  if (child_relpath && child_relpath[0] != '\0')
+                    {
+                      /* We didn't reach the root yet, so step up. */
+                      path_or_url = svn_uri_dirname(path_or_url, scratch_pool);
+                      svn_error_clear(err);
+                      continue;
+                    }
+                  else
+                    return svn_error_trace(err);
+                }
+              else
+                return svn_error_trace(err);
+            }
+          else if (err && err->apr_err == SVN_ERR_UNVERSIONED_RESOURCE)
+            {
+              if (!svn_path_is_url(path_or_url))
+                {
+                  /* Unversioned paths in the commit target list are
+                   * possible during 'svn import'. Ignore them. */
+                   svn_error_clear(err);
+                   break;
                 }
               else
                 return svn_error_trace(err);
@@ -526,6 +546,9 @@ svn_client_get_log_message_templates(apr
           break;
         }
 
+      if (props == NULL && inherited_props == NULL)
+        continue;
+
       /* Check if the node itself has an svn:log-template property. */
       propval = svn_hash_gets(props, path_or_url);
       if (propval)



Mime
View raw message