subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1136474 - in /subversion/trunk/subversion: include/ libsvn_client/ libsvn_ra_local/ libsvn_subr/ libsvn_wc/ tests/libsvn_subr/
Date Thu, 16 Jun 2011 15:05:16 GMT
Author: julianfoad
Date: Thu Jun 16 15:05:15 2011
New Revision: 1136474

URL: http://svn.apache.org/viewvc?rev=1136474&view=rev
Log:
Make svn_uri_skip_ancestor() URI-decode its result, because that makes sense
for returning a relpath, and because that's what all current callers want,
and because that brings the semantics of this function and svn_uri_is_child()
one step closer together.

* subversion/include/svn_dirent_uri.h,
  subversion/libsvn_subr/dirent_uri.c
  (svn_uri_skip_ancestor): Decode the result. Add a result pool parameter.

* subversion/libsvn_client/commit.c
  (collect_lock_tokens): Don't decode the result after calling it.

* subversion/libsvn_client/commit_util.c
  (harvest_copy_committables): Same.

* subversion/libsvn_client/merge.c
  (merge_reintegrate_locked): Same.

* subversion/libsvn_client/util.c
  (svn_client__path_relative_to_root): Same.

* subversion/libsvn_ra_local/ra_plugin.c
  (reporter_link_path): Same.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc_add4): Same.

* subversion/libsvn_wc/update_editor.c
  (make_editor, svn_wc_add_repos_file4): Same.

* subversion/tests/libsvn_subr/dirent_uri-test.c
  (test_uri_skip_ancestor): Adjust the call.

Modified:
    subversion/trunk/subversion/include/svn_dirent_uri.h
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_client/util.c
    subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
    subversion/trunk/subversion/libsvn_subr/dirent_uri.c
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c

Modified: subversion/trunk/subversion/include/svn_dirent_uri.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_dirent_uri.h?rev=1136474&r1=1136473&r2=1136474&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_dirent_uri.h (original)
+++ subversion/trunk/subversion/include/svn_dirent_uri.h Thu Jun 16 15:05:15 2011
@@ -652,15 +652,17 @@ const char *
 svn_relpath_skip_ancestor(const char *parent_relpath,
                           const char *child_relpath);
 
