You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2011/01/28 03:34:42 UTC

svn commit: r1064436 [2/3] - in /subversion/trunk: ./ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_fs_base/bdb/ subversion/libsvn_fs_fs/ subversion/libsvn_ra/ subversion/libsvn_ra_local/ subversion/libsvn_...

Modified: subversion/trunk/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/commit.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/commit.c Fri Jan 28 02:34:40 2011
@@ -41,6 +41,7 @@
 
 #include "svn_private_config.h"
 #include "private/svn_dep_compat.h"
+#include "private/svn_fspath.h"
 
 #include "ra_serf.h"
 #include "../libsvn_ra/ra_loader.h"
@@ -311,8 +312,7 @@ handle_checkout(serf_request_t *request,
       if (status)
         err = svn_error_compose_create(svn_error_wrap_apr(status, NULL), err);
 
-      ctx->resource_url = svn_ra_serf__uri_canonicalize(uri.path, pool,
-                                                        ctx->pool);
+      ctx->resource_url = svn_urlpath__canonicalize(uri.path, ctx->pool);
     }
 
   return err;
@@ -489,7 +489,7 @@ get_version_url(const char **checked_in_
       if (current_version)
         {
           *checked_in_url =
-            svn_ra_serf__uri_canonicalize(current_version->data, pool, pool);
+            svn_urlpath__canonicalize(current_version->data, pool);
           return SVN_NO_ERROR;
         }
     }
@@ -544,7 +544,7 @@ get_version_url(const char **checked_in_
                                  _("Path '%s' not present"),
                                  session->repos_url.path);
 
-      root_checkout = svn_ra_serf__uri_canonicalize(root_checkout, pool, pool);
+      root_checkout = svn_urlpath__canonicalize(root_checkout, pool);
     }
 
   *checked_in_url = svn_path_url_add_component2(root_checkout, relpath, pool);
@@ -1116,7 +1116,7 @@ setup_copy_dir_headers(serf_bucket_t *he
     {
       uri.path = (char *)svn_path_url_add_component2(
         dir->parent_dir->checkout->resource_url,
-        svn_uri_basename(dir->name, pool),
+        svn_relpath_basename(dir->name, pool),
         pool);
     }
   absolute_uri = apr_uri_unparse(pool, &uri, 0);
@@ -1506,7 +1506,8 @@ delete_entry(const char *path,
       /* Ensure our directory has been checked out */
       SVN_ERR(checkout_dir(dir));
       delete_target = svn_path_url_add_component2(dir->checkout->resource_url,
-                                                  svn_uri_basename(path, pool),
+                                                  svn_relpath_basename(path,
+                                                                       pool),
                                                   pool);
     }
 
@@ -1621,7 +1622,7 @@ add_directory(const char *path,
                                              path, dir->pool);
       mkcol_target = svn_path_url_add_component2(
                                parent->checkout->resource_url,
-                               svn_uri_basename(path, dir->pool),
+                               svn_relpath_basename(path, dir->pool),
                                dir->pool);
     }
 
@@ -1872,7 +1873,7 @@ add_file(const char *path,
 
       new_file->url =
         svn_path_url_add_component2(dir->checkout->resource_url,
-                                    svn_uri_basename(path, new_file->pool),
+                                    svn_relpath_basename(path, new_file->pool),
                                     new_file->pool);
     }
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/getlocks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/getlocks.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/getlocks.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/getlocks.c Fri Jan 28 02:34:40 2011
@@ -41,6 +41,7 @@
 #include "svn_time.h"
 
 #include "private/svn_dav_protocol.h"
+#include "private/svn_fspath.h"
 #include "svn_private_config.h"
 
 #include "ra_serf.h"
