subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1066452 [5/11] - in /subversion/branches/performance: ./ build/ build/ac-macros/ build/generator/ contrib/hook-scripts/ notes/ notes/api-errata/1.7/ subversion/bindings/javahl/tests/org/apache/subversion/javahl/ subversion/include/ subvers...
Date Wed, 02 Feb 2011 13:04:59 GMT
Modified: subversion/branches/performance/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_serf/options.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/performance/subversion/libsvn_ra_serf/options.c Wed Feb  2 13:04:51 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,7 +188,7 @@ end_options(svn_ra_serf__xml_parser_t *p
     {
       options_ctx->collect_cdata = FALSE;
       options_ctx->activity_collection =
-                 svn_uri_canonicalize(options_ctx->attr_val, options_ctx->pool);
+        svn_urlpath__canonicalize(options_ctx->attr_val, options_ctx->pool);
       pop_state(options_ctx);
     }
 
@@ -336,10 +337,11 @@ 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_uri_canonicalize(apr_uri_unparse(orc->session->pool,
-                                                 &orc->session->repos_root,
-                                                 0),
-                                  orc->session->pool);
+            svn_urlpath__canonicalize(
+                apr_uri_unparse(orc->session->pool,
+                                &orc->session->repos_root,
+                                0),
+                orc->session->pool);
         }
       else if (svn_cstring_casecmp(key, SVN_DAV_ME_RESOURCE_HEADER) == 0)
         {

Modified: subversion/branches/performance/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_serf/property.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/performance/subversion/libsvn_ra_serf/property.c Wed Feb  2 13:04:51 2011
@@ -25,12 +25,14 @@
 
 #include <serf.h>
 
+#include "svn_path.h"
 #include "svn_base64.h"
 #include "svn_xml.h"
 #include "svn_props.h"
 #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"
@@ -342,7 +344,8 @@ end_propfind(svn_ra_serf__xml_parser_t *
         {
           if (strcmp(ctx->depth, "1") == 0)
             {
-              ctx->current_path = svn_uri_canonicalize(info->val, ctx->pool);
+              ctx->current_path =
+                svn_urlpath__canonicalize(info->val, ctx->pool);
             }
           else
             {
@@ -1032,7 +1035,7 @@ svn_ra_serf__get_baseline_info(const cha
                                         "the requested checked-in value"));
             }
 
-          baseline_url = svn_uri_canonicalize(baseline_url, pool);
+          baseline_url = svn_urlpath__canonicalize(baseline_url, pool);
 
           SVN_ERR(svn_ra_serf__retrieve_props(props, session, conn,
                                               baseline_url, revision, "0",
@@ -1049,7 +1052,7 @@ svn_ra_serf__get_baseline_info(const cha
                                     "requested baseline-collection value"));
         }
 
-      basecoll_url = svn_uri_canonicalize(basecoll_url, pool);
+      basecoll_url = svn_urlpath__canonicalize(basecoll_url, pool);
 
       if (latest_revnum)
         {

Modified: subversion/branches/performance/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_serf/ra_serf.h?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/performance/subversion/libsvn_ra_serf/ra_serf.h Wed Feb  2 13:04:51 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"
 
@@ -794,6 +795,13 @@ const char *
 svn_ra_serf__response_get_location(serf_bucket_t *response,
                                    apr_pool_t *pool);
 
+/* Canonicalize URI, in the general sense.  URI might be a full,
+ * absolute, schema-ful URL.  It might be just the path portion of a
+ * URL.  Or it might be a relative path.  Whatever the case, it is a
+ * URI-encoded identifier of *some sort*, as will be the returned form
+ * thereof.
+ */
+
 /** XML helper functions. **/
 
 /*

Modified: subversion/branches/performance/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_serf/serf.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/branches/performance/subversion/libsvn_ra_serf/serf.c Wed Feb  2 13:04:51 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_uri_canonicalize(path, 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/branches/performance/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_serf/update.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/performance/subversion/libsvn_ra_serf/update.c Wed Feb  2 13:04:51 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"
@@ -1676,7 +1677,8 @@ start_report(svn_ra_serf__xml_parser_t *
     }
   else if (state == IGNORE_PROP_NAME)
     {
-      push_state(parser, ctx, PROP);
+      report_info_t *info = push_state(parser, ctx, PROP);
+      info->prop_encoding = svn_xml_get_attr_value("encoding", attrs);
     }
   else if (state == NEED_PROP_NAME)
     {
@@ -1686,6 +1688,7 @@ start_report(svn_ra_serf__xml_parser_t *
 
       info->prop_ns = name.namespace;
       info->prop_name = apr_pstrdup(parser->state->pool, name.name);
+      info->prop_encoding = svn_xml_get_attr_value("encoding", attrs);
       info->prop_val = NULL;
       info->prop_val_len = 0;
     }
@@ -1792,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/branches/performance/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_serf/util.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/performance/subversion/libsvn_ra_serf/util.c Wed Feb  2 13:04:51 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_uri_canonicalize(val, 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_uri_canonicalize(apr_uri_unparse(session->pool,
-                                             &session->repos_root, 0),
-                             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;

Modified: subversion/branches/performance/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_svn/client.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/performance/subversion/libsvn_ra_svn/client.c Wed Feb  2 13:04:51 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/branches/performance/subversion/libsvn_ra_svn/cyrus_auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_svn/cyrus_auth.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_svn/cyrus_auth.c (original)
+++ subversion/branches/performance/subversion/libsvn_ra_svn/cyrus_auth.c Wed Feb  2 13:04:51 2011
@@ -54,8 +54,9 @@
  *       in atexit processing, at which point we are already running in
  *       single threaded mode.
  */
-volatile svn_atomic_t svn_ra_svn__sasl_status;
+volatile svn_atomic_t svn_ra_svn__sasl_status = 0;
 
+/* Initialized by svn_ra_svn__sasl_common_init(). */
 static volatile svn_atomic_t sasl_ctx_count;
 
 static apr_pool_t *sasl_pool = NULL;

Modified: subversion/branches/performance/subversion/libsvn_ra_svn/editorp.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_svn/editorp.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_svn/editorp.c (original)
+++ subversion/branches/performance/subversion/libsvn_ra_svn/editorp.c Wed Feb  2 13:04:51 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"
 
 /*
@@ -506,7 +509,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;
 }
@@ -526,9 +529,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);
@@ -550,7 +562,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);
@@ -624,9 +636,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));
@@ -646,7 +667,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/branches/performance/subversion/libsvn_ra_svn/protocol
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_svn/protocol?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_svn/protocol (original)
+++ subversion/branches/performance/subversion/libsvn_ra_svn/protocol Wed Feb  2 13:04:51 2011
@@ -370,8 +370,7 @@ second place for auth-request point as n
                 [ end-rev:number ] changed-paths:bool strict-node:bool
                 ? limit:number
                 ? include-merged-revisions:bool
-                all-revprops | revprops
-                ? ( revprop:string ... ) )
+                all-revprops | revprops ( revprop:string ... ) )
     Before sending response, server sends log entries, ending with "done".
     If a client does not want to specify a limit, it should send 0 as the
     limit parameter.  rev-props excludes author, date, and log; they are

Modified: subversion/branches/performance/subversion/libsvn_repos/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_repos/authz.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_repos/authz.c (original)
+++ subversion/branches/performance/subversion/libsvn_repos/authz.c Wed Feb  2 13:04:51 2011
@@ -33,6 +33,7 @@
 #include "svn_repos.h"
 #include "svn_config.h"
 #include "svn_ctype.h"
+#include "private/svn_fspath.h"
 
 
 /*** Structures. ***/
@@ -56,9 +57,9 @@ struct authz_lookup_baton {
 
   /* The following are used exclusively in recursive lookups. */
 
-  /* The path in the repository to authorize. */
+  /* The path in the repository (an fspath) to authorize. */
   const char *repos_path;
-  /* repos_path prefixed by the repository name. */
+  /* repos_path prefixed by the repository name and a colon. */
   const char *qualified_repos_path;
 
   /* Whether, at the end of a recursive lookup, access is granted. */
@@ -275,6 +276,23 @@ authz_parse_line(const char *name, const
 }
 
 
+/* Return TRUE iff the access rules in SECTION_NAME apply to PATH_SPEC
+ * (which is a repository name, colon, and repository fspath, such as
+ * "myrepos:/trunk/foo").
+ */
+static svn_boolean_t
+is_applicable_section(const char *path_spec,
+                      const char *section_name)
+{
+  apr_size_t path_spec_len = strlen(path_spec);
+
+  return ((strncmp(path_spec, section_name, path_spec_len) == 0)
+          && (path_spec[path_spec_len - 1] == '/'
+              || section_name[path_spec_len] == '/'
+              || section_name[path_spec_len] == '\0'));
+}
+
+
 /* Callback to parse a section and update the authz_baton if the
  * section denies access to the subtree the baton describes.
  */
@@ -285,10 +303,10 @@ authz_parse_section(const char *section_
   svn_boolean_t conclusive;
 
   /* Does the section apply to us? */
-  if (svn_path_is_ancestor(b->qualified_repos_path,
-                           section_name) == FALSE
-      && svn_path_is_ancestor(b->repos_path,
-                              section_name) == FALSE)
+  if (is_applicable_section(b->qualified_repos_path,
+                            section_name) == FALSE
+      && is_applicable_section(b->repos_path,
+                               section_name) == FALSE)
     return TRUE;
 
   /* Work out what this section grants. */
@@ -391,15 +409,15 @@ authz_get_tree_access(svn_config_t *cfg,
    any kind of granted access.  Implements the
    svn_config_section_enumerator2_t interface. */
 static svn_boolean_t
-authz_global_parse_section(const char *section_name, void *baton,
-                           apr_pool_t *pool)
+authz_get_any_access_parser_cb(const char *section_name, void *baton,
+                               apr_pool_t *pool)
 {
   struct authz_lookup_baton *b = baton;
 
   /* Does the section apply to the query? */
   if (section_name[0] == '/'
-      || strncmp(section_name, b->repos_path,
-                 strlen(b->repos_path)) == 0)
+      || strncmp(section_name, b->qualified_repos_path,
+                 strlen(b->qualified_repos_path)) == 0)
     {
       b->allow = b->deny = svn_authz_none;
 
@@ -422,10 +440,10 @@ authz_global_parse_section(const char *s
  * to any path within the REPOSITORY.  Return TRUE if so.  Use POOL
  * for temporary allocations. */
 static svn_boolean_t
-authz_get_global_access(svn_config_t *cfg, const char *repos_name,
-                        const char *user,
-                        svn_repos_authz_access_t required_access,
-                        apr_pool_t *pool)
+authz_get_any_access(svn_config_t *cfg, const char *repos_name,
+                     const char *user,
+                     svn_repos_authz_access_t required_access,
+                     apr_pool_t *pool)
 {
   struct authz_lookup_baton baton = { 0 };
 
@@ -433,9 +451,16 @@ authz_get_global_access(svn_config_t *cf
   baton.user = user;
   baton.required_access = required_access;
   baton.access = FALSE; /* Deny access by default. */
-  baton.repos_path = apr_pstrcat(pool, repos_name, ":/", (char *)NULL);
-
-  svn_config_enumerate_sections2(cfg, authz_global_parse_section,
+  baton.repos_path = "/";
+  baton.qualified_repos_path = apr_pstrcat(pool, repos_name,
+                                           ":/", (char *)NULL);
+  
+  /* We could have used svn_config_enumerate2 for "repos_name:/".
+   * However, this requires access for root explicitly (which the user
+   * may not always have). So we end up enumerating the sections in 
+   * the authz CFG and stop on the first match with some access for 
+   * this user. */
+  svn_config_enumerate_sections2(cfg, authz_get_any_access_parser_cb,
                                  &baton, pool);
 
   /* If walking the configuration was inconclusive, deny access. */
@@ -741,18 +766,20 @@ svn_repos_authz_check_access(svn_authz_t
                              svn_boolean_t *access_granted,
                              apr_pool_t *pool)
 {
-  const char *current_path = path;
+  const char *current_path;
 
-  /* If PATH is NULL, do a global access lookup. */
+  /* If PATH is NULL, check if the user has *any* access. */
   if (!path)
     {
-      *access_granted = authz_get_global_access(authz->cfg, repos_name,
-                                                user, required_access,
-                                                pool);
+      *access_granted = authz_get_any_access(authz->cfg, repos_name,
+                                             user, required_access, pool);
       return SVN_NO_ERROR;
     }
 
   /* Determine the granted access for the requested path. */
+  path = svn_fspath__canonicalize(path, pool);
+  current_path = path;
+  
   while (!authz_get_path_access(authz->cfg, repos_name,
                                 current_path, user,
                                 required_access,
@@ -769,7 +796,7 @@ svn_repos_authz_check_access(svn_authz_t
         }
 
       /* Work back to the parent path. */
-      current_path = svn_dirent_dirname(current_path, pool);
+      current_path = svn_fspath__dirname(current_path, pool);
     }
 
   /* If the caller requested recursive access, we need to walk through

Modified: subversion/branches/performance/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_repos/commit.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_repos/commit.c (original)
+++ subversion/branches/performance/subversion/libsvn_repos/commit.c Wed Feb  2 13:04:51 2011
@@ -38,6 +38,7 @@
 #include "svn_props.h"
 #include "repos.h"
 #include "svn_private_config.h"
+#include "private/svn_fspath.h"
 #include "private/svn_repos_private.h"
 
 
@@ -165,6 +166,147 @@ check_authz(struct edit_baton *editor_ba
   return SVN_NO_ERROR;
 }
 
+
+/* Return a directory baton allocated in POOL which represents
+   FULL_PATH, which is the immediate directory child of the directory
+   represented by PARENT_BATON.  EDIT_BATON is the commit editor
+   baton.  WAS_COPIED reveals whether or not this directory is the
+   result of a copy operation.  BASE_REVISION is the base revision of
+   the directory. */
+static struct dir_baton *
+make_dir_baton(struct edit_baton *edit_baton,
+               struct dir_baton *parent_baton,
+               const char *full_path,
+               svn_boolean_t was_copied,
+               svn_revnum_t base_revision,
+               apr_pool_t *pool)
+{
+  struct dir_baton *db;
+  db = apr_pcalloc(pool, sizeof(*db));
+  db->edit_baton = edit_baton;
+  db->parent = parent_baton;
+  db->pool = pool;
+  db->path = full_path;
+  db->was_copied = was_copied;
+  db->base_rev = base_revision;
+  return db;
+}
+
+
+/* This function is the shared guts of add_file() and add_directory(),
+   which see for the meanings of the parameters.  The only extra
+   parameter here is IS_DIR, which is TRUE when adding a directory,
+   and FALSE when adding a file.  */
+static svn_error_t *
+add_file_or_directory(const char *path,
+                      void *parent_baton,
+                      const char *copy_path,
+                      svn_revnum_t copy_revision,
+                      svn_boolean_t is_dir,
+                      apr_pool_t *pool,
+                      void **return_baton)
+{
+  struct dir_baton *pb = parent_baton;
+  struct edit_baton *eb = pb->edit_baton;
+  apr_pool_t *subpool = svn_pool_create(pool);
+  svn_boolean_t was_copied = FALSE;
+  const char *full_path;
+
+  full_path = svn_fspath__join(eb->base_path,
+                               svn_relpath_canonicalize(path, pool), pool);
+
+  /* Sanity check. */
+  if (copy_path && (! SVN_IS_VALID_REVNUM(copy_revision)))
+    return svn_error_createf
+      (SVN_ERR_FS_GENERAL, NULL,
+       _("Got source path but no source revision for '%s'"), full_path);
+
+  if (copy_path)
+    {
+      const char *fs_path;
+      svn_fs_root_t *copy_root;
+      svn_node_kind_t kind;
+      size_t repos_url_len;
+      svn_repos_authz_access_t required;
+
+      /* Copy requires recursive write access to the destination path
+         and write access to the parent path. */
+      required = svn_authz_write | (is_dir ? svn_authz_recursive : 0);
+      SVN_ERR(check_authz(eb, full_path, eb->txn_root,
+                          required, subpool));
+      SVN_ERR(check_authz(eb, pb->path, eb->txn_root,
+                          svn_authz_write, subpool));
+
+      /* Check PATH in our transaction.  Make sure it does not exist
+         unless its parent directory was copied (in which case, the
+         thing might have been copied in as well), else return an
+         out-of-dateness error. */
+      SVN_ERR(svn_fs_check_path(&kind, eb->txn_root, full_path, subpool));
+      if ((kind != svn_node_none) && (! pb->was_copied))
+        return out_of_date(full_path, kind);
+
+      /* For now, require that the url come from the same repository
+         that this commit is operating on. */
+      copy_path = svn_path_uri_decode(copy_path, subpool);
+      repos_url_len = strlen(eb->repos_url);
+      if (strncmp(copy_path, eb->repos_url, repos_url_len) != 0)
+        return svn_error_createf
+          (SVN_ERR_FS_GENERAL, NULL,
+           _("Source url '%s' is from different repository"), copy_path);
+
+      fs_path = apr_pstrdup(subpool, copy_path + repos_url_len);
+
+      /* Now use the "fs_path" as an absolute path within the
+         repository to make the copy from. */
+      SVN_ERR(svn_fs_revision_root(&copy_root, eb->fs,
+                                   copy_revision, subpool));
+
+      /* Copy also requires (recursive) read access to the source */
+      required = svn_authz_read | (is_dir ? svn_authz_recursive : 0);
+      SVN_ERR(check_authz(eb, fs_path, copy_root, required, subpool));
+
+      SVN_ERR(svn_fs_copy(copy_root, fs_path,
+                          eb->txn_root, full_path, subpool));
+      was_copied = TRUE;
+    }
+  else
+    {
+      /* No ancestry given, just make a new directory or empty file.
+         Note that we don't perform an existence check here like the
+         copy-from case does -- that's because svn_fs_make_*()
+         already errors out if the file already exists.  Verify write
+         access to the full path and to the parent. */
+      SVN_ERR(check_authz(eb, full_path, eb->txn_root,
+                          svn_authz_write, subpool));
+      SVN_ERR(check_authz(eb, pb->path, eb->txn_root,
+                          svn_authz_write, subpool));
+      if (is_dir)
+        SVN_ERR(svn_fs_make_dir(eb->txn_root, full_path, subpool));
+      else
+        SVN_ERR(svn_fs_make_file(eb->txn_root, full_path, subpool));
+    }
+
+  /* Cleanup our temporary subpool. */
+  svn_pool_destroy(subpool);
+
+  /* Build a new child baton. */
+  if (is_dir)
+    {
+      *return_baton = make_dir_baton(eb, pb, full_path, was_copied,
+                                     SVN_INVALID_REVNUM, pool);
+    }
+  else
+    {
+      struct file_baton *new_fb = apr_pcalloc(pool, sizeof(*new_fb));
+      new_fb->edit_baton = eb;
+      new_fb->path = full_path;
+      *return_baton = new_fb;
+    }
+
+  return SVN_NO_ERROR;
+}
+
+
 
 /*** Editor functions ***/
 
@@ -231,7 +373,10 @@ delete_entry(const char *path,
   svn_node_kind_t kind;
   svn_revnum_t cr_rev;
   svn_repos_authz_access_t required = svn_authz_write;
-  const char *full_path = svn_path_join(eb->base_path, path, pool);
+  const char *full_path;
+
+  full_path = svn_fspath__join(eb->base_path,
+                               svn_relpath_canonicalize(path, pool), pool);
 
   /* Check PATH in our transaction.  */
   SVN_ERR(svn_fs_check_path(&kind, eb->txn_root, full_path, pool));
@@ -262,26 +407,6 @@ delete_entry(const char *path,
 }
 
 
-static struct dir_baton *
-make_dir_baton(struct edit_baton *edit_baton,
-               struct dir_baton *parent_baton,
-               const char *full_path,
-               svn_boolean_t was_copied,
-               svn_revnum_t base_revision,
-               apr_pool_t *pool)
-{
-  struct dir_baton *db;
-  db = apr_pcalloc(pool, sizeof(*db));
-  db->edit_baton = edit_baton;
-  db->parent = parent_baton;
-  db->pool = pool;
-  db->path = full_path;
-  db->was_copied = was_copied;
-  db->base_rev = base_revision;
-  return db;
-}
-
-
 static svn_error_t *
 add_directory(const char *path,
               void *parent_baton,
@@ -290,88 +415,8 @@ add_directory(const char *path,
               apr_pool_t *pool,
               void **child_baton)
 {
-  struct dir_baton *pb = parent_baton;
-  struct edit_baton *eb = pb->edit_baton;
-  const char *full_path = svn_path_join(eb->base_path, path, pool);
-  apr_pool_t *subpool = svn_pool_create(pool);
-  svn_boolean_t was_copied = FALSE;
-
-  /* Sanity check. */
-  if (copy_path && (! SVN_IS_VALID_REVNUM(copy_revision)))
-    return svn_error_createf
-      (SVN_ERR_FS_GENERAL, NULL,
-       _("Got source path but no source revision for '%s'"), full_path);
-
-  if (copy_path)
-    {
-      const char *fs_path;
-      svn_fs_root_t *copy_root;
-      svn_node_kind_t kind;
-      size_t repos_url_len;
-
-      /* Copy requires recursive write access to the destination path
-         and write access to the parent path. */
-      SVN_ERR(check_authz(eb, full_path, eb->txn_root,
-                          svn_authz_write | svn_authz_recursive,
-                          subpool));
-      SVN_ERR(check_authz(eb, pb->path, eb->txn_root,
-                          svn_authz_write, subpool));
-
-      /* Check PATH in our transaction.  Make sure it does not exist
-         unless its parent directory was copied (in which case, the
-         thing might have been copied in as well), else return an
-         out-of-dateness error. */
-      SVN_ERR(svn_fs_check_path(&kind, eb->txn_root, full_path, subpool));
-      if ((kind != svn_node_none) && (! pb->was_copied))
-        return out_of_date(full_path, kind);
-
-      /* For now, require that the url come from the same repository
-         that this commit is operating on. */
-      copy_path = svn_path_uri_decode(copy_path, subpool);
-      repos_url_len = strlen(eb->repos_url);
-      if (strncmp(copy_path, eb->repos_url, repos_url_len) != 0)
-        return svn_error_createf
-          (SVN_ERR_FS_GENERAL, NULL,
-           _("Source url '%s' is from different repository"), copy_path);
-
-      fs_path = apr_pstrdup(subpool, copy_path + repos_url_len);
-
-      /* Now use the "fs_path" as an absolute path within the
-         repository to make the copy from. */
-      SVN_ERR(svn_fs_revision_root(&copy_root, eb->fs,
-                                   copy_revision, subpool));
-
-      /* Copy also requires recursive read access to the source
-         path. */
-      SVN_ERR(check_authz(eb, fs_path, copy_root,
-                          svn_authz_read | svn_authz_recursive,
-                          subpool));
-
-      SVN_ERR(svn_fs_copy(copy_root, fs_path,
-                          eb->txn_root, full_path, subpool));
-      was_copied = TRUE;
-    }
-  else
-    {
-      /* No ancestry given, just make a new directory.  We don't
-         bother with an out-of-dateness check here because
-         svn_fs_make_dir will error out if PATH already exists.
-         Verify write access to the full path and the parent
-         directory. */
-      SVN_ERR(check_authz(eb, full_path, eb->txn_root,
-                          svn_authz_write, subpool));
-      SVN_ERR(check_authz(eb, pb->path, eb->txn_root,
-                          svn_authz_write, subpool));
-      SVN_ERR(svn_fs_make_dir(eb->txn_root, full_path, subpool));
-    }
-
-  /* Cleanup our temporary subpool. */
-  svn_pool_destroy(subpool);
-
-  /* Build a new dir baton for this directory. */
-  *child_baton = make_dir_baton(eb, pb, full_path, was_copied,
-                                SVN_INVALID_REVNUM, pool);
-  return SVN_NO_ERROR;
+  return add_file_or_directory(path, parent_baton, copy_path, copy_revision,
+                               TRUE /* is_dir */, pool, child_baton);
 }
 
 
@@ -385,7 +430,10 @@ open_directory(const char *path,
   struct dir_baton *pb = parent_baton;
   struct edit_baton *eb = pb->edit_baton;
   svn_node_kind_t kind;
-  const char *full_path = svn_path_join(eb->base_path, path, pool);
+  const char *full_path;
+
+  full_path = svn_fspath__join(eb->base_path,
+                               svn_relpath_canonicalize(path, pool), pool);
 
   /* Check PATH in our transaction.  If it does not exist,
      return a 'Path not present' error. */
@@ -425,8 +473,6 @@ apply_textdelta(void *file_baton,
 }
 
 
-
-
 static svn_error_t *
 add_file(const char *path,
          void *parent_baton,
@@ -435,92 +481,11 @@ add_file(const char *path,
          apr_pool_t *pool,
          void **file_baton)
 {
-  struct file_baton *new_fb;
-  struct dir_baton *pb = parent_baton;
-  struct edit_baton *eb = pb->edit_baton;
-  const char *full_path = svn_path_join(eb->base_path, path, pool);
-  apr_pool_t *subpool = svn_pool_create(pool);
-
-  /* Sanity check. */
-  if (copy_path && (! SVN_IS_VALID_REVNUM(copy_revision)))
-    return svn_error_createf
-      (SVN_ERR_FS_GENERAL, NULL,
-       _("Got source path but no source revision for '%s'"), full_path);
-
-  if (copy_path)
-    {
-      const char *fs_path;
-      svn_fs_root_t *copy_root;
-      svn_node_kind_t kind;
-      size_t repos_url_len;
-
-      /* Copy requires recursive write to the destination path and
-         parent path. */
-      SVN_ERR(check_authz(eb, full_path, eb->txn_root,
-                          svn_authz_write, subpool));
-      SVN_ERR(check_authz(eb, pb->path, eb->txn_root,
-                          svn_authz_write, subpool));
-
-      /* Check PATH in our transaction.  Make sure it does not exist
-         unless its parent directory was copied (in which case, the
-         thing might have been copied in as well), else return an
-         out-of-dateness error. */
-      SVN_ERR(svn_fs_check_path(&kind, eb->txn_root, full_path, subpool));
-      if ((kind != svn_node_none) && (! pb->was_copied))
-        return out_of_date(full_path, kind);
-
-      /* For now, require that the url come from the same repository
-         that this commit is operating on. */
-      copy_path = svn_path_uri_decode(copy_path, subpool);
-      repos_url_len = strlen(eb->repos_url);
-      if (strncmp(copy_path, eb->repos_url, repos_url_len) != 0)
-            return svn_error_createf
-              (SVN_ERR_FS_GENERAL, NULL,
-               _("Source url '%s' is from different repository"), copy_path);
-
-      fs_path = apr_pstrdup(subpool, copy_path + repos_url_len);
-
-      /* Now use the "fs_path" as an absolute path within the
-         repository to make the copy from. */
-      SVN_ERR(svn_fs_revision_root(&copy_root, eb->fs,
-                                   copy_revision, subpool));
-
-      /* Copy also requires read access to the source */
-      SVN_ERR(check_authz(eb, fs_path, copy_root,
-                          svn_authz_read, subpool));
-
-      SVN_ERR(svn_fs_copy(copy_root, fs_path,
-                          eb->txn_root, full_path, subpool));
-    }
-  else
-    {
-      /* No ancestry given, just make a new, empty file.  Note that we
-         don't perform an existence check here like the copy-from case
-         does -- that's because svn_fs_make_file() already errors out
-         if the file already exists.  Verify write access to the full
-         path and to the parent. */
-      SVN_ERR(check_authz(eb, full_path, eb->txn_root, svn_authz_write,
-                          subpool));
-      SVN_ERR(check_authz(eb, pb->path, eb->txn_root, svn_authz_write,
-                          subpool));
-      SVN_ERR(svn_fs_make_file(eb->txn_root, full_path, subpool));
-    }
-
-  /* Cleanup our temporary subpool. */
-  svn_pool_destroy(subpool);
-
-  /* Build a new file baton */
-  new_fb = apr_pcalloc(pool, sizeof(*new_fb));
-  new_fb->edit_baton = eb;
-  new_fb->path = full_path;
-
-  *file_baton = new_fb;
-  return SVN_NO_ERROR;
+  return add_file_or_directory(path, parent_baton, copy_path, copy_revision,
+                               FALSE /* is_dir */, pool, file_baton);
 }
 
 
-
-
 static svn_error_t *
 open_file(const char *path,
           void *parent_baton,
@@ -533,7 +498,10 @@ open_file(const char *path,
   struct edit_baton *eb = pb->edit_baton;
   svn_revnum_t cr_rev;
   apr_pool_t *subpool = svn_pool_create(pool);
-  const char *full_path = svn_path_join(eb->base_path, path, pool);
+  const char *full_path;
+
+  full_path = svn_fspath__join(eb->base_path,
+                               svn_relpath_canonicalize(path, pool), pool);
 
   /* Check for read authorization. */
   SVN_ERR(check_authz(eb, full_path, eb->txn_root,
@@ -873,7 +841,7 @@ svn_repos_get_commit_editor5(const svn_d
   eb->commit_callback_baton = callback_baton;
   eb->authz_callback = authz_callback;
   eb->authz_baton = authz_baton;
-  eb->base_path = apr_pstrdup(subpool, base_path);
+  eb->base_path = svn_fspath__canonicalize(base_path, subpool);
   eb->repos = repos;
   eb->repos_url = repos_url;
   eb->repos_name = svn_dirent_basename(svn_repos_path(repos, subpool),

Modified: subversion/branches/performance/subversion/libsvn_repos/hooks.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_repos/hooks.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_repos/hooks.c (original)
+++ subversion/branches/performance/subversion/libsvn_repos/hooks.c Wed Feb  2 13:04:51 2011
@@ -35,6 +35,7 @@
 #include "repos.h"
 #include "svn_private_config.h"
 #include "private/svn_fs_private.h"
+#include "private/svn_repos_private.h"
 
 
 
@@ -592,7 +593,7 @@ svn_repos__hooks_pre_obliterate(svn_repo
                                 const svn_string_t *obliteration_set,
                                 apr_pool_t *pool)
 {
-  const char *hook = svn_repos_pre_obliterate_hook(repos, pool);
+  const char *hook = svn_repos__pre_obliterate_hook(repos, pool);
   svn_boolean_t broken_link;
 
   if ((hook = check_hook_cmd(hook, &broken_link, pool)) && broken_link)

Modified: subversion/branches/performance/subversion/libsvn_repos/load.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_repos/load.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_repos/load.c (original)
+++ subversion/branches/performance/subversion/libsvn_repos/load.c Wed Feb  2 13:04:51 2011
@@ -384,8 +384,9 @@ parse_format_version(const char *version
       || strncmp(versionstring,
                  SVN_REPOS_DUMPFILE_MAGIC_HEADER,
                  magic_len))
-    return svn_error_create(SVN_ERR_STREAM_MALFORMED_DATA, NULL,
-                            _("Malformed dumpfile header"));
+    return svn_error_createf(SVN_ERR_STREAM_MALFORMED_DATA, NULL,
+                             _("Malformed dumpfile header '%s'"),
+                             versionstring);
 
   SVN_ERR(svn_cstring_atoi(&value, p + 1));
 

Modified: subversion/branches/performance/subversion/libsvn_repos/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_repos/log.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_repos/log.c (original)
+++ subversion/branches/performance/subversion/libsvn_repos/log.c Wed Feb  2 13:04:51 2011
@@ -1052,6 +1052,7 @@ get_path_histories(apr_array_header_t **
 {
   svn_fs_root_t *root;
   apr_pool_t *iterpool;
+  svn_error_t *err;
   int i;
 
   /* Create a history object for each path so we can walk through
@@ -1093,7 +1094,6 @@ get_path_histories(apr_array_header_t **
 
       if (i < MAX_OPEN_HISTORIES)
         {
-          svn_error_t *err;
           err = svn_fs_node_history(&info->hist, root, this_path, pool);
           if (err
               && ignore_missing_locations
@@ -1115,10 +1115,20 @@ get_path_histories(apr_array_header_t **
           info->newpool = NULL;
         }
 
-      SVN_ERR(get_history(info, fs,
-                          strict_node_history,
-                          authz_read_func, authz_read_baton,
-                          hist_start, pool));
+      err = get_history(info, fs,
+                        strict_node_history,
+                        authz_read_func, authz_read_baton,
+                        hist_start, pool);
+      if (err
+          && ignore_missing_locations
+          && (err->apr_err == SVN_ERR_FS_NOT_FOUND ||
+              err->apr_err == SVN_ERR_FS_NOT_DIRECTORY ||
+              err->apr_err == SVN_ERR_FS_NO_SUCH_REVISION))
+        {
+          svn_error_clear(err);
+          continue;
+        }
+      SVN_ERR(err);
       APR_ARRAY_PUSH(*histories, struct path_info *) = info;
     }
   svn_pool_destroy(iterpool);

Modified: subversion/branches/performance/subversion/libsvn_repos/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_repos/replay.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_repos/replay.c (original)
+++ subversion/branches/performance/subversion/libsvn_repos/replay.c Wed Feb  2 13:04:51 2011
@@ -269,11 +269,21 @@ add_subdir(svn_fs_root_t *source_root,
            * I think not; when path_driver_cb_func() calls add_subdir(), it
            * passes SOURCE_ROOT and SOURCE_PATH that are unreadable.
            */
-          SVN_ERR(add_subdir(new_source_root, target_root, editor, edit_baton,
-                             new_path, *dir_baton,
-                             new_source_path,
-                             authz_read_func, authz_read_baton,
-                             changed_paths, subpool, &new_dir_baton));
+          if (change && change->change_kind == svn_fs_path_change_replace
+              && copyfrom_path == NULL)
+            {
+              SVN_ERR(editor->add_directory(new_path, *dir_baton,
+                                            NULL, SVN_INVALID_REVNUM,
+                                            subpool, &new_dir_baton));
+            }
+          else
+            {
+              SVN_ERR(add_subdir(new_source_root, target_root, editor, edit_baton,
+                                 new_path, *dir_baton,
+                                 new_source_path,
+                                 authz_read_func, authz_read_baton,
+                                 changed_paths, subpool, &new_dir_baton));
+            }
 
           SVN_ERR(editor->close_directory(new_dir_baton, subpool));
         }

Modified: subversion/branches/performance/subversion/libsvn_repos/reporter.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_repos/reporter.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_repos/reporter.c (original)
+++ subversion/branches/performance/subversion/libsvn_repos/reporter.c Wed Feb  2 13:04:51 2011
@@ -33,6 +33,7 @@
 #include "repos.h"
 #include "svn_private_config.h"
 #include "private/svn_dep_compat.h"
+#include "private/svn_fspath.h"
 
 #define NUM_CACHED_SOURCE_ROOTS 4
 

Modified: subversion/branches/performance/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_repos/repos.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/performance/subversion/libsvn_repos/repos.c Wed Feb  2 13:04:51 2011
@@ -32,6 +32,7 @@
 #include "svn_fs.h"
 #include "svn_ra.h"  /* for SVN_RA_CAPABILITY_* */
 #include "svn_repos.h"
+#include "private/svn_repos_private.h"
 #include "svn_private_config.h" /* for SVN_TEMPLATE_ROOT_DIR */
 
 #include "repos.h"
@@ -163,7 +164,7 @@ svn_repos_post_revprop_change_hook(svn_r
 
 
 const char *
-svn_repos_pre_obliterate_hook(svn_repos_t *repos, apr_pool_t *pool)
+svn_repos__pre_obliterate_hook(svn_repos_t *repos, apr_pool_t *pool)
 {
   return svn_dirent_join(repos->hook_path, SVN_REPOS__HOOK_PRE_OBLITERATE,
                        pool);
@@ -171,7 +172,7 @@ svn_repos_pre_obliterate_hook(svn_repos_
 
 
 const char *
-svn_repos_post_obliterate_hook(svn_repos_t *repos, apr_pool_t *pool)
+svn_repos__post_obliterate_hook(svn_repos_t *repos, apr_pool_t *pool)
 {
   return svn_dirent_join(repos->hook_path, SVN_REPOS__HOOK_POST_OBLITERATE,
                        pool);
@@ -549,7 +550,7 @@ PREWRITTEN_HOOKS_TEXT
   /* Pre-obliterate hook. */
   {
     this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_pre_obliterate_hook(repos, pool),
+                             svn_repos__pre_obliterate_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
 
 #define SCRIPT_NAME SVN_REPOS__HOOK_PRE_OBLITERATE
@@ -1042,7 +1043,7 @@ PREWRITTEN_HOOKS_TEXT
   /* Post-obliterate hook. */
   {
     this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_post_obliterate_hook(repos, pool),
+                             svn_repos__post_obliterate_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
 
 #define SCRIPT_NAME SVN_REPOS__HOOK_POST_OBLITERATE

Modified: subversion/branches/performance/subversion/libsvn_subr/config_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/config_file.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/config_file.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/config_file.c Wed Feb  2 13:04:51 2011
@@ -1008,8 +1008,8 @@ svn_config_ensure(const char *config_dir
         "###   accepts the '--diff-program' option."                         NL
         "# diff3-has-program-arg = [yes | no]"                               NL
         "### Set merge-tool-cmd to the command used to invoke your external" NL
-        "### merging tool of choice. Subversion will pass 4 arguments to"    NL
-        "### the specified command: base theirs mine merged"                 NL
+        "### merging tool of choice. Subversion will pass 5 arguments to"    NL
+        "### the specified command: base theirs mine merged wcfile"          NL
         "# merge-tool-cmd = merge_command"                                   NL
         ""                                                                   NL
         "### Section for configuring tunnel agents."                         NL

Modified: subversion/branches/performance/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/deprecated.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/deprecated.c Wed Feb  2 13:04:51 2011
@@ -256,7 +256,7 @@ svn_subst_translate_string(svn_string_t 
                            apr_pool_t *pool)
 {
   return svn_subst_translate_string2(new_value, NULL, NULL, value,
-                                     encoding, pool, pool);
+                                     encoding, FALSE, pool, pool);
 }
 
 svn_error_t *

Modified: subversion/branches/performance/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/dirent_uri.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/dirent_uri.c Wed Feb  2 13:04:51 2011
@@ -37,6 +37,7 @@
 #include "svn_ctype.h"
 
 #include "dirent_uri.h"
+#include "private/svn_fspath.h"
 
 /* The canonical empty path.  Can this be changed?  Well, change the empty
    test below and the path library will work, not so sure about the fs/wc
@@ -96,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);
     }
 }
 
@@ -363,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++;
 
@@ -477,6 +484,12 @@ canonicalize(path_type_t type, const cha
         {
           /* Noop segment, so do nothing. */
         }
+      else if (type == type_uri && seglen == 3
+               && src[0] == '%' && src[1] == '2'
+               && canonicalize_to_upper(src[2]) == 'E')
+        {
+          /* '%2E' is equivalent to '.', so this is a noop segment */
+        }
 #ifdef SVN_USE_DOS_PATHS
       /* If this is the first path segment of a file:// URI and it contains a
          windows drive letter, convert the drive letter to upper case. */
@@ -785,7 +798,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
@@ -871,8 +884,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:
@@ -970,12 +984,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));
 }
 
@@ -1213,55 +1222,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);
@@ -1380,6 +1340,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));
 
@@ -1393,9 +1354,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
@@ -1441,56 +1404,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_uri_is_canonical(uri1, NULL));
+  assert(svn_uri_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 *
@@ -1517,7 +1463,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
@@ -1538,6 +1492,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);
 }
 
@@ -1600,6 +1557,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 */
 
@@ -1641,17 +1601,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,
@@ -1814,64 +1763,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 == '/')
@@ -1912,38 +1857,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;
+          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;
-
-              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;
@@ -2172,8 +2114,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);
@@ -2278,7 +2225,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);
         }
     }
 
@@ -2291,7 +2238,6 @@ svn_dirent_is_under_root(svn_boolean_t *
                          const char *base_path,
                          const char *path,
                          apr_pool_t *pool)
-
 {
   apr_status_t status;
   char *full_path;
@@ -2331,7 +2277,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) */
 
@@ -2468,7 +2413,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)
@@ -2478,6 +2424,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)
@@ -2486,11 +2451,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;
@@ -2504,14 +2465,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);
@@ -2525,11 +2482,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
 }
 
 
@@ -2537,18 +2490,13 @@ const char *
 svn_fspath__dirname(const char *fspath,
                     apr_pool_t *pool)
 {
-  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),
+  if (fspath[0] == '/' && fspath[1] == '\0')
+    return apr_pstrdup(pool, fspath);
+  else
+    return apr_pstrcat(pool, "/", svn_relpath_dirname(fspath + 1, pool),
                        (char *)NULL);
-#endif
-
-  assert(svn_fspath__is_canonical(result));
-  return result;
 }
 
 
@@ -2559,11 +2507,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;
@@ -2593,16 +2537,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;
@@ -2617,16 +2557,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/branches/performance/subversion/libsvn_subr/error.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/error.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/error.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/error.c Wed Feb  2 13:04:51 2011
@@ -453,8 +453,9 @@ print_error(svn_error_t *err, FILE *stre
   /* Only print the same APR error string once. */
   else if (err->message)
     {
-      svn_error_clear(svn_cmdline_fprintf(stream, err->pool, "%s%s\n",
-                                          prefix, err->message));
+      svn_error_clear(svn_cmdline_fprintf(stream, err->pool,
+                                          "%sE%06d: %s\n",
+                                          prefix, err->apr_err, err->message));
     }
   else
     {
@@ -472,7 +473,8 @@ print_error(svn_error_t *err, FILE *stre
         }
 
       svn_error_clear(svn_cmdline_fprintf(stream, err->pool,
-                                          "%s%s\n", prefix, err_string));
+                                          "%sE%06d: %s\n",
+                                          prefix, err->apr_err, err_string));
     }
 }
 
@@ -567,8 +569,9 @@ svn_handle_warning2(FILE *stream, svn_er
 
   svn_error_clear(svn_cmdline_fprintf
                   (stream, err->pool,
-                   _("%swarning: %s\n"),
-                   prefix, svn_err_best_message(err, buf, sizeof(buf))));
+                   _("%swarning: W%06d: %s\n"),
+                   prefix, err->apr_err,
+                   svn_err_best_message(err, buf, sizeof(buf))));
   fflush(stream);
 }
 

Modified: subversion/branches/performance/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/io.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/io.c Wed Feb  2 13:04:51 2011
@@ -81,27 +81,53 @@
   retry loop cannot completely solve this problem either, but can
   help mitigate it.
 */
-#ifndef WIN32_RETRY_LOOP
-#if defined(WIN32) && !defined(SVN_NO_WIN32_RETRY_LOOP)
-#define WIN32_RETRY_LOOP(err, expr)                                        \
+#define RETRY_MAX_ATTEMPTS 100
+#define RETRY_INITIAL_SLEEP 1000
+#define RETRY_MAX_SLEEP 128000
+
+#define RETRY_LOOP(err, expr, retry_test, sleep_test)                      \
   do                                                                       \
     {                                                                      \
       apr_status_t os_err = APR_TO_OS_ERROR(err);                          \
-      int sleep_count = 1000;                                              \
+      int sleep_count = RETRY_INITIAL_SLEEP;                               \
       int retries;                                                         \
       for (retries = 0;                                                    \
-           retries < 100 && (os_err == ERROR_ACCESS_DENIED                 \
-                             || os_err == ERROR_SHARING_VIOLATION          \
-                             || os_err == ERROR_DIR_NOT_EMPTY);            \
-           ++retries, os_err = APR_TO_OS_ERROR(err))                       \
+           retries < RETRY_MAX_ATTEMPTS && (retry_test);                   \
+           os_err = APR_TO_OS_ERROR(err))                                  \
         {                                                                  \
-          apr_sleep(sleep_count);                                          \
-          if (sleep_count < 128000)                                        \
-            sleep_count *= 2;                                              \
+          if (sleep_test)                                                  \
+            {                                                              \
+              ++retries;                                                   \
+              apr_sleep(sleep_count);                                      \
+              if (sleep_count < RETRY_MAX_SLEEP)                           \
+                sleep_count *= 2;                                          \
+            }                                                              \
           (err) = (expr);                                                  \
         }                                                                  \
     }                                                                      \
   while (0)
+
+#if defined(EDEADLK) && APR_HAS_THREADS
+#define FILE_LOCK_RETRY_LOOP(err, expr)                                    \
+  RETRY_LOOP(err,                                                          \
+             expr,                                                         \
+             (APR_STATUS_IS_EINTR(err) || os_err == EDEADLK),              \
+             (!APR_STATUS_IS_EINTR(err)))
+#else
+#define FILE_LOCK_RETRY_LOOP(err, expr)                                    \
+  RETRY_LOOP(err,                                                          \
+             expr,                                                         \
+             (APR_STATUS_IS_EINTR(err)),                                   \
+             0)
+#endif
+
+#ifndef WIN32_RETRY_LOOP
+#if defined(WIN32) && !defined(SVN_NO_WIN32_RETRY_LOOP)
+#define WIN32_RETRY_LOOP(err, expr)                                        \
+  RETRY_LOOP(err, expr, (os_err == ERROR_ACCESS_DENIED                     \
+                         || os_err == ERROR_SHARING_VIOLATION              \
+                         || os_err == ERROR_DIR_NOT_EMPTY),                \
+             1)
 #else
 #define WIN32_RETRY_LOOP(err, expr) ((void)0)
 #endif
@@ -637,7 +663,7 @@ svn_io_copy_link(const char *src,
 }
 
 /* Temporary directory name cache for svn_io_temp_dir() */
-static volatile svn_atomic_t temp_dir_init_state;
+static volatile svn_atomic_t temp_dir_init_state = 0;
 static const char *temp_dir;
 
 /* Helper function to initialize temp dir. Passed to svn_atomic__init_once */
@@ -1067,14 +1093,15 @@ svn_error_t *svn_io_file_create(const ch
 {
   apr_file_t *f;
   apr_size_t written;
-  svn_error_t *err;
+  svn_error_t *err = SVN_NO_ERROR;
 
   SVN_ERR(svn_io_file_open(&f, file,
                            (APR_WRITE | APR_CREATE | APR_EXCL),
                            APR_OS_DEFAULT,
                            pool));
-  err= svn_io_file_write_full(f, contents, strlen(contents),
-                              &written, pool);
+  if (contents && *contents)
+    err = svn_io_file_write_full(f, contents, strlen(contents),
+                                 &written, pool);
 
 
   return svn_error_return(
@@ -1690,6 +1717,22 @@ svn_io_file_lock2(const char *lock_file,
 
   /* Get lock on the filehandle. */
   apr_err = apr_file_lock(lockfile_handle, locktype);
+
+  /* In deployments with two or more multithreaded servers running on
+     the same system serving two or more fsfs repositories it is
+     possible for a deadlock to occur when getting a write lock on
+     db/txn-current-lock:
+
+     Process 1                         Process 2
+     ---------                         ---------
+     thread 1: get lock in repos A
+                                       thread 1: get lock in repos B
+                                       thread 2: block getting lock in repos A
+     thread 2: try to get lock in B *** deadlock ***
+
+     Retry for a while for the deadlock to clear. */
+  FILE_LOCK_RETRY_LOOP(apr_err, apr_file_lock(lockfile_handle, locktype));
+
   if (apr_err)
     {
       switch (locktype & APR_FLOCK_TYPEMASK)

Modified: subversion/branches/performance/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/mergeinfo.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/mergeinfo.c Wed Feb  2 13:04:51 2011
@@ -32,6 +32,7 @@
 #include "svn_error_codes.h"
 #include "svn_string.h"
 #include "svn_mergeinfo.h"
+#include "private/svn_fspath.h"
 #include "private/svn_mergeinfo_private.h"
 #include "svn_private_config.h"
 #include "svn_hash.h"



Mime
View raw message