-/** Return the relative path part of @a child_uri that is below
+/** Return the URI-decoded relative path of @a child_uri that is below
  * @a parent_uri, or just "" if @a parent_uri is equal to @a child_uri. If
  * @a child_uri is not below or equal to @a parent_uri, return NULL.
+ * Allocate the result in @a result_pool.
  *
  * @since New in 1.7.
  */
 const char *
 svn_uri_skip_ancestor(const char *parent_uri,
-                      const char *child_uri);
+                      const char *child_uri,
+                      apr_pool_t *result_pool);
 
 /** Find the common prefix of the canonicalized dirents in @a targets
  * (an array of <tt>const char *</tt>'s), and remove redundant dirents if @a

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1136474&r1=1136473&r2=1136474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Thu Jun 16 15:05:15 2011
@@ -906,8 +906,7 @@ collect_lock_tokens(apr_hash_t **result,
 
       if (svn_uri_is_ancestor(base_url, url))
         {
-          url = svn_path_uri_decode(svn_uri_skip_ancestor(base_url, url),
-                                    pool);
+          url = svn_uri_skip_ancestor(base_url, url, pool);
 
           apr_hash_set(*result, url, APR_HASH_KEY_STRING, token);
         }

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1136474&r1=1136473&r2=1136474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Thu Jun 16 15:05:15 2011
@@ -1123,10 +1123,8 @@ harvest_copy_committables(void *baton, v
                                       pair->src_abspath_or_url,
                                       pool, pool));
 
-  commit_relpath = svn_path_uri_decode(svn_uri_skip_ancestor(
-                                            repos_root_url,
-                                            pair->dst_abspath_or_url),
-                                       pool);
+  commit_relpath = svn_uri_skip_ancestor(repos_root_url,
+                                         pair->dst_abspath_or_url, pool);
 
   /* Handle this SRC. */
   SVN_ERR(harvest_committables(btn->ctx->wc_ctx,

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1136474&r1=1136473&r2=1136474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu Jun 16 15:05:15 2011
@@ -10453,9 +10453,8 @@ merge_reintegrate_locked(const char *sou
      (with regard to the WC). */
   rev1 = target_base_rev;
 
-  source_repos_rel_path = svn_uri_skip_ancestor(wc_repos_root, url2);
-  source_repos_rel_path = svn_path_uri_decode(source_repos_rel_path,
-                                              scratch_pool);
+  source_repos_rel_path = svn_uri_skip_ancestor(wc_repos_root, url2,
+                                                scratch_pool);
   SVN_ERR(svn_client__path_relative_to_root(&target_repos_rel_path,
                                             ctx->wc_ctx, target_abspath,
                                             wc_repos_root, FALSE, NULL,

Modified: subversion/trunk/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/util.c?rev=1136474&r1=1136473&r2=1136474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/util.c (original)
+++ subversion/trunk/subversion/libsvn_client/util.c Thu Jun 16 15:05:15 2011
@@ -146,10 +146,8 @@ svn_client__path_relative_to_root(const 
                                    "root URL '%s'"),
                                  abspath_or_url, repos_root);
 
-      repos_relpath = svn_path_uri_decode(
-                            svn_uri_skip_ancestor(repos_root,
-                                                  abspath_or_url),
-                            result_pool);
+      repos_relpath = svn_uri_skip_ancestor(repos_root, abspath_or_url,
+                                            result_pool);
     }
   else
     {

Modified: subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c?rev=1136474&r1=1136473&r2=1136474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c Thu Jun 16 15:05:15 2011
@@ -199,11 +199,11 @@ reporter_link_path(void *reporter_baton,
                                "'%s'"), url, rbaton->sess->repos_url);
 
   /* Skip the repos_url, but keep the last '/' to create an fspath */
-  fs_path = svn_uri_skip_ancestor(repos_url, url);
+  fs_path = svn_uri_skip_ancestor(repos_url, url, pool);
   if (fs_path[0] == '\0')
     fs_path = "/";  
   else
-    fs_path = svn_path_uri_decode(--fs_path, pool);  
+    fs_path = apr_pstrcat(pool, "/", fs_path, (char *)NULL);
 
   return svn_repos_link_path3(rbaton->report_baton, path, fs_path, revision,
                               depth, start_empty, lock_token, pool);

Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=1136474&r1=1136473&r2=1136474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Thu Jun 16 15:05:15 2011
@@ -1539,7 +1539,8 @@ svn_relpath_skip_ancestor(const char *pa
 
 const char *
 svn_uri_skip_ancestor(const char *parent_uri,
-                      const char *child_uri)
+                      const char *child_uri,
+                      apr_pool_t *result_pool)
 {
   apr_size_t len = strlen(parent_uri);
 
@@ -1553,7 +1554,7 @@ svn_uri_skip_ancestor(const char *parent
     return ""; /* parent_uri == child_uri */
 
   if (child_uri[len] == '/')
-    return child_uri + len + 1;
+    return svn_path_uri_decode(child_uri + len + 1, result_pool);
 
   return NULL;
 }

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1136474&r1=1136473&r2=1136474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Thu Jun 16 15:05:15 2011
@@ -1135,9 +1135,7 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
       else
         {
           const char *repos_relpath =
-            svn_path_uri_decode(svn_uri_skip_ancestor(repos_root_url,
-                                                      copyfrom_url),
-                                scratch_pool);
+            svn_uri_skip_ancestor(repos_root_url, copyfrom_url, scratch_pool);
 
           SVN_ERR(svn_wc__db_op_copy_dir(db, local_abspath,
                                          apr_hash_make(scratch_pool),

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1136474&r1=1136473&r2=1136474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Jun 16 15:05:15 2011
@@ -4495,8 +4495,7 @@ make_editor(svn_revnum_t *target_revisio
 
   if (switch_url)
     eb->switch_relpath =
-      svn_path_uri_decode(svn_uri_skip_ancestor(repos_root, switch_url),
-                          scratch_pool);
+      svn_uri_skip_ancestor(repos_root, switch_url, scratch_pool);
   else
     eb->switch_relpath = NULL;
 
@@ -5214,8 +5213,7 @@ svn_wc_add_repos_file4(svn_wc_context_t 
                                  copyfrom_url, original_root_url);
 
       original_repos_relpath =
-        svn_path_uri_decode(svn_uri_skip_ancestor(original_root_url,
-                                                  copyfrom_url), pool);
+        svn_uri_skip_ancestor(original_root_url, copyfrom_url, pool);
     }
   else
     {

Modified: subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1136474&r1=1136473&r2=1136474&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c Thu Jun 16 15:05:15 2011
@@ -1577,7 +1577,7 @@ test_uri_skip_ancestor(apr_pool_t *pool)
     {
       const char* retval;
 
-      retval = svn_uri_skip_ancestor(tests[i].path1, tests[i].path2);
+      retval = svn_uri_skip_ancestor(tests[i].path1, tests[i].path2, pool);
       if ((tests[i].result == NULL)
           ? (retval != NULL)
           : (retval == NULL || strcmp(tests[i].result, retval) != 0))



Mime
View raw message