@@ -203,10 +204,10 @@ end_getlocks(svn_ra_serf__xml_parser_t *
       else if ((lock_ctx->requested_depth == svn_depth_files) ||
                (lock_ctx->requested_depth == svn_depth_immediates))
         {
-          const char *rel_uri = svn_uri_is_child(lock_ctx->path,
-                                                 info->lock->path,
-                                                 info->pool);
-          if (rel_uri && (svn_path_component_count(rel_uri) == 1))
+          const char *rel_path = svn_fspath__is_child(lock_ctx->path,
+                                                      info->lock->path,
+                                                      info->pool);
+          if (rel_path && (svn_path_component_count(rel_path) == 1))
             apr_hash_set(lock_ctx->hash, info->lock->path,
                          APR_HASH_KEY_STRING, info->lock);
         }

Modified: subversion/trunk/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/merge.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/merge.c Fri Jan 28 02:34:40 2011
@@ -40,6 +40,7 @@
 #include "svn_props.h"
 
 #include "private/svn_dav_protocol.h"
+#include "private/svn_fspath.h"
 #include "svn_private_config.h"
 
 #include "ra_serf.h"
@@ -297,7 +298,7 @@ end_merge(svn_ra_serf__xml_parser_t *par
           const char *href;
 
           href = apr_hash_get(info->props, "href", APR_HASH_KEY_STRING);
-          if (! svn_uri_is_ancestor(ctx->merge_url, href))
+          if (! svn_urlpath__is_ancestor(ctx->merge_url, href))
             {
               /* ### need something better than APR_EGENERAL */
               return svn_error_createf(APR_EGENERAL, NULL,
@@ -319,7 +320,7 @@ end_merge(svn_ra_serf__xml_parser_t *par
                  an ancestor of HREF.  All that remains is to
                  determine of HREF is the same as CTX->MERGE_URL, or --
                  if not -- is relative value as a child thereof. */
-              href = svn_uri_is_child(ctx->merge_url, href, NULL);
+              href = svn_urlpath__is_child(ctx->merge_url, href, NULL);
               if (! href)
                 href = "";
 
@@ -364,8 +365,8 @@ end_merge(svn_ra_serf__xml_parser_t *par
       info->prop_val = apr_pstrmemdup(info->pool, info->prop_val,
                                       info->prop_val_len);
       if (strcmp(info->prop_name, "href") == 0)
-        info->prop_val = svn_ra_serf__uri_canonicalize(info->prop_val, 
-                                                       info->pool, info->pool);
+        info->prop_val = svn_urlpath__canonicalize(info->prop_val,
+                                                       info->pool);
 
       /* Set our property. */
       apr_hash_set(info->props, info->prop_name, APR_HASH_KEY_STRING,
@@ -453,7 +454,7 @@ svn_ra_serf__merge_lock_token_list(apr_h
       path.data = key;
       path.len = klen;
 
-      if (parent && !svn_uri_is_ancestor(parent, key))
+      if (parent && !svn_relpath_is_ancestor(parent, key))
         continue;
 
       svn_ra_serf__add_open_tag_buckets(body, alloc, "S:lock", NULL);

Modified: subversion/trunk/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/options.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/options.c Fri Jan 28 02:34:40 2011
@@ -39,6 +39,7 @@
 #include "svn_version.h"
 #include "svn_dirent_uri.h"
 #include "svn_private_config.h"
+#include "private/svn_fspath.h"
 
 #include "ra_serf.h"
 
@@ -187,9 +188,7 @@ end_options(svn_ra_serf__xml_parser_t *p
     {
       options_ctx->collect_cdata = FALSE;
       options_ctx->activity_collection =
-        svn_ra_serf__uri_canonicalize(options_ctx->attr_val,
-                                      options_ctx->pool,
-                                      options_ctx->pool);
+        svn_urlpath__canonicalize(options_ctx->attr_val, options_ctx->pool);
       pop_state(options_ctx);
     }
 
@@ -338,11 +337,10 @@ capabilities_headers_iterator_callback(v
           orc->session->repos_root = orc->session->repos_url;
           orc->session->repos_root.path = apr_pstrdup(orc->session->pool, val);
           orc->session->repos_root_str =
-            svn_ra_serf__uri_canonicalize(
+            svn_urlpath__canonicalize(
                 apr_uri_unparse(orc->session->pool,
                                 &orc->session->repos_root,
                                 0),
-                orc->session->pool,
                 orc->session->pool);
         }
       else if (svn_cstring_casecmp(key, SVN_DAV_ME_RESOURCE_HEADER) == 0)

Modified: subversion/trunk/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/property.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/property.c Fri Jan 28 02:34:40 2011
@@ -32,6 +32,7 @@
 #include "svn_dirent_uri.h"
 
 #include "private/svn_dav_protocol.h"
+#include "private/svn_fspath.h"
 #include "svn_private_config.h"
 
 #include "ra_serf.h"
@@ -344,7 +345,7 @@ end_propfind(svn_ra_serf__xml_parser_t *
           if (strcmp(ctx->depth, "1") == 0)
             {
               ctx->current_path =
-                svn_ra_serf__uri_canonicalize(info->val, ctx->pool, ctx->pool);
+                svn_urlpath__canonicalize(info->val, ctx->pool);
             }
           else
             {
@@ -1034,8 +1035,7 @@ svn_ra_serf__get_baseline_info(const cha
                                         "the requested checked-in value"));
             }
 
-          baseline_url = svn_ra_serf__uri_canonicalize(baseline_url,
-                                                       pool, pool);
+          baseline_url = svn_urlpath__canonicalize(baseline_url, pool);
 
           SVN_ERR(svn_ra_serf__retrieve_props(props, session, conn,
                                               baseline_url, revision, "0",
@@ -1052,8 +1052,7 @@ svn_ra_serf__get_baseline_info(const cha
                                     "requested baseline-collection value"));
         }
 
-      basecoll_url = svn_ra_serf__uri_canonicalize(basecoll_url,
-                                                   pool, pool);
+      basecoll_url = svn_urlpath__canonicalize(basecoll_url, pool);
 
       if (latest_revnum)
         {

Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Fri Jan 28 02:34:40 2011
@@ -36,6 +36,7 @@
 #include "svn_delta.h"
 #include "svn_version.h"
 #include "svn_dav.h"
+#include "svn_dirent_uri.h"
 
 #include "private/svn_dav_protocol.h"
 
@@ -800,10 +801,6 @@ svn_ra_serf__response_get_location(serf_
  * URI-encoded identifier of *some sort*, as will be the returned form
  * thereof.
  */
-const char *
-svn_ra_serf__uri_canonicalize(const char *uri,
-                              apr_pool_t *scratch_pool,
-                              apr_pool_t *result_pool);
 
 /** XML helper functions. **/
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Fri Jan 28 02:34:40 2011
@@ -46,6 +46,7 @@
 
 #include "private/svn_dav_protocol.h"
 #include "private/svn_dep_compat.h"
+#include "private/svn_fspath.h"
 #include "svn_private_config.h"
 
 #include "ra_serf.h"
@@ -773,7 +774,8 @@ path_dirent_walker(void *baton,
 
       apr_hash_set(dirents->full_paths, path, path_len, entry);
 
-      base_name = svn_path_uri_decode(svn_uri_basename(path, pool), pool);
+      base_name = svn_path_uri_decode(svn_urlpath__basename(path, pool),
+                                      pool);
 
       apr_hash_set(dirents->base_paths, base_name, APR_HASH_KEY_STRING, entry);
     }
@@ -906,7 +908,7 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
        */
       dirent_walk.full_paths = apr_hash_make(pool);
       dirent_walk.base_paths = apr_hash_make(pool);
-      dirent_walk.orig_path = svn_ra_serf__uri_canonicalize(path, pool, pool);
+      dirent_walk.orig_path = svn_urlpath__canonicalize(path, pool);
 
       SVN_ERR(svn_ra_serf__walk_all_paths(props, revision, path_dirent_walker,
                                           &dirent_walk, pool));

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Fri Jan 28 02:34:40 2011
@@ -46,6 +46,7 @@
 
 #include "svn_private_config.h"
 #include "private/svn_dep_compat.h"
+#include "private/svn_fspath.h"
 
 #include "ra_serf.h"
 #include "../libsvn_ra/ra_loader.h"
@@ -1794,8 +1795,11 @@ end_report(svn_ra_serf__xml_parser_t *pa
       if (SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(ctx->sess))
         {
           const char *fs_path;
-          const char *full_path = svn_uri_join(ctx->sess->repos_url.path,
-                                               info->name, info->pool);
+          const char *full_path =
+            svn_fspath__join(ctx->sess->repos_url.path,
+                             svn_path_uri_encode(info->name, info->pool),
+                             info->pool);
+          
           SVN_ERR(svn_ra_serf__get_relative_path(&fs_path, full_path,
                                                  ctx->sess, NULL, info->pool));
           info->delta_base = svn_string_createf(info->pool, "%s/%ld/%s",

Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Fri Jan 28 02:34:40 2011
@@ -39,6 +39,7 @@
 #include "svn_string.h"
 #include "svn_xml.h"
 #include "private/svn_dep_compat.h"
+#include "private/svn_fspath.h"
 
 #include "ra_serf.h"
 
@@ -914,7 +915,7 @@ svn_ra_serf__response_get_location(serf_
 
   headers = serf_bucket_response_get_headers(response);
   val = serf_bucket_headers_get(headers, "Location");
-  return val ? svn_ra_serf__uri_canonicalize(val, pool, pool) : NULL;
+  return val ? svn_urlpath__canonicalize(val, pool) : NULL;
 }
 
 /* Implements svn_ra_serf__response_handler_t */
@@ -1745,7 +1746,7 @@ svn_ra_serf__discover_vcc(const char **v
                           apr_pool_t *pool)
 {
   apr_hash_t *props;
-  const char *path, *relative_path, *present_path = "", *uuid;
+  const char *path, *relative_path, *uuid;
 
   /* If we've already got the information our caller seeks, just return it.  */
   if (session->vcc_url && session->repos_root_str)
@@ -1800,14 +1801,13 @@ svn_ra_serf__discover_vcc(const char **v
               /* This happens when the file is missing in HEAD. */
               svn_error_clear(err);
 
-              /* Okay, strip off. */
-              present_path = svn_uri_join(svn_uri_basename(path, pool),
-                                          present_path, pool);
-              path = svn_uri_dirname(path, pool);
+              /* Okay, strip off a component from PATH. */
+              path = svn_urlpath__dirname(path, pool);
             }
         }
     }
-  while (!svn_path_is_empty(path));
+  while ((path[0] != '\0')
+         && (! (path[0] == '/') && (path[1] == '\0')));
 
   if (!*vcc_url)
     {
@@ -1837,9 +1837,9 @@ svn_ra_serf__discover_vcc(const char **v
       session->repos_root = session->repos_url;
       session->repos_root.path = apr_pstrdup(session->pool, url_buf->data);
       session->repos_root_str =
-        svn_ra_serf__uri_canonicalize(apr_uri_unparse(session->pool,
-                                                      &session->repos_root, 0),
-                                      pool, session->pool);
+        svn_urlpath__canonicalize(apr_uri_unparse(session->pool,
+                                                  &session->repos_root, 0),
+                                  session->pool);
     }
 
   /* Store the repository UUID in the cache. */
@@ -1884,7 +1884,7 @@ svn_ra_serf__get_relative_path(const cha
     }
   else
     {
-      *rel_path = svn_uri_is_child(decoded_root, decoded_orig, pool);
+      *rel_path = svn_urlpath__is_child(decoded_root, decoded_orig, pool);
       SVN_ERR_ASSERT(*rel_path != NULL);
     }
   return SVN_NO_ERROR;
@@ -1934,35 +1934,3 @@ svn_ra_serf__error_on_status(int status_
 
   return SVN_NO_ERROR;
 }
-
-
-static const char *
-relative_uri_normalize(const char *relpath,
-                       apr_pool_t *scratch_pool,
-                       apr_pool_t *result_pool)
-{
-  return svn_path_uri_encode(
-             svn_relpath_canonicalize(
-                 svn_path_uri_decode(relpath, scratch_pool),
-                 scratch_pool),
-             result_pool);
-}
-
-
-const char *
-svn_ra_serf__uri_canonicalize(const char *uri,
-                              apr_pool_t *scratch_pool,
-                              apr_pool_t *result_pool)
-{
-  if (svn_path_is_url(uri))
-    return svn_uri_canonicalize(uri, result_pool);
-
-  if (uri[0] == '/')
-    return apr_pstrcat(result_pool, "/", 
-                       relative_uri_normalize(uri + 1,
-                                              scratch_pool,
-                                              scratch_pool),
-                       NULL);
-  
-  return relative_uri_normalize(uri, scratch_pool, result_pool);
-}

Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Fri Jan 28 02:34:40 2011
@@ -47,6 +47,8 @@
 #include "svn_props.h"
 #include "svn_mergeinfo.h"
 
+#include "private/svn_fspath.h"
+
 #include "ra_svn.h"
 
 #ifdef SVN_HAVE_SASL
@@ -214,7 +216,7 @@ static svn_error_t *parse_lock(const apr
   SVN_ERR(svn_ra_svn_parse_tuple(list, pool, "ccc(?c)c(?c)", &(*lock)->path,
                                  &(*lock)->token, &(*lock)->owner,
                                  &(*lock)->comment, &cdate, &edate));
-  (*lock)->path = svn_uri_canonicalize((*lock)->path, pool);
+  (*lock)->path = svn_fspath__canonicalize((*lock)->path, pool);
   SVN_ERR(svn_time_from_cstring(&(*lock)->creation_date, cdate, pool));
   if (edate)
     SVN_ERR(svn_time_from_cstring(&(*lock)->expiration_date, edate, pool));
@@ -1139,7 +1141,7 @@ static svn_error_t *ra_svn_get_dir(svn_r
       SVN_ERR(svn_ra_svn_parse_tuple(elt->u.list, pool, "cwnbr(?c)(?c)",
                                      &name, &kind, &size, &has_props,
                                      &crev, &cdate, &cauthor));
-      name = svn_uri_canonicalize(name, pool);
+      name = svn_relpath_canonicalize(name, pool);
       dirent = apr_palloc(pool, sizeof(*dirent));
       dirent->kind = svn_node_kind_from_word(kind);
       dirent->size = size;/* FIXME: svn_filesize_t */
@@ -1464,9 +1466,9 @@ static svn_error_t *ra_svn_log(svn_ra_se
                                              &cpath, &action, &copy_path,
                                              &copy_rev, &kind_str,
                                              &text_mods, &prop_mods));
-              cpath = svn_uri_canonicalize(cpath, iterpool);
+              cpath = svn_fspath__canonicalize(cpath, iterpool);
               if (copy_path)
-                copy_path = svn_uri_canonicalize(copy_path, iterpool);
+                copy_path = svn_fspath__canonicalize(copy_path, iterpool);
               change = svn_log_changed_path2_create(iterpool);
               change->action = *action;
               change->copyfrom_path = copy_path;
@@ -1663,7 +1665,7 @@ static svn_error_t *ra_svn_get_locations
         {
           SVN_ERR(svn_ra_svn_parse_tuple(item->u.list, pool, "rc",
                                          &revision, &ret_path));
-          ret_path = svn_uri_canonicalize(ret_path, pool);
+          ret_path = svn_fspath__canonicalize(ret_path, pool);
           apr_hash_set(*locations, apr_pmemdup(pool, &revision,
                                                sizeof(revision)),
                        sizeof(revision), ret_path);
@@ -1725,7 +1727,7 @@ ra_svn_get_location_segments(svn_ra_sess
             return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                     _("Expected valid revision range"));
           if (ret_path)
-            ret_path = svn_uri_canonicalize(ret_path, iterpool);
+            ret_path = svn_relpath_canonicalize(ret_path, iterpool);
           segment->path = ret_path;
           segment->range_start = range_start;
           segment->range_end = range_end;
@@ -1793,7 +1795,7 @@ static svn_error_t *ra_svn_get_file_revs
       SVN_ERR(svn_ra_svn_parse_tuple(item->u.list, rev_pool,
                                      "crll?B", &p, &rev, &rev_proplist,
                                      &proplist, &merged_rev_param));
-      p = svn_uri_canonicalize(p, rev_pool);
+      p = svn_fspath__canonicalize(p, rev_pool);
       SVN_ERR(svn_ra_svn_parse_proplist(rev_proplist, rev_pool, &rev_props));
       SVN_ERR(parse_prop_diffs(proplist, rev_pool, &props));
       if (merged_rev_param == SVN_RA_SVN_UNSPECIFIED_NUMBER)
@@ -2280,7 +2282,6 @@ static svn_error_t *path_relative_to_roo
                                  _("'%s' isn't a child of repository root "
                                    "URL '%s'"),
                                  url, root_url);
-      *rel_path = svn_path_uri_decode(*rel_path, pool);
     }
   return SVN_NO_ERROR;
 }
@@ -2294,13 +2295,13 @@ static svn_error_t *ra_svn_get_locks(svn
   svn_ra_svn__session_baton_t *sess = session->priv;
   svn_ra_svn_conn_t* conn = sess->conn;
   apr_array_header_t *list;
-  const char *abs_path;
+  const char *full_url, *abs_path;
   int i;
 
   /* Figure out the repository abspath from PATH. */
-  abs_path = svn_path_url_add_component2(sess->url, path, pool);
-  SVN_ERR(path_relative_to_root(session, &abs_path, abs_path, pool));
-  abs_path = apr_pstrcat(pool, "/", abs_path, (char *)NULL);
+  full_url = svn_path_url_add_component2(sess->url, path, pool);
+  SVN_ERR(path_relative_to_root(session, &abs_path, full_url, pool));
+  abs_path = svn_fspath__canonicalize(abs_path, pool);
 
   SVN_ERR(svn_ra_svn_write_cmd(conn, pool, "get-locks", "c(w)", path,
                                svn_depth_to_word(depth)));
@@ -2340,8 +2341,8 @@ static svn_error_t *ra_svn_get_locks(svn
         }
       else if ((depth == svn_depth_files) || (depth == svn_depth_immediates))
         {
-          const char *rel_uri = svn_uri_is_child(abs_path, lock->path, pool);
-          if (rel_uri && (svn_path_component_count(rel_uri) == 1))
+          const char *relpath = svn_fspath__is_child(abs_path, lock->path, pool);
+          if (relpath && (svn_path_component_count(relpath) == 1))
             apr_hash_set(*locks, lock->path, APR_HASH_KEY_STRING, lock);
         }
     }

Modified: subversion/trunk/subversion/libsvn_ra_svn/editorp.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/editorp.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/editorp.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/editorp.c Fri Jan 28 02:34:40 2011
@@ -34,9 +34,12 @@
 #include "svn_delta.h"
 #include "svn_dirent_uri.h"
 #include "svn_ra_svn.h"
+#include "svn_path.h"
 #include "svn_pools.h"
 #include "svn_private_config.h"
 
+#include "private/svn_fspath.h"
+
 #include "ra_svn.h"
 
 /*
@@ -500,7 +503,7 @@ static svn_error_t *ra_svn_handle_delete
 
   SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c(?r)c", &path, &rev, &token));
   SVN_ERR(lookup_token(ds, token, FALSE, &entry));
-  path = svn_uri_canonicalize(path, pool);
+  path = svn_relpath_canonicalize(path, pool);
   SVN_CMD_ERR(ds->editor->delete_entry(path, rev, entry->baton, pool));
   return SVN_NO_ERROR;
 }
@@ -520,9 +523,18 @@ static svn_error_t *ra_svn_handle_add_di
                                  &child_token, &copy_path, &copy_rev));
   SVN_ERR(lookup_token(ds, token, FALSE, &entry));
   subpool = svn_pool_create(entry->pool);
-  path = svn_uri_canonicalize(path, pool);
+  path = svn_relpath_canonicalize(path, pool);
+
+  /* Some operations pass COPY_PATH as a full URL (commits, etc.).
+     Others (replay, e.g.) deliver an fspath.  That's ... annoying. */
   if (copy_path)
-    copy_path = svn_uri_canonicalize(copy_path, pool);
+    {
+      if (svn_path_is_url(copy_path))
+        copy_path = svn_uri_canonicalize(copy_path, pool);
+      else
+        copy_path = svn_fspath__canonicalize(copy_path, pool);
+    }
+
   SVN_CMD_ERR(ds->editor->add_directory(path, entry->baton, copy_path,
                                         copy_rev, subpool, &child_baton));
   store_token(ds, child_baton, child_token, FALSE, subpool);
@@ -544,7 +556,7 @@ static svn_error_t *ra_svn_handle_open_d
                                  &child_token, &rev));
   SVN_ERR(lookup_token(ds, token, FALSE, &entry));
   subpool = svn_pool_create(entry->pool);
-  path = svn_uri_canonicalize(path, pool);
+  path = svn_relpath_canonicalize(path, pool);
   SVN_CMD_ERR(ds->editor->open_directory(path, entry->baton, rev, subpool,
                                          &child_baton));
   store_token(ds, child_baton, child_token, FALSE, subpool);
@@ -618,9 +630,18 @@ static svn_error_t *ra_svn_handle_add_fi
                                  &file_token, &copy_path, &copy_rev));
   SVN_ERR(lookup_token(ds, token, FALSE, &entry));
   ds->file_refs++;
-  path = svn_uri_canonicalize(path, pool);
+  path = svn_relpath_canonicalize(path, pool);
+
+  /* Some operations pass COPY_PATH as a full URL (commits, etc.).
+     Others (replay, e.g.) deliver an fspath.  That's ... annoying. */
   if (copy_path)
-    copy_path = svn_uri_canonicalize(copy_path, pool);
+    {
+      if (svn_path_is_url(copy_path))
+        copy_path = svn_uri_canonicalize(copy_path, pool);
+      else
+        copy_path = svn_fspath__canonicalize(copy_path, pool);
+    }
+
   file_entry = store_token(ds, NULL, file_token, TRUE, ds->file_pool);
   SVN_CMD_ERR(ds->editor->add_file(path, entry->baton, copy_path, copy_rev,
                                    ds->file_pool, &file_entry->baton));
@@ -640,7 +661,7 @@ static svn_error_t *ra_svn_handle_open_f
                                  &file_token, &rev));
   SVN_ERR(lookup_token(ds, token, FALSE, &entry));
   ds->file_refs++;
-  path = svn_uri_canonicalize(path, pool);
+  path = svn_relpath_canonicalize(path, pool);
   file_entry = store_token(ds, NULL, file_token, TRUE, ds->file_pool);
   SVN_CMD_ERR(ds->editor->open_file(path, entry->baton, rev, ds->file_pool,
                                     &file_entry->baton));

Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Fri Jan 28 02:34:40 2011
@@ -97,13 +97,13 @@ internal_style(path_type_t type, const c
 
   switch (type)
     {
-      case type_dirent:
-        return svn_dirent_canonicalize(path, pool);
+      case type_uri:
+        return svn_uri_canonicalize(path, pool);
       case type_relpath:
         return svn_relpath_canonicalize(path, pool);
-      case type_uri:
+      case type_dirent:
       default:
-        return svn_uri_canonicalize(path, pool);
+        return svn_dirent_canonicalize(path, pool);
     }
 }
 
@@ -364,15 +364,21 @@ canonicalize(path_type_t type, const cha
   /* "" is already canonical, so just return it; note that later code
      depends on path not being zero-length.  */
   if (SVN_PATH_IS_EMPTY(path))
-    return "";
+    {
+      assert(type != type_uri);
+      return "";
+    }
 
   dst = canon = apr_pcalloc(pool, strlen(path) + 1);
 
-  /* If this is supposed to be an URI and it starts with "scheme://", then
-     copy the scheme, host name, etc. to DST and set URL = TRUE. */
+  /* If this is supposed to be an URI, it should start with
+     "scheme://".  We'll copy the scheme, host name, etc. to DST and
+     set URL = TRUE. */
   src = path;
-  if (type == type_uri && *src != '/')
+  if (type == type_uri)
     {
+      assert(*src != '/');
+        
       while (*src && (*src != '/') && (*src != ':'))
         src++;
 
@@ -786,7 +792,7 @@ is_child(path_type_t type, const char *p
         return NULL;
 
       /* check if this is an absolute path */
-      if ((type == type_uri && svn_uri_is_absolute(path2)) ||
+      if ((type == type_uri) ||
           (type == type_dirent && dirent_is_rooted(path2)))
         return NULL;
       else
@@ -872,8 +878,9 @@ is_ancestor(path_type_t type, const char
        case type_relpath:
          return TRUE;
        case type_uri:
+         return FALSE;
        default:
-         return !svn_uri_is_absolute(path2);
+         return path2[0] != '/';
      }
 
   /* If path1 is a prefix of path2, then:
@@ -971,12 +978,7 @@ svn_dirent_is_root(const char *dirent, a
 svn_boolean_t
 svn_uri_is_root(const char *uri, apr_size_t len)
 {
-  /* directory is root if it's equal to '/' */
-  if (len == 1 && uri[0] == '/')
-    return TRUE;
-  else if (len == 0)
-    return FALSE;
-
+  assert(svn_uri_is_canonical(uri, NULL));
   return (len == uri_schema_root_length(uri, len));
 }
 
@@ -1214,55 +1216,6 @@ svn_relpath_join(const char *base,
 }
 
 char *
-svn_uri_join(const char *base, const char *component, apr_pool_t *pool)
-{
-  apr_size_t blen = strlen(base);
-  apr_size_t clen = strlen(component);
-  char *path;
-
-  assert(svn_uri_is_canonical(base, pool));
-  assert(svn_uri_is_canonical(component, pool));
-
-  /* If either is empty return the other */
-  if (SVN_PATH_IS_EMPTY(base))
-    return apr_pmemdup(pool, component, clen + 1);
-  if (SVN_PATH_IS_EMPTY(component))
-    return apr_pmemdup(pool, base, blen + 1);
-
-  /* If the component is absolute, then return it.  */
-  if (svn_uri_is_absolute(component))
-    {
-      if (*component != '/')
-        return apr_pmemdup(pool, component, clen + 1);
-      else
-        {
-          /* The uri is not absolute enough; use only the root from base */
-          apr_size_t n = uri_schema_root_length(base, blen);
-
-          path = apr_palloc(pool, n + clen + 1);
-
-          if (n > 0)
-            memcpy(path, base, n);
-
-          memcpy(path + n, component, clen + 1); /* Include '\0' */
-
-          return path;
-        }
-    }
-
-  if (blen == 1 && base[0] == '/')
-    blen = 0; /* Ignore base, just return separator + component */
-
-  /* Construct the new, combined path. */
-  path = apr_palloc(pool, blen + 1 + clen + 1);
-  memcpy(path, base, blen);
-  path[blen] = '/';
-  memcpy(path + blen + 1, component, clen + 1);
-
-  return path;
-}
-
-char *
 svn_dirent_dirname(const char *dirent, apr_pool_t *pool)
 {
   apr_size_t len = strlen(dirent);
@@ -1381,6 +1334,7 @@ svn_uri_basename(const char *uri, apr_po
 {
   apr_size_t len = strlen(uri);
   apr_size_t start;
+  const char *base_name;
 
   assert(svn_uri_is_canonical(uri, NULL));
 
@@ -1394,9 +1348,11 @@ svn_uri_basename(const char *uri, apr_po
     }
 
   if (pool)
-    return apr_pstrmemdup(pool, uri + start, len - start);
+    base_name = apr_pstrmemdup(pool, uri + start, len - start);
   else
-    return uri + start;
+    base_name = uri + start;
+
+  return svn_path_uri_decode(base_name, pool);
 }
 
 void
@@ -1442,56 +1398,39 @@ svn_uri_get_longest_ancestor(const char 
                              const char *uri2,
                              apr_pool_t *pool)
 {
-  svn_boolean_t uri1_is_url, uri2_is_url;
-  uri1_is_url = svn_path_is_url(uri1);
-  uri2_is_url = svn_path_is_url(uri2);
-
-  if (uri1_is_url && uri2_is_url)
-    {
-      apr_size_t uri_ancestor_len;
-      apr_size_t i = 0;
-
-      /* Find ':' */
-      while (1)
-        {
-          /* No shared protocol => no common prefix */
-          if (uri1[i] != uri2[i])
-            return apr_pmemdup(pool, SVN_EMPTY_PATH,
-                               sizeof(SVN_EMPTY_PATH));
-
-          if (uri1[i] == ':')
-            break;
+  apr_size_t uri_ancestor_len;
+  apr_size_t i = 0;
 
-          /* They're both URLs, so EOS can't come before ':' */
-          assert((uri1[i] != '\0') && (uri2[i] != '\0'));
+  assert(svn_path_is_canonical(uri1, NULL));
+  assert(svn_path_is_canonical(uri2, NULL));
 
-          i++;
-        }
+  /* Find ':' */
+  while (1)
+    {
+      /* No shared protocol => no common prefix */
+      if (uri1[i] != uri2[i])
+        return apr_pmemdup(pool, SVN_EMPTY_PATH,
+                           sizeof(SVN_EMPTY_PATH));
 
-      i += 3;  /* Advance past '://' */
+      if (uri1[i] == ':')
+        break;
 
-      uri_ancestor_len = get_longest_ancestor_length(type_uri, uri1 + i,
-                                                     uri2 + i, pool);
+      /* They're both URLs, so EOS can't come before ':' */
+      assert((uri1[i] != '\0') && (uri2[i] != '\0'));
 
-      if (uri_ancestor_len == 0 ||
-          (uri_ancestor_len == 1 && (uri1 + i)[0] == '/'))
-        return apr_pmemdup(pool, SVN_EMPTY_PATH, sizeof(SVN_EMPTY_PATH));
-      else
-        return apr_pstrndup(pool, uri1, uri_ancestor_len + i);
+      i++;
     }
 
-  else if ((! uri1_is_url) && (! uri2_is_url))
-    {
-      return apr_pstrndup(pool, uri1,
-                          get_longest_ancestor_length(type_uri, uri1, uri2,
-                                                      pool));
-    }
+  i += 3;  /* Advance past '://' */
+
+  uri_ancestor_len = get_longest_ancestor_length(type_uri, uri1 + i,
+                                                 uri2 + i, pool);
 
+  if (uri_ancestor_len == 0 ||
+      (uri_ancestor_len == 1 && (uri1 + i)[0] == '/'))
+    return apr_pmemdup(pool, SVN_EMPTY_PATH, sizeof(SVN_EMPTY_PATH));
   else
-    {
-      /* A URL and a non-URL => no common prefix */
-      return apr_pmemdup(pool, SVN_EMPTY_PATH, sizeof(SVN_EMPTY_PATH));
-    }
+    return apr_pstrndup(pool, uri1, uri_ancestor_len + i);
 }
 
 const char *
@@ -1518,7 +1457,15 @@ svn_uri_is_child(const char *parent_uri,
                  const char *child_uri,
                  apr_pool_t *pool)
 {
-  return is_child(type_uri, parent_uri, child_uri, pool);
+  const char *relpath;
+
+  assert(svn_uri_is_canonical(parent_uri, NULL));
+  assert(svn_uri_is_canonical(child_uri, NULL));
+
+  relpath = is_child(type_uri, parent_uri, child_uri, pool);
+  if (relpath)
+    relpath = svn_path_uri_decode(relpath, pool);
+  return relpath;
 }
 
 svn_boolean_t
@@ -1539,6 +1486,9 @@ svn_relpath_is_ancestor(const char *pare
 svn_boolean_t
 svn_uri_is_ancestor(const char *parent_uri, const char *child_uri)
 {
+  assert(svn_uri_is_canonical(parent_uri, NULL));
+  assert(svn_uri_is_canonical(child_uri, NULL));
+
   return is_ancestor(type_uri, parent_uri, child_uri);
 }
 
@@ -1601,6 +1551,9 @@ svn_uri_skip_ancestor(const char *parent
 {
   apr_size_t len = strlen(parent_uri);
 
+  assert(svn_uri_is_canonical(parent_uri, NULL));
+  assert(svn_uri_is_canonical(child_uri, NULL));
+
   if (0 != memcmp(parent_uri, child_uri, len))
     return child_uri; /* parent_uri is no ancestor of child_uri */
 
@@ -1642,17 +1595,6 @@ svn_dirent_is_absolute(const char *diren
   return FALSE;
 }
 
-svn_boolean_t
-svn_uri_is_absolute(const char *uri)
-{
-  /* uri is absolute if it starts with '/' */
-  if (uri && uri[0] == '/')
-    return TRUE;
-
-  /* URLs are absolute. */
-  return svn_path_is_url(uri);
-}
-
 svn_error_t *
 svn_dirent_get_absolute(const char **pabsolute,
                         const char *relative,
@@ -1815,65 +1757,60 @@ svn_uri_is_canonical(const char *uri, ap
   const char *schema_data = NULL;
 
   /* URI is canonical if it has:
-   *  - no '.' segments
-   *  - no closing '/', unless for the root path '/' itself
-   *  - no '//'
    *  - lowercase URL scheme
    *  - lowercase URL hostname
+   *  - no '.' segments
+   *  - no closing '/'
+   *  - no '//'
    *  - uppercase hex-encoded pair digits ("%AB", not "%ab")
    */
 
   if (*uri == '\0')
-    return TRUE;
+    return FALSE;
 
-  /* Maybe parse hostname and scheme. */
-  if (*ptr != '/')
-    {
-      while (*ptr && (*ptr != '/') && (*ptr != ':'))
-        ptr++;
+  if (! svn_path_is_url(uri))
+    return FALSE;
 
-      if (*ptr == ':' && *(ptr+1) == '/' && *(ptr+2) == '/')
-        {
-          /* Found a scheme, check that it's all lowercase. */
-          ptr = uri;
-          while (*ptr != ':')
-            {
-              if (*ptr >= 'A' && *ptr <= 'Z')
-                return FALSE;
-              ptr++;
-            }
-          /* Skip :// */
-          ptr += 3;
+  /* Skip the scheme. */
+  while (*ptr && (*ptr != '/') && (*ptr != ':'))
+    ptr++;
 
-          /* This might be the hostname */
-          seg = ptr;
-          while (*ptr && (*ptr != '/') && (*ptr != '@'))
-            ptr++;
-
-          if (! *ptr)
-            return TRUE;
-
-          if (*ptr == '@')
-            seg = ptr + 1;
-
-          /* Found a hostname, check that it's all lowercase. */
-          ptr = seg;
-          while (*ptr && *ptr != '/')
-            {
-              if (*ptr >= 'A' && *ptr <= 'Z')
-                return FALSE;
-              ptr++;
-            }
+  /* No scheme?  No good. */
+  if (! (*ptr == ':' && *(ptr+1) == '/' && *(ptr+2) == '/'))
+    return FALSE;
 
-          schema_data = ptr;
-        }
-      else
-        {
-          /* Didn't find a scheme; finish the segment. */
-          while (*ptr && *ptr != '/')
-            ptr++;
-        }
+  /* Found a scheme, check that it's all lowercase. */
+  ptr = uri;
+  while (*ptr != ':')
+    {
+      if (*ptr >= 'A' && *ptr <= 'Z')
+        return FALSE;
+      ptr++;
+    }
+  /* Skip :// */
+  ptr += 3;
+
+  /* Scheme only?  That works. */
+  if (! *ptr)
+    return TRUE;
+
+  /* This might be the hostname */
+  seg = ptr;
+  while (*ptr && (*ptr != '/') && (*ptr != '@'))
+    ptr++;
+
+  if (*ptr == '@')
+    seg = ptr + 1;
+
+  /* Found a hostname, check that it's all lowercase. */
+  ptr = seg;
+  while (*ptr && *ptr != '/')
+    {
+      if (*ptr >= 'A' && *ptr <= 'Z')
+        return FALSE;
+      ptr++;
     }
+  schema_data = ptr;
 
 #ifdef SVN_USE_DOS_PATHS
   if (schema_data && *ptr == '/')
@@ -1914,38 +1851,35 @@ svn_uri_is_canonical(const char *uri, ap
         ptr++;
     }
 
-  if (schema_data)
-    {
-      ptr = schema_data;
+  ptr = schema_data;
 
-      while (*ptr)
+  while (*ptr)
+    {
+      if (*ptr == '%')
         {
-          if (*ptr == '%')
-            {
-              char digitz[3];
-              int val;
-
-              /* Can't usesvn_ctype_isxdigit() because lower case letters are
-                 not in our canonical format */
-              if (((*(ptr+1) < '0' || *(ptr+1) > '9'))
-                  && (*(ptr+1) < 'A' || *(ptr+1) > 'F'))
-                return FALSE;
-              else if (((*(ptr+2) < '0' || *(ptr+2) > '9'))
-                  && (*(ptr+2) < 'A' || *(ptr+2) > 'F'))
-                return FALSE;
+          char digitz[3];
+          int val;
 
-              digitz[0] = *(++ptr);
-              digitz[1] = *(++ptr);
-              digitz[2] = '\0';
-              val = (int)strtol(digitz, NULL, 16);
+          /* Can't usesvn_ctype_isxdigit() because lower case letters are
+             not in our canonical format */
+          if (((*(ptr+1) < '0' || *(ptr+1) > '9'))
+              && (*(ptr+1) < 'A' || *(ptr+1) > 'F'))
+            return FALSE;
+          else if (((*(ptr+2) < '0' || *(ptr+2) > '9'))
+                   && (*(ptr+2) < 'A' || *(ptr+2) > 'F'))
+            return FALSE;
+          
+          digitz[0] = *(++ptr);
+          digitz[1] = *(++ptr);
+          digitz[2] = '\0';
+          val = (int)strtol(digitz, NULL, 16);
 
-              if (svn_uri__char_validity[val])
-                return FALSE; /* Should not have been escaped */
-            }
-          else if (*ptr != '/' && !svn_uri__char_validity[(unsigned char)*ptr])
-            return FALSE; /* Character should have been escaped */
-          ptr++;
+          if (svn_uri__char_validity[val])
+            return FALSE; /* Should not have been escaped */
         }
+      else if (*ptr != '/' && !svn_uri__char_validity[(unsigned char)*ptr])
+        return FALSE; /* Character should have been escaped */
+      ptr++;
     }
 
   return TRUE;
@@ -2174,8 +2108,13 @@ svn_uri_condense_targets(const char **pc
                            scratch_pool);
       APR_ARRAY_PUSH(uri_targets, const char *) = uri;
 
-      *pcommon = svn_uri_get_longest_ancestor(*pcommon, uri,
-                                              scratch_pool);
+      /* If the commonmost ancestor so far is empty, there's no point
+         in continuing to search for a common ancestor at all.  But
+         we'll keep looping for the sake of canonicalizing the
+         targets, I suppose.  */
+      if (**pcommon != '\0')
+        *pcommon = svn_uri_get_longest_ancestor(*pcommon, uri,
+                                                scratch_pool);
     }
 
   *pcommon = apr_pstrdup(result_pool, *pcommon);
@@ -2280,7 +2219,7 @@ svn_uri_condense_targets(const char **pc
             }
 
           APR_ARRAY_PUSH(*pcondensed_targets, const char *)
-            = apr_pstrdup(result_pool, rel_item);
+            = svn_path_uri_decode(rel_item, result_pool);
         }
     }
 
@@ -2333,7 +2272,6 @@ svn_uri_get_dirent_from_file_url(const c
   const char *hostname, *path;
 
   SVN_ERR_ASSERT(svn_uri_is_canonical(url, pool));
-  SVN_ERR_ASSERT(svn_path_is_url(url));
 
   /* Verify that the URL is well-formed (loosely) */
 
@@ -2470,7 +2408,8 @@ svn_uri_get_file_url_from_dirent(const c
 }
 
 
-/* ------------------------ The fspath API ------------------------ */
+
+/* -------------- The fspath API (see private/svn_fspath.h) -------------- */
 
 svn_boolean_t
 svn_fspath__is_canonical(const char *fspath)
@@ -2480,6 +2419,25 @@ svn_fspath__is_canonical(const char *fsp
 
 
 const char *
+svn_fspath__canonicalize(const char *fspath,
+                         apr_pool_t *pool)
+{
+  if ((fspath[0] == '/') && (fspath[1] == '\0'))
+    return "/";
+
+  return apr_pstrcat(pool, "/", svn_relpath_canonicalize(fspath, pool), NULL);
+}
+
+
+svn_boolean_t
+svn_fspath__is_root(const char *fspath, apr_size_t len)
+{
+  /* directory is root if it's equal to '/' */
+  return (len == 1 && fspath[0] == '/');
+}
+
+
+const char *
 svn_fspath__is_child(const char *parent_fspath,
                      const char *child_fspath,
                      apr_pool_t *pool)
@@ -2488,11 +2446,7 @@ svn_fspath__is_child(const char *parent_
   assert(svn_fspath__is_canonical(parent_fspath));
   assert(svn_fspath__is_canonical(child_fspath));
 
-#ifdef FSPATH_USE_URI
-  result = svn_uri_is_child(parent_fspath, child_fspath, pool);
-#else
   result = svn_relpath_is_child(parent_fspath + 1, child_fspath + 1, pool);
-#endif
 
   assert(result == NULL || svn_relpath_is_canonical(result, pool));
   return result;
@@ -2506,14 +2460,10 @@ svn_fspath__skip_ancestor(const char *pa
   assert(svn_fspath__is_canonical(parent_fspath));
   assert(svn_fspath__is_canonical(child_fspath));
 
-#ifdef FSPATH_USE_URI
-  result = svn_uri_skip_ancestor(parent_fspath, child_fspath);
-#else
   if (svn_relpath_is_ancestor(parent_fspath + 1, child_fspath + 1))
     result = svn_relpath_skip_ancestor(parent_fspath + 1, child_fspath + 1);
   else
     result = child_fspath;
-#endif
 
   assert(svn_relpath_is_canonical(result, NULL)
          || strcmp(result, child_fspath) == 0);
@@ -2527,11 +2477,7 @@ svn_fspath__is_ancestor(const char *pare
   assert(svn_fspath__is_canonical(parent_fspath));
   assert(svn_fspath__is_canonical(child_fspath));
 
-#ifdef FSPATH_USE_URI
-  return svn_uri_is_ancestor(parent_fspath, child_fspath);
-#else
   return svn_relpath_is_ancestor(parent_fspath + 1, child_fspath + 1);
-#endif
 }
 
 
@@ -2542,12 +2488,8 @@ svn_fspath__dirname(const char *fspath,
   const char *result;
   assert(svn_fspath__is_canonical(fspath));
 
-#ifdef FSPATH_USE_URI
-  result = svn_uri_dirname(fspath, pool);
-#else
   result = apr_pstrcat(pool, "/", svn_relpath_dirname(fspath + 1, pool),
                        (char *)NULL);
-#endif
 
   assert(svn_fspath__is_canonical(result));
   return result;
@@ -2561,11 +2503,7 @@ svn_fspath__basename(const char *fspath,
   const char *result;
   assert(svn_fspath__is_canonical(fspath));
 
-#ifdef FSPATH_USE_URI
-  result = svn_uri_basename(fspath, pool);
-#else
   result = svn_relpath_basename(fspath + 1, pool);
-#endif
 
   assert(strchr(result, '/') == NULL);
   return result;
@@ -2595,16 +2533,12 @@ svn_fspath__join(const char *fspath,
   assert(svn_fspath__is_canonical(fspath));
   assert(svn_relpath_is_canonical(relpath, result_pool));
 
-#ifdef FSPATH_USE_URI
-  result = svn_uri_join(fspath, relpath, result_pool);
-#else
   if (relpath[0] == '\0')
     result = apr_pstrdup(result_pool, fspath);
   else if (fspath[1] == '\0')
     result = apr_pstrcat(result_pool, "/", relpath, (char *)NULL);
   else
     result = apr_pstrcat(result_pool, fspath, "/", relpath, (char *)NULL);
-#endif
 
   assert(svn_fspath__is_canonical(result));
   return result;
@@ -2619,16 +2553,35 @@ svn_fspath__get_longest_ancestor(const c
   assert(svn_fspath__is_canonical(fspath1));
   assert(svn_fspath__is_canonical(fspath2));
 
-#ifdef FSPATH_USE_URI
-  result = svn_uri_get_longest_ancestor(fspath1, fspath2, result_pool);
-#else
   result = apr_pstrcat(result_pool, "/",
                        svn_relpath_get_longest_ancestor(fspath1 + 1,
                                                         fspath2 + 1,
                                                         result_pool),
                        NULL);
-#endif
 
   assert(svn_fspath__is_canonical(result));
   return result;
 }
+
+
+
+
+/* -------------- The urlpath API (see private/svn_fspath.h) ------------- */
+
+const char *
+svn_urlpath__canonicalize(const char *uri,
+                          apr_pool_t *pool)
+{
+  if (svn_path_is_url(uri))
+    {
+      uri = svn_uri_canonicalize(uri, pool);
+    }
+  else
+    {
+      uri = svn_fspath__canonicalize(uri, pool);
+      /* Do a little dance to normalize hex encoding. */
+      uri = svn_path_uri_decode(uri, pool);
+      uri = svn_path_uri_encode(uri, pool);
+    }
+  return uri;
+}

Modified: subversion/trunk/subversion/libsvn_subr/subst.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/subst.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/subst.c (original)
+++ subversion/trunk/subversion/libsvn_subr/subst.c Fri Jan 28 02:34:40 2011
@@ -171,10 +171,9 @@ keyword_printf(const char *fmt,
             svn_stringbuf_appendcstr(value, author);
           break;
         case 'b': /* basename of this file */
-          if (url)
+          if (url && *url)
             {
-              const char *base_name
-                = svn_path_uri_decode(svn_uri_basename(url, pool), pool);
+              const char *base_name = svn_uri_basename(url, pool);
               svn_stringbuf_appendcstr(value, base_name);
             }
           break;

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Fri Jan 28 02:34:40 2011
@@ -607,8 +607,6 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
   repos_relpath = svn_uri_is_child(repos_root_url, url, scratch_pool);
   if (repos_relpath == NULL)
     repos_relpath = "";
-  else
-    repos_relpath = svn_path_uri_decode(repos_relpath, scratch_pool);
 
   /* Early out: we know we're not dealing with an existing wc, so
      just create one. */
@@ -685,8 +683,9 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
                                 _("URL '%s' doesn't match existing "
                                   "URL '%s' in '%s'"),
                                 url,
-                                svn_uri_join(db_repos_root_url,
-                                             db_repos_relpath, scratch_pool),
+                                svn_path_url_add_component2(db_repos_root_url,
+                                                            db_repos_relpath,
+                                                            scratch_pool),
                                 local_abspath);
         }
     }

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Fri Jan 28 02:34:40 2011
@@ -1042,8 +1042,7 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
 
   /* If we're performing a repos-to-WC copy, check that the copyfrom
      repository is the same as the parent dir's repository. */
-  if (copyfrom_url
-      && !svn_uri_is_ancestor(repos_root_url, copyfrom_url))
+  if (copyfrom_url && !svn_uri_is_ancestor(repos_root_url, copyfrom_url))
     return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
                              _("The URL '%s' has a different repository "
                                "root than its parent"), copyfrom_url);
@@ -1120,19 +1119,23 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
                                          scratch_pool));
         }
       else
-        SVN_ERR(svn_wc__db_op_copy_dir(db, local_abspath,
-                                       apr_hash_make(scratch_pool),
-                                       copyfrom_rev, 0, NULL,
-                                       svn_path_uri_decode(
-                                         svn_uri_skip_ancestor(repos_root_url,
-                                                               copyfrom_url),
-                                         scratch_pool),
-                                       repos_root_url, repos_uuid,
-                                       copyfrom_rev,
-                                       NULL /* children */, depth,
-                                       NULL /* conflicts */,
-                                       NULL /* work items */,
-                                       scratch_pool));
+        {
+          const char *repos_relpath =
+            svn_path_uri_decode(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),
+                                         copyfrom_rev, 0, NULL,
+                                         repos_relpath,
+                                         repos_root_url, repos_uuid,
+                                         copyfrom_rev,
+                                         NULL /* children */, depth,
+                                         NULL /* conflicts */,
+                                         NULL /* work items */,
+                                         scratch_pool));
+        }
     }
   else  /* Case 1: Integrating a separate WC into this one, in place */
     {
@@ -2146,7 +2149,8 @@ svn_wc__set_file_external_location(svn_w
 
   if (url)
     {
-      external_repos_relpath = svn_uri_is_child(repos_root_url, url, NULL);
+      external_repos_relpath = svn_uri_is_child(repos_root_url, url,
+                                                scratch_pool);
 
       if (external_repos_relpath == NULL)
           return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
@@ -2154,9 +2158,6 @@ svn_wc__set_file_external_location(svn_w
                                      " is not a file in repository '%s'."),
                                    url, repos_root_url);
 
-      external_repos_relpath = svn_path_uri_decode(external_repos_relpath,
-                                                   scratch_pool);
-
       SVN_ERR_ASSERT(peg_rev != NULL);
       SVN_ERR_ASSERT(rev != NULL);
     }

Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Fri Jan 28 02:34:40 2011
@@ -1735,19 +1735,16 @@ write_entry(struct write_baton **entry_n
     {
       if (entry->copyfrom_url)
         {
-          const char *relative_url;
+          const char *relpath;
 
           working_node->copyfrom_repos_id = repos_id;
-          relative_url = svn_uri_is_child(this_dir->repos, entry->copyfrom_url,
-                                          NULL);
-          if (relative_url == NULL)
+          relpath = svn_uri_is_child(this_dir->repos,
+                                              entry->copyfrom_url,
+                                              result_pool);
+          if (relpath == NULL)
             working_node->copyfrom_repos_path = "";
           else
-            {
-              /* copyfrom_repos_path is NOT a URI. decode into repos path.  */
-              working_node->copyfrom_repos_path =
-                svn_path_uri_decode(relative_url, result_pool);
-            }
+            working_node->copyfrom_repos_path = relpath;
           working_node->copyfrom_revnum = entry->copyfrom_rev;
           working_node->op_depth
             = svn_wc__db_op_depth_for_upgrade(local_relpath);
@@ -1894,31 +1891,23 @@ write_entry(struct write_baton **entry_n
         {
           base_node->repos_id = repos_id;
 
-          /* repos_relpath is NOT a URI. decode as appropriate.  */
           if (entry->url != NULL)
             {
-              const char *relative_url = svn_uri_is_child(this_dir->repos,
-                                                          entry->url,
-                                                          scratch_pool);
-
-              if (relative_url == NULL)
-                base_node->repos_relpath = "";
-              else
-                base_node->repos_relpath = svn_path_uri_decode(relative_url,
-                                                               result_pool);
+              const char *relpath = svn_uri_is_child(this_dir->repos,
+                                                     entry->url,
+                                                     result_pool);
+              base_node->repos_relpath = relpath ? relpath : "";
             }
           else
             {
-              const char *base_path = svn_uri_is_child(this_dir->repos,
-                                                       this_dir->url,
-                                                       scratch_pool);
-              if (base_path == NULL)
+              const char *relpath = svn_uri_is_child(this_dir->repos,
+                                                     this_dir->url,
+                                                     scratch_pool);
+              if (relpath == NULL)
                 base_node->repos_relpath = entry->name;
               else
                 base_node->repos_relpath =
-                  svn_dirent_join(svn_path_uri_decode(base_path, scratch_pool),
-                                  entry->name,
-                                  result_pool);
+                  svn_dirent_join(relpath, entry->name, result_pool);
             }
         }
 

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Fri Jan 28 02:34:40 2011
@@ -2647,7 +2647,16 @@ svn_wc_parse_externals_description3(apr_
            item->target_dir);
 
       if (canonicalize_url)
-          item->url = svn_uri_canonicalize(item->url, pool);
+        {
+          /* Uh... this is stupid.  But it's consistent with what our
+             code did before we split up the relpath/dirent/uri APIs.
+             Still, given this, it's no wonder that our own libraries
+             don't ask this function to canonicalize the results.  */
+          if (svn_path_is_url(item->url))
+            item->url = svn_uri_canonicalize(item->url, pool);
+          else
+            item->url = svn_dirent_canonicalize(item->url, pool);
+        }
 
       if (externals_p)
         APR_ARRAY_PUSH(*externals_p, svn_wc_external_item2_t *) = item;

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Fri Jan 28 02:34:40 2011
@@ -4879,11 +4879,9 @@ make_editor(svn_revnum_t *target_revisio
   /* Disallow a switch operation to change the repository root of the target,
      if that is known. */
   if (switch_url && !svn_uri_is_ancestor(repos_root, switch_url))
-    return svn_error_createf(
-       SVN_ERR_WC_INVALID_SWITCH, NULL,
-       _("'%s'\n"
-         "is not the same repository as\n"
-         "'%s'"), switch_url, repos_root);
+    return svn_error_createf(SVN_ERR_WC_INVALID_SWITCH, NULL,
+                             _("'%s'\nis not the same repository as\n'%s'"),
+                             switch_url, repos_root);
 
   /* Construct an edit baton. */
   eb = apr_pcalloc(edit_pool, sizeof(*eb));
@@ -4898,12 +4896,11 @@ make_editor(svn_revnum_t *target_revisio
   eb->anchor_abspath           = anchor_abspath;
 
   if (switch_url)
-    eb->switch_relpath         = svn_path_uri_decode(
-                                    svn_uri_skip_ancestor(repos_root,
-                                                          switch_url),
-                                    scratch_pool);
+    eb->switch_relpath =
+      svn_path_uri_decode(svn_uri_skip_ancestor(repos_root, switch_url),
+                          scratch_pool);
   else
-    eb->switch_relpath         = NULL;
+    eb->switch_relpath = NULL;
 
   if (svn_path_is_empty(target_basename))
     eb->target_abspath = eb->anchor_abspath;
@@ -5472,8 +5469,6 @@ svn_wc_add_repos_file4(svn_wc_context_t 
      copyfrom URL to be in the same repository. */
   if (copyfrom_url != NULL)
     {
-      const char *relative_url;
-
       /* Find the repository_root via the parent directory, which
          is always versioned before this function is called */
       SVN_ERR(svn_wc__node_get_repos_info(&original_root_url,
@@ -5490,8 +5485,9 @@ svn_wc_add_repos_file4(svn_wc_context_t 
                                    " root than '%s'"),
                                  copyfrom_url, original_root_url);
 
-      relative_url = svn_uri_skip_ancestor(original_root_url, copyfrom_url);
-      original_repos_relpath = svn_path_uri_decode(relative_url, pool);
+      original_repos_relpath =
+        svn_path_uri_decode(svn_uri_skip_ancestor(original_root_url,
+                                                  copyfrom_url), pool);
     }
   else
     {

Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Fri Jan 28 02:34:40 2011
@@ -581,8 +581,8 @@ ensure_repos_info(svn_wc_entry_t *entry,
       for (hi = apr_hash_first(scratch_pool, repos_cache);
            hi; hi = apr_hash_next(hi))
         {
-          if (svn_uri_is_child(svn__apr_hash_index_key(hi),
-                               entry->url, NULL))
+          if (svn_uri_is_child(svn__apr_hash_index_key(hi), entry->url,
+                               scratch_pool))
             {
               if (!entry->repos)
                 entry->repos = svn__apr_hash_index_key(hi);

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Jan 28 02:34:40 2011
@@ -1433,7 +1433,7 @@ svn_wc__db_base_add_directory(svn_wc__db
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR_ASSERT(repos_relpath != NULL);
-  SVN_ERR_ASSERT(svn_uri_is_absolute(repos_root_url));
+  SVN_ERR_ASSERT(svn_uri_is_canonical(repos_root_url, scratch_pool));
   SVN_ERR_ASSERT(repos_uuid != NULL);
   SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
   SVN_ERR_ASSERT(props != NULL);
@@ -1511,7 +1511,7 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR_ASSERT(repos_relpath != NULL);
-  SVN_ERR_ASSERT(svn_uri_is_absolute(repos_root_url));
+  SVN_ERR_ASSERT(svn_uri_is_canonical(repos_root_url, scratch_pool));
   SVN_ERR_ASSERT(repos_uuid != NULL);
   SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
   SVN_ERR_ASSERT(props != NULL);
@@ -1585,7 +1585,7 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR_ASSERT(repos_relpath != NULL);
-  SVN_ERR_ASSERT(svn_uri_is_absolute(repos_root_url));
+  SVN_ERR_ASSERT(svn_uri_is_canonical(repos_root_url, scratch_pool));
   SVN_ERR_ASSERT(repos_uuid != NULL);
   SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
   SVN_ERR_ASSERT(props != NULL);
@@ -1654,7 +1654,7 @@ add_absent_excluded_not_present_node(svn
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR_ASSERT(repos_relpath != NULL);
-  SVN_ERR_ASSERT(svn_uri_is_absolute(repos_root_url));
+  SVN_ERR_ASSERT(svn_uri_is_canonical(repos_root_url, scratch_pool));
   SVN_ERR_ASSERT(repos_uuid != NULL);
   SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
   SVN_ERR_ASSERT(status == svn_wc__db_status_absent

Modified: subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c (original)
+++ subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c Fri Jan 28 02:34:40 2011
@@ -61,6 +61,17 @@ typedef struct authz_svn_config_rec {
  * Configuration
  */
 
+/*
+ * Return a canonicalized version of URI (which is a
+ * schema/hostname-less URI), allocated from POOL.
+ */
+static const char *
+uri_canonicalize(const char *uri, apr_pool_t *pool)
+{
+  return apr_pstrcat(pool, (uri[0] == '/') ? "/" : "",
+                     svn_relpath_canonicalize(uri, pool), NULL);
+}
+               
 /* Implements the #create_dir_config method of Apache's #module vtable. */
 static void *
 create_authz_svn_dir_config(apr_pool_t *p, char *d)
@@ -69,7 +80,7 @@ create_authz_svn_dir_config(apr_pool_t *
   conf->base_path = d;
 
   if (d)
-    conf->base_path = svn_uri_canonicalize(d, p);
+    conf->base_path = uri_canonicalize(d, p);
 
   /* By default keep the fortress secure */
   conf->authoritative = 1;
@@ -275,7 +286,6 @@ req_check_access(request_rec *r,
   svn_authz_t *access_conf = NULL;
   svn_error_t *svn_err;
   char errbuf[256];
-  const char *canonicalized_uri;
   const char *username_to_authorize = get_username_to_authorize(r, conf);
 
   switch (r->method_number)
@@ -315,8 +325,7 @@ req_check_access(request_rec *r,
         break;
     }
 
-  canonicalized_uri = svn_uri_canonicalize(r->uri, r->pool);
-  if (strcmp(canonicalized_uri, conf->base_path) == 0)
+  if (strcmp(uri_canonicalize(r->uri, r->pool), conf->base_path) == 0)
     {
       /* Do no access control when conf->base_path(as configured in <Location>)
        * and given uri are same. The reason for such relaxation of access

Modified: subversion/trunk/subversion/mod_dav_svn/authz.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/authz.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/authz.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/authz.c Fri Jan 28 02:34:40 2011
@@ -28,6 +28,8 @@
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
 
+#include "private/svn_fspath.h"
+
 #include "mod_authz_svn.h"
 #include "dav_svn.h"
 
@@ -139,20 +141,21 @@ authz_read(svn_boolean_t *allowed,
          copied tree.  So we start at path and walk up its parents
          asking if anyone was copied, and if so where from.  */
       while (! (svn_path_is_empty(path_s->data)
-                || ((path_s->len == 1) && (path_s->data[0] == '/'))))
+                || svn_fspath__is_root(path_s->data, path_s->len)))
         {
           SVN_ERR(svn_fs_copied_from(&rev, &revpath, root,
                                      path_s->data, pool));
 
           if (SVN_IS_VALID_REVNUM(rev) && revpath)
             {
-              revpath = svn_path_join(revpath, lopped_path, pool);
+              revpath = svn_fspath__join(revpath, lopped_path, pool);
               break;
             }
 
           /* Lop off the basename and try again. */
-          lopped_path = svn_path_join(svn_uri_basename
-                                      (path_s->data, pool), lopped_path, pool);
+          lopped_path = svn_relpath_join(svn_fspath__basename(path_s->data,
+                                                              pool),
+                                         lopped_path, pool);
           svn_path_remove_component(path_s);
         }
 

Modified: subversion/trunk/subversion/mod_dav_svn/mirror.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/mirror.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/mirror.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/mirror.c Fri Jan 28 02:34:40 2011
@@ -28,6 +28,8 @@
 #include <httpd.h>
 #include <http_core.h>
 
+#include "private/svn_fspath.h"
+
 #include "dav_svn.h"
 
 
@@ -148,7 +150,7 @@ apr_status_t dav_svn__location_in_filter
     apr_uri_parse(r->pool, master_uri, &uri);
     root_dir = dav_svn__get_root_dir(r);
     if (uri.path)
-        canonicalized_uri = svn_uri_canonicalize(uri.path, r->pool);
+        canonicalized_uri = svn_urlpath__canonicalize(uri.path, r->pool);
     else
         canonicalized_uri = uri.path;
     if (strcmp(canonicalized_uri, root_dir) == 0) {
@@ -270,7 +272,7 @@ apr_status_t dav_svn__location_body_filt
     apr_uri_parse(r->pool, master_uri, &uri);
     root_dir = dav_svn__get_root_dir(r);
     if (uri.path)
-        canonicalized_uri = svn_uri_canonicalize(uri.path, r->pool);
+        canonicalized_uri = svn_urlpath__canonicalize(uri.path, r->pool);
     else
         canonicalized_uri = uri.path;
     if (strcmp(canonicalized_uri, root_dir) == 0) {

Modified: subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c Fri Jan 28 02:34:40 2011
@@ -37,6 +37,8 @@
 #include "svn_dso.h"
 #include "mod_dav_svn.h"
 
+#include "private/svn_fspath.h"
+
 #include "dav_svn.h"
 #include "mod_authz_svn.h"
 
@@ -172,10 +174,10 @@ create_dir_config(apr_pool_t *p, char *d
   /* NOTE: dir==NULL creates the default per-dir config */
   dir_conf_t *conf = apr_pcalloc(p, sizeof(*conf));
 
-  /*In subversion context dir is always considered to be coming from
-   <Location /blah> directive. So we treat it as URI. */
+  /* In subversion context dir is always considered to be coming from
+     <Location /blah> directive. So we treat it as a urlpath. */
   if (dir)
-    conf->root_dir = svn_uri_canonicalize(dir, p);
+    conf->root_dir = svn_urlpath__canonicalize(dir, p);
   conf->bulk_updates = CONF_FLAG_ON;
   conf->v2_protocol = CONF_FLAG_ON;
 

Modified: subversion/trunk/subversion/mod_dav_svn/reports/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/update.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/update.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/update.c Fri Jan 28 02:34:40 2011
@@ -39,6 +39,7 @@
 #include "svn_dav.h"
 #include "svn_props.h"
 #include "private/svn_log.h"
+#include "private/svn_fspath.h"
 
 #include "../dav_svn.h"
 
@@ -178,19 +179,19 @@ make_child_baton(item_baton_t *parent, c
   baton->parent = parent;
 
   /* Telescope the path based on uc->anchor.  */
-  baton->path = svn_uri_join(parent->path, baton->name, pool);
+  baton->path = svn_fspath__join(parent->path, baton->name, pool);
 
   /* Telescope the path based on uc->dst_path in the exact same way. */
-  baton->path2 = svn_uri_join(parent->path2, baton->name, pool);
+  baton->path2 = svn_fspath__join(parent->path2, baton->name, pool);
 
   /* Telescope the third path:  it's relative, not absolute, to
      dst_path.  Now, we gotta be careful here, because if this
      operation had a target, and we're it, then we have to use the
      basename of our source reflection instead of our own.  */
   if ((*baton->uc->target) && (! parent->parent))
-    baton->path3 = svn_path_join(parent->path3, baton->uc->target, pool);
+    baton->path3 = svn_relpath_join(parent->path3, baton->uc->target, pool);
   else
-    baton->path3 = svn_path_join(parent->path3, baton->name, pool);
+    baton->path3 = svn_relpath_join(parent->path3, baton->name, pool);
 
   return baton;
 }

Modified: subversion/trunk/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/repos.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/repos.c Fri Jan 28 02:34:40 2011
@@ -49,6 +49,7 @@
 #include "svn_ra.h"  /* for SVN_RA_CAPABILITY_* */
 #include "svn_dirent_uri.h"
 #include "private/svn_log.h"
+#include "private/svn_fspath.h"
 
 #include "dav_svn.h"
 
@@ -1937,7 +1938,7 @@ get_resource(request_rec *r,
     {
       /* ...then the URL to the repository is actually one implicit
          component longer... */
-      root_path = svn_uri_join(root_path, repo_basename, r->pool);
+      root_path = svn_urlpath__join(root_path, repo_basename, r->pool);
       /* ...and we need to specify exactly what repository to open. */
       fs_path = svn_dirent_join(fs_parent_path, repo_basename, r->pool);
     }
@@ -2299,11 +2300,11 @@ get_parent_path(const char *path, apr_po
 
   if (len > 0)
     {
-      /* Remove any trailing slash; else svn_uri_dirname() asserts. */
+      /* Remove any trailing slash; else svn_path_dirname() asserts. */
       if (tmp[len-1] == '/')
         tmp[len-1] = '\0';
 
-      return svn_uri_dirname(tmp, pool);
+      return svn_path_dirname(tmp, pool);
     }
 
   return path;

Modified: subversion/trunk/subversion/mod_dav_svn/version.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/version.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/version.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/version.c Fri Jan 28 02:34:40 2011
@@ -40,6 +40,7 @@
 #include "private/svn_repos_private.h"
 #include "private/svn_dav_protocol.h"
 #include "private/svn_log.h"
+#include "private/svn_fspath.h"
 
 #include "dav_svn.h"
 
@@ -1234,7 +1235,7 @@ dav_svn__build_lock_hash(apr_hash_t **lo
                 return derr;
 
               /* Create an absolute fs-path */
-              lockpath = svn_uri_join(path_prefix, cdata, pool);
+              lockpath = svn_fspath__join(path_prefix, cdata, pool);
               if (lockpath && locktoken)
                 {
                   apr_hash_set(hash, lockpath, APR_HASH_KEY_STRING, locktoken);

Modified: subversion/trunk/subversion/svn/checkout-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/checkout-cmd.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/checkout-cmd.c (original)
+++ subversion/trunk/subversion/svn/checkout-cmd.c Fri Jan 28 02:34:40 2011
@@ -93,9 +93,7 @@ svn_cl__checkout(apr_getopt_t *os,
 
           /* Discard the peg-revision, if one was provided. */
           SVN_ERR(svn_opt_parse_path(&pegrev, &local_dir, local_dir, pool));
-
           local_dir = svn_uri_basename(local_dir, pool);
-          local_dir = svn_path_uri_decode(local_dir, pool);
         }
       else
         {
@@ -145,9 +143,9 @@ svn_cl__checkout(apr_getopt_t *os,
         }
       else
         {
-          target_dir = svn_uri_basename(true_url, subpool);
-          target_dir = svn_path_uri_decode(target_dir, subpool);
-          target_dir = svn_dirent_join(local_dir, target_dir, subpool);
+          target_dir = svn_dirent_join(local_dir,
+                                       svn_uri_basename(true_url, subpool),
+                                       subpool);
         }
 
       /* Checkout doesn't accept an unspecified revision, so default to

Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Fri Jan 28 02:34:40 2011
@@ -754,18 +754,6 @@ svn_cl__node_description(const svn_wc_co
                          const char *wc_repos_root_URL,
                          apr_pool_t *pool);
 
-/* Join a BASE path with a COMPONENT, allocating the result in POOL.
- * COMPONENT need not be a single single component: it can be any path,
- * absolute or relative to BASE.
- *
- * This function exists to gather the cases when it could not be determined
- * if BASE is an uri, dirent or relative.
- */
-const char *
-svn_cl__path_join(const char *base,
-                  const char *component,
-                  apr_pool_t *pool);
-
 /* Return, in @a *true_targets_p, a copy of @a targets with peg revision
  * specifiers snipped off the end of each element.
  *

Modified: subversion/trunk/subversion/svn/diff-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/diff-cmd.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/diff-cmd.c (original)
+++ subversion/trunk/subversion/svn/diff-cmd.c Fri Jan 28 02:34:40 2011
@@ -93,11 +93,18 @@ summarize_xml(const svn_client_diff_summ
 
   /* Tack on the target path, so we can differentiate between different parts
    * of the output when we're given multiple targets. */
-  path = svn_cl__path_join(path, summary->path, pool);
+  if (svn_path_is_url(path))
+    {
+      path = svn_path_url_add_component2(path, summary->path, pool);
+    }
+  else
+    {
+      path = svn_dirent_join(path, summary->path, pool);
 
-  /* Convert non-urls to local style, so that things like "" show up as "." */
-  if (! svn_path_is_url(path))
-    path = svn_dirent_local_style(path, pool);
+      /* Convert non-urls to local style, so that things like "" 
+         show up as "." */
+      path = svn_dirent_local_style(path, pool);
+    }
 
   svn_xml_make_open_tag(&sb, pool, svn_xml_protect_pcdata, "path",
                         "kind", svn_cl__node_kind_str_xml(summary->node_kind),
@@ -122,11 +129,18 @@ summarize_regular(const svn_client_diff_
 
   /* Tack on the target path, so we can differentiate between different parts
    * of the output when we're given multiple targets. */
-  path = svn_uri_join(path, summary->path, pool);
+  if (svn_path_is_url(path))
+    {
+      path = svn_path_url_add_component2(path, summary->path, pool);
+    }
+  else
+    {
+      path = svn_dirent_join(path, summary->path, pool);
 
-  /* Convert non-urls to local style, so that things like "" show up as "." */
-  if (! svn_path_is_url(path))
-    path = svn_dirent_local_style(path, pool);
+      /* Convert non-urls to local style, so that things like "" 
+         show up as "." */
+      path = svn_dirent_local_style(path, pool);
+    }
 
   /* Note: This output format tries to look like the output of 'svn status',
    *       thus the blank spaces where information that is not relevant to
@@ -311,8 +325,15 @@ svn_cl__diff(apr_getopt_t *os,
                                      _("Path '%s' not relative to base URLs"),
                                      path);
 
-          target1 = svn_cl__path_join(old_target, path, iterpool);
-          target2 = svn_cl__path_join(new_target, path, iterpool);
+          path = svn_relpath_canonicalize(path, iterpool);
+          if (svn_path_is_url(old_target))
+            target1 = svn_path_url_add_component2(old_target, path, iterpool);
+          else
+            target1 = svn_dirent_join(old_target, path, iterpool);
+          if (svn_path_is_url(old_target))
+            target2 = svn_path_url_add_component2(new_target, path, iterpool);
+          else
+            target2 = svn_dirent_join(new_target, path, iterpool);
 
           if (opt_state->summarize)
             SVN_ERR(svn_client_diff_summarize2

Modified: subversion/trunk/subversion/svn/export-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/export-cmd.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/export-cmd.c (original)
+++ subversion/trunk/subversion/svn/export-cmd.c Fri Jan 28 02:34:40 2011
@@ -74,7 +74,10 @@ svn_cl__export(apr_getopt_t *os,
      the `to' path.  Else, a `to' path was supplied. */
   if (targets->nelts == 1)
     {
-      to = svn_path_uri_decode(svn_uri_basename(truefrom, pool), pool);
+      if (svn_path_is_url(truefrom))
+        to = svn_uri_basename(truefrom, pool);
+      else
+        to = svn_dirent_basename(truefrom, pool);
     }
   else
     {

Modified: subversion/trunk/subversion/svn/merge-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/merge-cmd.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/merge-cmd.c (original)
+++ subversion/trunk/subversion/svn/merge-cmd.c Fri Jan 28 02:34:40 2011
@@ -238,24 +238,23 @@ svn_cl__merge(apr_getopt_t *os,
      sourcepaths. */
   if (sourcepath1 && sourcepath2 && strcmp(targetpath, "") == 0)
     {
-      /* If the sourcepath is a URL, it can only refer to a target in the
-         current working directory.
-         However, if the sourcepath is a local path, it can refer to a target
-         somewhere deeper in the directory structure. */
+      /* If the sourcepath is a URL, it can only refer to a target in
+         the current working directory.  However, if the sourcepath is
+         a local path, it can refer to a target somewhere deeper in
+         the directory structure. */
       if (svn_path_is_url(sourcepath1))
         {
-          const char *sp1_basename, *sp2_basename;
-          sp1_basename = svn_uri_basename(sourcepath1, pool);
-          sp2_basename = svn_uri_basename(sourcepath2, pool);
+          const char *sp1_basename = svn_uri_basename(sourcepath1, pool);
+          const char *sp2_basename = svn_uri_basename(sourcepath2, pool);
 
           if (strcmp(sp1_basename, sp2_basename) == 0)
             {
               svn_node_kind_t kind;
-              const char *decoded_path = svn_path_uri_decode(sp1_basename, pool);
-              SVN_ERR(svn_io_check_path(decoded_path, &kind, pool));
+
+              SVN_ERR(svn_io_check_path(sp1_basename, &kind, pool));
               if (kind == svn_node_file)
                 {
-                  targetpath = decoded_path;
+                  targetpath = sp1_basename;
                 }
             }
         }

Modified: subversion/trunk/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/util.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/util.c (original)
+++ subversion/trunk/subversion/svn/util.c Fri Jan 28 02:34:40 2011
@@ -1296,17 +1296,6 @@ svn_cl__node_description(const svn_wc_co
                       node->peg_rev);
 }
 
-const char *
-svn_cl__path_join(const char *base,
-                  const char *component,
-                  apr_pool_t *pool)
-{
-  if (svn_path_is_url(base))
-    return svn_uri_join(base, component, pool);
-  else
-    return svn_dirent_join(base, component, pool);
-}
-
 svn_error_t *
 svn_cl__eat_peg_revisions(apr_array_header_t **true_targets_p,
                           const apr_array_header_t *targets,

Modified: subversion/trunk/subversion/svnrdump/dump_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/dump_editor.c?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/dump_editor.c (original)
+++ subversion/trunk/subversion/svnrdump/dump_editor.c Fri Jan 28 02:34:40 2011
@@ -30,6 +30,8 @@
 #include "svn_subst.h"
 #include "svn_dirent_uri.h"
 
+#include "private/svn_fspath.h"
+
 #include "dump_editor.h"
 
 #define ARE_VALID_COPY_ARGS(p,r) ((p) && SVN_IS_VALID_REVNUM(r))
@@ -132,19 +134,18 @@ make_dir_baton(const char *path,
   const char *abspath;
 
   /* Construct the full path of this node. */
+  /* ### FIXME: Not sure why we use an abspath here.  If I understand
+     ### correctly, the only place we used this path is in dump_node(),
+     ### which immediately converts it into a relpath.  -- cmpilato.  */
   if (pb)
-    {
-      if (path[0] != '/')
-        abspath = apr_pstrcat(pool, "/", path, (char *)NULL);
-    }
+    abspath = svn_fspath__canonicalize(path, pool);
   else
     abspath = "/";
 
   /* Strip leading slash from copyfrom_path so that the path is
      canonical and svn_relpath_join can be used */
   if (copyfrom_path)
-    copyfrom_path = ((*copyfrom_path == '/') ?
-                     copyfrom_path + 1 : copyfrom_path);
+    copyfrom_path = svn_relpath_canonicalize(copyfrom_path, pool);
 
   new_db->eb = eb;
   new_db->parent_dir_baton = pb;
@@ -252,11 +253,10 @@ dump_node(struct dump_edit_baton *eb,
 {
   /* Remove leading slashes from path and copyfrom_path */
   if (path)
-    path = ((*path == '/') ? path + 1 : path);
+    path = svn_relpath_canonicalize(path, pool);
 
   if (copyfrom_path)
-    copyfrom_path = ((*copyfrom_path == '/') ?
-                     copyfrom_path + 1 : copyfrom_path);
+    copyfrom_path = svn_relpath_canonicalize(copyfrom_path, pool);
 
   /* Node-path: commons/STATUS */
   SVN_ERR(svn_stream_printf(eb->stream, pool,
@@ -484,9 +484,9 @@ open_directory(const char *path,
      record the same for this one. */
   if (pb && ARE_VALID_COPY_ARGS(pb->copyfrom_path, pb->copyfrom_rev))
     {
-      copyfrom_path = svn_uri_join(pb->copyfrom_path,
-                                   svn_relpath_basename(path, NULL),
-                                   pb->eb->pool);
+      copyfrom_path = svn_relpath_join(pb->copyfrom_path,
+                                       svn_relpath_basename(path, NULL),
+                                       pb->eb->pool);
       copyfrom_rev = pb->copyfrom_rev;
     }
 

Modified: subversion/trunk/subversion/svnrdump/dump_editor.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/dump_editor.h?rev=1064436&r1=1064435&r2=1064436&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/dump_editor.h (original)
+++ subversion/trunk/subversion/svnrdump/dump_editor.h Fri Jan 28 02:34:40 2011
@@ -44,10 +44,10 @@ struct dir_baton
   svn_boolean_t written_out;
 
   /* the absolute path to this directory */
-  const char *abspath;
+  const char *abspath; /* an fspath */
 
-  /* Copyfrom info for the node, if any */
-  const char *copyfrom_path;
+  /* Copyfrom info for the node, if any. */
+  const char *copyfrom_path; /* a relpath */
   svn_revnum_t copyfrom_rev;
 
   /* Hash of paths that need to be deleted, though some -might- be