You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/09/11 18:54:21 UTC

svn commit: r1521935 [2/6] - in /subversion/branches/1.7.x-issue4153: ./ build/ac-macros/ contrib/hook-scripts/ doc/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/types/ subversion/bindings/javahl/src/or...

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_client/delete.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_client/delete.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_client/delete.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_client/delete.c Wed Sep 11 16:54:18 2013
@@ -210,6 +210,16 @@ single_repos_delete(svn_ra_session_t *ra
   return svn_error_trace(editor->close_edit(edit_baton, pool));
 }
 
+
+/* Structure for tracking remote delete targets associated with a
+   specific repository. */
+struct repos_deletables_t
+{
+  svn_ra_session_t *ra_session;
+  apr_array_header_t *target_uris;
+};
+
+
 static svn_error_t *
 delete_urls_multi_repos(const apr_array_header_t *uris,
                         const apr_hash_t *revprop_table,
@@ -218,91 +228,132 @@ delete_urls_multi_repos(const apr_array_
                         svn_client_ctx_t *ctx,
                         apr_pool_t *pool)
 {
-  apr_hash_t *sessions = apr_hash_make(pool);
-  apr_hash_t *relpaths = apr_hash_make(pool);
+  apr_hash_t *deletables = apr_hash_make(pool);
+  apr_pool_t *iterpool;
   apr_hash_index_t *hi;
   int i;
 
-  /* Create a hash of repos_root -> ra_session maps and repos_root -> relpaths
-     maps, used to group the various targets. */
+  /* Create a hash mapping repository root URLs -> repos_deletables_t *
+     structures.  */
   for (i = 0; i < uris->nelts; i++)
     {
       const char *uri = APR_ARRAY_IDX(uris, i, const char *);
-      svn_ra_session_t *ra_session = NULL;
-      const char *repos_root = NULL;
-      const char *repos_relpath = NULL;
-      apr_array_header_t *relpaths_list;
+      struct repos_deletables_t *repos_deletables = NULL;
+      const char *repos_relpath;
       svn_node_kind_t kind;
 
-      for (hi = apr_hash_first(pool, sessions); hi; hi = apr_hash_next(hi))
+      for (hi = apr_hash_first(pool, deletables); hi; hi = apr_hash_next(hi))
         {
-          repos_root = svn__apr_hash_index_key(hi);
-          repos_relpath = svn_uri__is_child(repos_root, uri, pool);
+          const char *repos_root = svn__apr_hash_index_key(hi);
 
+          repos_relpath = svn_uri__is_child(repos_root, uri, pool);
           if (repos_relpath)
             {
-              /* Great!  We've found another uri underneath this session,
-                 store it and move on. */
-              ra_session = svn__apr_hash_index_val(hi);
-              relpaths_list = apr_hash_get(relpaths, repos_root,
-                                           APR_HASH_KEY_STRING);
-
-              APR_ARRAY_PUSH(relpaths_list, const char *) = repos_relpath;
+              /* Great!  We've found another URI underneath this
+                 session.  We'll pick out the related RA session for
+                 use later, store the new target, and move on.  */
+              repos_deletables = svn__apr_hash_index_val(hi);
+              APR_ARRAY_PUSH(repos_deletables->target_uris, const char *) =
+                apr_pstrdup(pool, uri);
               break;
             }
         }
 
-      if (!ra_session)
+      /* If we haven't created a repos_deletable structure for this
+         delete target, we need to do.  That means opening up an RA
+         session and initializing its targets list.  */
+      if (!repos_deletables)
         {
-          /* If we haven't found a session yet, we need to open one up.
-             Note that we don't have a local directory, nor a place
-             to put temp files. */
+          svn_ra_session_t *ra_session = NULL;
+          const char *repos_root;
+          apr_array_header_t *target_uris;
+
+          /* Open an RA session to (ultimately) the root of the
+             repository in which URI is found.  */
           SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, uri,
                                                        NULL, NULL, FALSE,
                                                        TRUE, ctx, pool));
           SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root, pool));
           SVN_ERR(svn_ra_reparent(ra_session, repos_root, pool));
-
-          apr_hash_set(sessions, repos_root, APR_HASH_KEY_STRING, ra_session);
           repos_relpath = svn_uri__is_child(repos_root, uri, pool);
 
-          relpaths_list = apr_array_make(pool, 1, sizeof(const char *));
-          apr_hash_set(relpaths, repos_root, APR_HASH_KEY_STRING,
-                       relpaths_list);
-          APR_ARRAY_PUSH(relpaths_list, const char *) = repos_relpath;
+          /* Make a new relpaths list for this repository, and add
+             this URI's relpath to it. */
+          target_uris = apr_array_make(pool, 1, sizeof(const char *));
+          APR_ARRAY_PUSH(target_uris, const char *) = apr_pstrdup(pool, uri);
+
+          /* Build our repos_deletables_t item and stash it in the
+             hash. */
+          repos_deletables = apr_pcalloc(pool, sizeof(*repos_deletables));
+          repos_deletables->ra_session = ra_session;
+          repos_deletables->target_uris = target_uris;
+          apr_hash_set(deletables, repos_root,
+                       APR_HASH_KEY_STRING, repos_deletables);
         }
 
-      /* Check we identified a non-root relpath.  Return an RA error
-         code for 1.6 compatibility. */
+      /* If we get here, we should have been able to calculate a
+         repos_relpath for this URI.  Let's make sure.  (We return an
+         RA error code otherwise for 1.6 compatibility.)  */
       if (!repos_relpath || !*repos_relpath)
         return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
                                  "URL '%s' not within a repository", uri);
 
-      /* Now, test to see if the thing actually exists. */
-      SVN_ERR(svn_ra_check_path(ra_session, repos_relpath, SVN_INVALID_REVNUM,
-                                &kind, pool));
+      /* Now, test to see if the thing actually exists in HEAD. */
+      SVN_ERR(svn_ra_check_path(repos_deletables->ra_session, repos_relpath,
+                                SVN_INVALID_REVNUM, &kind, pool));
       if (kind == svn_node_none)
         return svn_error_createf(SVN_ERR_FS_NOT_FOUND, NULL,
                                  "URL '%s' does not exist", uri);
     }
 
-  /* At this point, we should have two hashs:
-      SESSIONS maps repos_roots to ra_sessions.
-      RELPATHS maps repos_roots to a list of decoded relpaths for that root.
-
-     Now we iterate over the collection of sessions and do a commit for each
-     one with the collected relpaths. */
-  for (hi = apr_hash_first(pool, sessions); hi; hi = apr_hash_next(hi))
+  /* Now we iterate over the DELETABLES hash, issuing a commit for
+     each repository with its associated collected targets. */
+  iterpool = svn_pool_create(pool);
+  for (hi = apr_hash_first(pool, deletables); hi; hi = apr_hash_next(hi))
     {
       const char *repos_root = svn__apr_hash_index_key(hi);
-      svn_ra_session_t *ra_session = svn__apr_hash_index_val(hi);
-      const apr_array_header_t *relpaths_list =
-        apr_hash_get(relpaths, repos_root, APR_HASH_KEY_STRING);
+      struct repos_deletables_t *repos_deletables = svn__apr_hash_index_val(hi);
+      const char *base_uri;
+      apr_array_header_t *target_relpaths;
+
+      svn_pool_clear(iterpool);
+
+      /* We want to anchor the commit on the longest common path
+         across the targets for this one repository.  If, however, one
+         of our targets is that longest common path, we need instead
+         anchor the commit on that path's immediate parent.  Because
+         we're asking svn_uri_condense_targets() to remove
+         redundancies, this situation should be detectable by their
+         being returned either a) only a single, empty-path, target
+         relpath, or b) no target relpaths at all.  */
+      SVN_ERR(svn_uri_condense_targets(&base_uri, &target_relpaths,
+                                       repos_deletables->target_uris,
+                                       TRUE, iterpool, iterpool));
+      SVN_ERR_ASSERT(!svn_path_is_empty(base_uri));
+      if (target_relpaths->nelts == 0)
+        {
+          const char *target_relpath;
 
-      SVN_ERR(single_repos_delete(ra_session, repos_root, relpaths_list,
+          svn_uri_split(&base_uri, &target_relpath, base_uri, iterpool);
+          APR_ARRAY_PUSH(target_relpaths, const char *) = target_relpath;
+        }
+      else if ((target_relpaths->nelts == 1)
+               && (svn_path_is_empty(APR_ARRAY_IDX(target_relpaths, 0,
+                                                   const char *))))
+        {
+          const char *target_relpath;
+
+          svn_uri_split(&base_uri, &target_relpath, base_uri, iterpool);
+          APR_ARRAY_IDX(target_relpaths, 0, const char *) = target_relpath;
+        }
+          
+      SVN_ERR(svn_ra_reparent(repos_deletables->ra_session, base_uri, pool));
+      SVN_ERR(single_repos_delete(repos_deletables->ra_session, repos_root,
+                                  target_relpaths,
                                   revprop_table, commit_callback,
-                                  commit_baton, ctx, pool));
+                                  commit_baton, ctx, iterpool));
     }
+  svn_pool_destroy(iterpool);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_client/externals.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_client/externals.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_client/externals.c Wed Sep 11 16:54:18 2013
@@ -1302,17 +1302,19 @@ svn_client__do_external_status(svn_clien
                                svn_boolean_t get_all,
                                svn_boolean_t update,
                                svn_boolean_t no_ignore,
+                               const char *anchor_abspath,
+                               const char *anchor_relpath,
                                svn_client_status_func_t status_func,
                                void *status_baton,
-                               apr_pool_t *pool)
+                               apr_pool_t *scratch_pool)
 {
   apr_hash_index_t *hi;
-  apr_pool_t *iterpool = svn_pool_create(pool);
+  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
 
   /* Loop over the hash of new values (we don't care about the old
      ones).  This is a mapping of versioned directories to property
      values. */
-  for (hi = apr_hash_first(pool, external_map);
+  for (hi = apr_hash_first(scratch_pool, external_map);
        hi;
        hi = apr_hash_next(hi))
     {
@@ -1321,6 +1323,7 @@ svn_client__do_external_status(svn_clien
       const char *defining_abspath = svn__apr_hash_index_val(hi);
       svn_node_kind_t kind;
       svn_opt_revision_t opt_rev;
+      const char *status_path;
 
       svn_pool_clear(iterpool);
 
@@ -1351,8 +1354,17 @@ svn_client__do_external_status(svn_clien
                                     svn_wc_notify_status_external,
                                     iterpool), iterpool);
 
+      status_path = local_abspath;
+      if (anchor_abspath)
+        {
+          status_path = svn_dirent_join(anchor_relpath,
+                           svn_dirent_skip_ancestor(anchor_abspath,
+                                                    status_path),
+                           iterpool);
+        }
+
       /* And then do the status. */
-      SVN_ERR(svn_client_status5(NULL, ctx, local_abspath, &opt_rev, depth,
+      SVN_ERR(svn_client_status5(NULL, ctx, status_path, &opt_rev, depth,
                                  get_all, update, no_ignore, FALSE, FALSE,
                                  NULL, status_func, status_baton,
                                  iterpool));

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_client/merge.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_client/merge.c Wed Sep 11 16:54:18 2013
@@ -6598,6 +6598,7 @@ do_file_merge(svn_mergeinfo_catalog_t re
               svn_boolean_t sources_related,
               svn_boolean_t squelch_mergeinfo_notifications,
               notification_receiver_baton_t *notify_b,
+              svn_boolean_t abort_on_conflicts,
               merge_cmd_baton_t *merge_b,
               apr_pool_t *scratch_pool)
 {
@@ -6862,10 +6863,13 @@ do_file_merge(svn_mergeinfo_catalog_t re
           SVN_ERR(svn_io_remove_file2(tmpfile1, TRUE, iterpool));
           SVN_ERR(svn_io_remove_file2(tmpfile2, TRUE, iterpool));
 
-          if ((i < (ranges_to_merge->nelts - 1))
+          if ((i < (ranges_to_merge->nelts - 1) || abort_on_conflicts)
               && is_path_conflicted_by_merge(merge_b))
             {
               conflicted_range = svn_merge_range_dup(r, scratch_pool);
+              /* Only record partial mergeinfo if only a partial merge was
+                 performed before a conflict was encountered. */
+              range.end = r->end;
               break;
             }
         }
@@ -6887,7 +6891,8 @@ do_file_merge(svn_mergeinfo_catalog_t re
         &filtered_rangelist,
         mergeinfo_path,
         merge_target->implicit_mergeinfo,
-        &range, iterpool));
+        &range,
+        iterpool));
 
       /* Only record mergeinfo if there is something other than
          self-referential mergeinfo, but don't record mergeinfo if
@@ -8801,6 +8806,11 @@ do_merge(apr_hash_t **modified_subtrees,
         APR_ARRAY_IDX(merge_sources, i, merge_source_t *);
       const char *url1, *url2;
       svn_revnum_t rev1, rev2;
+      /* If conflicts occur while merging any but the very last
+       * revision range we want an error to be raised that aborts
+       * the merge operation. The user will be asked to resolve conflicts
+       * before merging subsequent revision ranges. */
+      svn_boolean_t abort_on_conflicts = (i < merge_sources->nelts - 1);
 
       svn_pool_clear(iterpool);
 
@@ -8854,16 +8864,11 @@ do_merge(apr_hash_t **modified_subtrees,
                                 sources_related,
                                 squelch_mergeinfo_notifications,
                                 &notify_baton,
+                                abort_on_conflicts,
                                 &merge_cmd_baton, iterpool));
         }
       else if (target_kind == svn_node_dir)
         {
-          /* If conflicts occur while merging any but the very last
-           * revision range we want an error to be raised that aborts
-           * the merge operation. The user will be asked to resolve conflicts
-           * before merging subsequent revision ranges. */
-          svn_boolean_t abort_on_conflicts = (i < merge_sources->nelts - 1);
-
           SVN_ERR(do_directory_merge(result_catalog,
                                      url1, rev1, url2, rev2, target_abspath,
                                      depth, squelch_mergeinfo_notifications,
@@ -10577,6 +10582,32 @@ merge_reintegrate_locked(const char *sou
                               &working_revision, NULL, svn_depth_infinity,
                               NULL, ctx, scratch_pool, scratch_pool));
 
+  if (apr_hash_count(subtrees_with_mergeinfo))
+    {
+      apr_hash_t *externals;
+      apr_hash_index_t *hi;
+
+      SVN_ERR(svn_wc__externals_defined_below(&externals, ctx->wc_ctx,
+                                              target_abspath, scratch_pool,
+                                              scratch_pool));
+
+      for (hi = apr_hash_first(scratch_pool, subtrees_with_mergeinfo);
+           hi;
+           hi = apr_hash_next(hi))
+        {
+          const char *wc_path = svn__apr_hash_index_key(hi);
+
+          /* svn_client_propget4 picks up file externals with
+             mergeinfo, but we don't want those. */
+          if (apr_hash_get(externals, wc_path, APR_HASH_KEY_STRING))
+            {
+              apr_hash_set(subtrees_with_mergeinfo, wc_path,
+                           APR_HASH_KEY_STRING, NULL);
+              continue;
+            }
+        }
+    }
+
   /* Open two RA sessions, one to our source and one to our target. */
   no_rev.kind = svn_opt_revision_unspecified;
   SVN_ERR(svn_client__ra_session_from_path(&source_ra_session, &rev2, &url2,

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_client/repos_diff_summarize.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_client/repos_diff_summarize.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_client/repos_diff_summarize.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_client/repos_diff_summarize.c Wed Sep 11 16:54:18 2013
@@ -93,14 +93,11 @@ create_item_baton(struct edit_baton *edi
   struct item_baton *b = apr_pcalloc(pool, sizeof(*b));
 
   b->edit_baton = edit_baton;
-  /* Issue #2765: b->path is supposed to be relative to the target.
-     If the target is a file, just use an empty path.  This way the
-     receiver can just concatenate this path to the original path
-     without doing any extra checks. */
-  if (node_kind == svn_node_file && strcmp(path, edit_baton->target) == 0)
-    b->path =  "";
-  else
-    b->path = apr_pstrdup(pool, path);
+  /* Issues #2765 & #4408: b->path is supposed to be relative to the target.
+     This way the receiver can just concatenate this path to the original
+     path without doing any extra checks. */
+  b->path = apr_pstrdup(pool,
+                        svn_relpath_skip_ancestor(edit_baton->target, path));
   b->node_kind = node_kind;
   b->item_pool = pool;
 
@@ -130,12 +127,13 @@ ensure_summarize(struct item_baton *ib)
 
 /* An editor function. The root of the comparison hierarchy */
 static svn_error_t *
-open_root(void *edit_baton,
+open_root(void *eb,
           svn_revnum_t base_revision,
           apr_pool_t *pool,
           void **root_baton)
 {
-  struct item_baton *ib = create_item_baton(edit_baton, "",
+  struct edit_baton *b = eb;
+  struct item_baton *ib = create_item_baton(eb, b->target,
                                             svn_node_dir, pool);
 
   *root_baton = ib;
@@ -198,7 +196,8 @@ diff_deleted_dir(const char *dir,
 
       sum = apr_pcalloc(iterpool, sizeof(*sum));
       sum->summarize_kind = svn_client_diff_summarize_kind_deleted;
-      sum->path = path;
+      /* Issue #4408: sum->path should be relative to target. */
+      sum->path = svn_relpath_skip_ancestor(eb->target, path);
       sum->node_kind = kind;
 
       SVN_ERR(eb->summarize_func(sum,
@@ -240,7 +239,8 @@ delete_entry(const char *path,
 
   sum = apr_pcalloc(pool, sizeof(*sum));
   sum->summarize_kind = svn_client_diff_summarize_kind_deleted;
-  sum->path = path;
+  /* Issue #4408: sum->path should be relative to target. */
+  sum->path = svn_relpath_skip_ancestor(eb->target, path);
   sum->node_kind = kind;
 
   SVN_ERR(eb->summarize_func(sum, eb->summarize_func_baton, pool));

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_client/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_client/status.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_client/status.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_client/status.c Wed Sep 11 16:54:18 2013
@@ -519,6 +519,7 @@ svn_client_status5(svn_revnum_t *result_
       SVN_ERR(svn_client__do_external_status(ctx, external_map,
                                              depth, get_all,
                                              update, no_ignore,
+                                             sb.anchor_abspath, sb.anchor_relpath,
                                              status_func, status_baton, pool));
     }
 

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_client/update.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_client/update.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_client/update.c Wed Sep 11 16:54:18 2013
@@ -209,6 +209,7 @@ update_internal(svn_revnum_t *result_rev
   struct svn_client__dirent_fetcher_baton_t dfb;
   svn_boolean_t server_supports_depth;
   svn_boolean_t tree_conflicted;
+  svn_boolean_t cropping_target;
   svn_config_t *cfg = ctx->config ? apr_hash_get(ctx->config,
                                                  SVN_CONFIG_CATEGORY_CONFIG,
                                                  APR_HASH_KEY_STRING) : NULL;
@@ -268,7 +269,8 @@ update_internal(svn_revnum_t *result_rev
     }
 
   /* We may need to crop the tree if the depth is sticky */
-  if (depth_is_sticky && depth < svn_depth_infinity)
+  cropping_target = (depth_is_sticky && depth < svn_depth_infinity);
+  if (cropping_target)
     {
       svn_node_kind_t target_kind;
 
@@ -421,7 +423,8 @@ update_internal(svn_revnum_t *result_rev
   /* We handle externals after the update is complete, so that
      handling external items (and any errors therefrom) doesn't delay
      the primary operation.  */
-  if (SVN_DEPTH_IS_RECURSIVE(depth) && (! ignore_externals))
+  if ((SVN_DEPTH_IS_RECURSIVE(depth) || cropping_target)
+      && (! ignore_externals))
     {
       apr_hash_t *new_externals;
       apr_hash_t *new_depths;

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_diff/diff_file.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_diff/diff_file.c Wed Sep 11 16:54:18 2013
@@ -121,6 +121,9 @@ datasource_to_index(svn_diff_datasource_
  * whatsoever.  If there is a number someone comes up with that has some
  * argumentation, let's use that.
  */
+/* If you change this number, update test_norm_offset(),
+ * test_identical_suffix() and and test_token_compare()  in diff-diff3-test.c.
+ */
 #define CHUNK_SHIFT 17
 #define CHUNK_SIZE (1 << CHUNK_SHIFT)
 
@@ -430,7 +433,7 @@ find_identical_prefix(svn_boolean_t *rea
         }
 
       is_match = TRUE;
-      for (delta = 0; delta < max_delta && is_match; delta += sizeof(apr_uintptr_t))
+      for (delta = 0; delta < max_delta; delta += sizeof(apr_uintptr_t))
         {
           apr_uintptr_t chunk = *(const apr_size_t *)(file[0].curp + delta);
           if (contains_eol(chunk))
@@ -440,18 +443,25 @@ find_identical_prefix(svn_boolean_t *rea
             if (chunk != *(const apr_size_t *)(file[i].curp + delta))
               {
                 is_match = FALSE;
-                delta -= sizeof(apr_size_t);
                 break;
               }
+
+          if (! is_match)
+            break;
         }
 
-      /* We either found a mismatch or an EOL at or shortly behind curp+delta
-       * or we cannot proceed with chunky ops without exceeding endp.
-       * In any way, everything up to curp + delta is equal and not an EOL.
-       */
-      for (i = 0; i < file_len; i++)
-        file[i].curp += delta;
+      if (delta /* > 0*/)
+        {
+          /* We either found a mismatch or an EOL at or shortly behind curp+delta
+           * or we cannot proceed with chunky ops without exceeding endp.
+           * In any way, everything up to curp + delta is equal and not an EOL.
+           */
+          for (i = 0; i < file_len; i++)
+            file[i].curp += delta;
 
+          /* Skipped data without EOL markers, so last char was not a CR. */
+          had_cr = FALSE; 
+        }
 #endif
 
       *reached_one_eof = is_one_at_eof(file, file_len);
@@ -631,32 +641,41 @@ find_identical_suffix(apr_off_t *suffix_
         can_read_word = can_read_word
                         && (   file_for_suffix[i].curp - sizeof(apr_uintptr_t)
                             >= min_curp[i]);
-      if (can_read_word)
+      while (can_read_word)
         {
-          do
-            {
-              apr_uintptr_t chunk;
-              for (i = 0; i < file_len; i++)
-                file_for_suffix[i].curp -= sizeof(apr_uintptr_t);
+          apr_uintptr_t chunk;
 
-              chunk = *(const apr_uintptr_t *)(file_for_suffix[0].curp + 1);
-              if (contains_eol(chunk))
-                break;
+          /* For each file curp is positioned at the next byte to read, but we
+             want to examine the bytes before the current location. */
+
+          chunk = *(const apr_uintptr_t *)(file_for_suffix[0].curp + 1
+                                             - sizeof(apr_uintptr_t));
+          if (contains_eol(chunk))
+            break;
 
-              for (i = 0, can_read_word = TRUE; i < file_len; i++)
-                can_read_word = can_read_word
-                                && (   file_for_suffix[i].curp - sizeof(apr_uintptr_t)
-                                    >= min_curp[i]);
-              for (i = 1, is_match = TRUE; i < file_len; i++)
-                is_match = is_match
-                           && (   chunk
-                               == *(const apr_uintptr_t *)(file_for_suffix[i].curp + 1));
-            } while (can_read_word && is_match);
+          for (i = 1, is_match = TRUE; i < file_len; i++)
+            is_match = is_match
+                       && (   chunk
+                           == *(const apr_uintptr_t *)
+                                    (file_for_suffix[i].curp + 1
+                                       - sizeof(apr_uintptr_t)));
 
-            for (i = 0; i < file_len; i++)
-              file_for_suffix[i].curp += sizeof(apr_uintptr_t);
-        }
+          if (! is_match)
+            break;
+
+          for (i = 0; i < file_len; i++)
+            {
+              file_for_suffix[i].curp -= sizeof(apr_uintptr_t);
+              can_read_word = can_read_word
+                              && (   (file_for_suffix[i].curp
+                                        - sizeof(apr_uintptr_t))
+                                  >= min_curp[i]);
+            }
 
+          /* We skipped 4 bytes, so there are no closing EOLs */
+          had_nl = FALSE;
+          had_cr = FALSE;
+        }
 #endif
 
       reached_prefix = file_for_suffix[0].chunk == suffix_min_chunk0
@@ -868,6 +887,7 @@ datasource_get_next_token(apr_uint32_t *
   file_token->datasource = datasource;
   file_token->offset = chunk_to_offset(file->chunk)
                        + (curp - file->buffer);
+  file_token->norm_offset = file_token->offset;
   file_token->raw_length = 0;
   file_token->length = 0;
 
@@ -896,11 +916,21 @@ datasource_get_next_token(apr_uint32_t *
 
       length = endp - curp;
       file_token->raw_length += length;
-      svn_diff__normalize_buffer(&curp, &length,
-                                 &file->normalize_state,
-                                 curp, file_baton->options);
-      file_token->length += length;
-      h = svn__adler32(h, curp, length);
+      {
+        char *c = curp;
+
+        svn_diff__normalize_buffer(&c, &length,
+                                   &file->normalize_state,
+                                   curp, file_baton->options);
+        if (file_token->length == 0)
+          {
+            /* When we are reading the first part of the token, move the
+               normalized offset past leading ignored characters, if any. */
+            file_token->norm_offset += (c - curp);
+          }
+        file_token->length += length;
+        h = svn__adler32(h, c, length);
+      }
 
       curp = endp = file->buffer;
       file->chunk++;
@@ -939,11 +969,12 @@ datasource_get_next_token(apr_uint32_t *
       svn_diff__normalize_buffer(&c, &length,
                                  &file->normalize_state,
                                  curp, file_baton->options);
-
-      file_token->norm_offset = file_token->offset;
       if (file_token->length == 0)
-        /* move past leading ignored characters */
-        file_token->norm_offset += (c - curp);
+        {
+          /* When we are reading the first part of the token, move the
+             normalized offset past leading ignored characters, if any. */
+          file_token->norm_offset += (c - curp);
+        }
 
       file_token->length += length;
 
@@ -1015,8 +1046,15 @@ token_compare(void *baton, void *token1,
         }
       else
         {
+          apr_off_t skipped;
+
           length[i] = 0;
-          raw_length[i] = file_token[i]->raw_length;
+
+          /* When we skipped the first part of the token via the whitespace
+             normalization we must reduce the raw length of the token */
+          skipped = (file_token[i]->norm_offset - file_token[i]->offset);
+
+          raw_length[i] = file_token[i]->raw_length - skipped;
         }
     }
 
@@ -1052,6 +1090,8 @@ token_compare(void *baton, void *token1,
                  so, overwriting it isn't a problem */
               svn_diff__normalize_buffer(&bufp[i], &length[i], &state[i],
                                          bufp[i], file_baton->options);
+
+              /* assert(length[i] == file_token[i]->length); */
             }
         }
 

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_diff/parse-diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_diff/parse-diff.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_diff/parse-diff.c Wed Sep 11 16:54:18 2013
@@ -688,7 +688,6 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
                     original_end = hunk_text_end;
                   if (modified_end == 0)
                     modified_end = hunk_text_end;
-                  break;
                 }
 
               SVN_ERR(svn_io_file_seek(apr_file, APR_SET, &pos, iterpool));

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_fs/fs-loader.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_fs/fs-loader.c Wed Sep 11 16:54:18 2013
@@ -671,19 +671,20 @@ svn_fs_commit_txn(const char **conflict_
 {
 #ifdef PACK_AFTER_EVERY_COMMIT
   svn_fs_root_t *txn_root;
-  svn_fs_t *fs;
-  const char *fs_path;
+#endif
 
   *new_rev = SVN_INVALID_REVNUM;
+
+#if defined(PACK_AFTER_EVERY_COMMIT)
   SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
-  fs = svn_fs_root_fs(txn_root);
-  fs_path = svn_fs_path(fs, pool);
 #endif
 
   SVN_ERR(txn->vtable->commit(conflict_p, new_rev, txn, pool));
 
 #ifdef PACK_AFTER_EVERY_COMMIT
   {
+    svn_fs_t *fs = svn_fs_root_fs(txn_root);
+    const char *fs_path = svn_fs_path(fs, pool);
     svn_error_t *err = svn_fs_pack(fs_path, NULL, NULL, NULL, NULL, pool);
     if (err && err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE)
       /* Pre-1.6 filesystem. */

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/fs_fs.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/fs_fs.c Wed Sep 11 16:54:18 2013
@@ -5497,6 +5497,38 @@ choose_delta_base(representation_t **rep
   return SVN_NO_ERROR;
 }
 
+/* Something went wrong and the pool for the rep write is being
+   cleared before we've finished writing the rep.  So we need
+   to remove the rep from the protorevfile and we need to unlock
+   the protorevfile. */
+static apr_status_t
+rep_write_cleanup(void *data)
+{
+  struct rep_write_baton *b = data;
+  const char *txn_id = svn_fs_fs__id_txn_id(b->noderev->id);
+  svn_error_t *err;
+  
+  /* Truncate and close the protorevfile. */
+  err = svn_io_file_trunc(b->file, b->rep_offset, b->pool);
+  err = svn_error_compose_create(err, svn_io_file_close(b->file, b->pool));
+
+  /* Remove our lock regardless of any preceeding errors so that the 
+     being_written flag is always removed and stays consistent with the
+     file lock which will be removed no matter what since the pool is
+     going away. */
+  err = svn_error_compose_create(err, unlock_proto_rev(b->fs, txn_id,
+                                                       b->lockcookie, b->pool));
+  if (err)
+    {
+      apr_status_t rc = err->apr_err;
+      svn_error_clear(err);
+      return rc;
+    }
+
+  return APR_SUCCESS;
+}
+
+
 /* Get a rep_write_baton and store it in *WB_P for the representation
    indicated by NODEREV in filesystem FS.  Perform allocations in
    POOL.  Only appropriate for file contents, not for props or
@@ -5560,6 +5592,10 @@ rep_write_get_baton(struct rep_write_bat
   /* Now determine the offset of the actual svndiff data. */
   SVN_ERR(get_file_offset(&b->delta_start, file, b->pool));
 
+  /* Cleanup in case something goes wrong. */
+  apr_pool_cleanup_register(b->pool, b, rep_write_cleanup,
+                            apr_pool_cleanup_null);
+
   /* Prepare to write the svndiff data. */
   svn_txdelta_to_svndiff3(&wh,
                           &whb,
@@ -5667,6 +5703,9 @@ rep_write_contents_close(void *baton)
       b->noderev->data_rep = rep;
     }
 
+  /* Remove cleanup callback. */
+  apr_pool_cleanup_kill(b->pool, b, rep_write_cleanup);
+
   /* Write out the new node-rev information. */
   SVN_ERR(svn_fs_fs__put_node_revision(b->fs, b->noderev->id, b->noderev, FALSE,
                                        b->pool));

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/rep-cache.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/rep-cache.c Wed Sep 11 16:54:18 2013
@@ -45,26 +45,30 @@ open_rep_cache(void *baton,
 {
   svn_fs_t *fs = baton;
   fs_fs_data_t *ffd = fs->fsap_data;
+  svn_sqlite__db_t *sdb;
   const char *db_path;
   int version;
 
   /* Open (or create) the sqlite database.  It will be automatically
      closed when fs->pool is destoyed. */
   db_path = svn_dirent_join(fs->path, REP_CACHE_DB_NAME, pool);
-  SVN_ERR(svn_sqlite__open(&ffd->rep_cache_db, db_path,
+  SVN_ERR(svn_sqlite__open(&sdb, db_path,
                            svn_sqlite__mode_rwcreate, statements,
                            0, NULL,
                            fs->pool, pool));
 
-  SVN_ERR(svn_sqlite__read_schema_version(&version, ffd->rep_cache_db, pool));
+  SVN_ERR(svn_sqlite__read_schema_version(&version, sdb, pool));
   if (version < REP_CACHE_SCHEMA_FORMAT)
     {
       /* Must be 0 -- an uninitialized (no schema) database. Create
          the schema. Results in schema version of 1.  */
-      SVN_ERR(svn_sqlite__exec_statements(ffd->rep_cache_db,
-                                          STMT_CREATE_SCHEMA));
+      SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_CREATE_SCHEMA));
     }
 
+  /* This is used as a flag that the database is available so don't
+     set it earlier. */
+  ffd->rep_cache_db = sdb;
+
   return SVN_NO_ERROR;
 }
 

Propchange: subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/temp_serializer.c
------------------------------------------------------------------------------
  Merged /subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c:r1423646
  Merged /subversion/branches/1.7.x/subversion/libsvn_fs_fs/temp_serializer.c:r1338667-1521932
  Merged /subversion/branches/1.7.x-r1423646/subversion/libsvn_fs_fs/temp_serializer.c:r1423647-1424282

Propchange: subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/temp_serializer.h
------------------------------------------------------------------------------
  Merged /subversion/branches/1.7.x/subversion/libsvn_fs_fs/temp_serializer.h:r1338667-1521932
  Merged /subversion/branches/1.7.x-r1423646/subversion/libsvn_fs_fs/temp_serializer.h:r1423647-1424282
  Merged /subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.h:r1423646

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/tree.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_fs_fs/tree.c Wed Sep 11 16:54:18 2013
@@ -44,6 +44,7 @@
 #include "svn_private_config.h"
 #include "svn_pools.h"
 #include "svn_error.h"
+#include "svn_ctype.h"
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
 #include "svn_mergeinfo.h"
@@ -1806,6 +1807,78 @@ fs_dir_entries(apr_hash_t **table_p,
   return svn_fs_fs__dag_dir_entries(table_p, node, pool, pool);
 }
 
+/* Return a copy of PATH, allocated from POOL, for which control
+   characters have been escaped using the form \NNN (where NNN is the
+   octal representation of the byte's ordinal value).  */
+static const char *
+illegal_path_escape(const char *path, apr_pool_t *pool)
+{
+  svn_stringbuf_t *retstr;
+  apr_size_t i, copied = 0;
+  int c;
+
+  /* At least one control character:
+      strlen - 1 (control) + \ + N + N + N + null . */
+  retstr = svn_stringbuf_create_ensure(strlen(path) + 4, pool);
+  for (i = 0; path[i]; i++)
+    {
+      c = (unsigned char)path[i];
+      if (! svn_ctype_iscntrl(c))
+        continue;
+
+      /* If we got here, we're looking at a character that isn't
+         supported by the (or at least, our) URI encoding scheme.  We
+         need to escape this character.  */
+
+      /* First things first, copy all the good stuff that we haven't
+         yet copied into our output buffer. */
+      if (i - copied)
+        svn_stringbuf_appendbytes(retstr, path + copied,
+                                  i - copied);
+
+      /* Make sure buffer is big enough for '\' 'N' 'N' 'N' (and NUL) */
+      svn_stringbuf_ensure(retstr, retstr->len + 5);
+      /*### The backslash separator doesn't work too great with Windows,
+         but it's what we'll use for consistency with invalid utf8
+         formatting (until someone has a better idea) */
+      apr_snprintf(retstr->data + retstr->len, 5, "\\%03o", (unsigned char)c);
+      retstr->len += 4;
+
+      /* Finally, update our copy counter. */
+      copied = i + 1;
+    }
+
+  /* If we didn't encode anything, we don't need to duplicate the string. */
+  if (retstr->len == 0)
+    return path;
+
+  /* Anything left to copy? */
+  if (i - copied)
+    svn_stringbuf_appendbytes(retstr, path + copied, i - copied);
+
+  /* retstr is null-terminated either by apr_snprintf or the svn_stringbuf
+     functions. */
+
+  return retstr->data;
+}
+
+/* Raise an error if PATH contains a newline because FSFS cannot handle
+ * such paths. See issue #4340. */
+static svn_error_t *
+check_newline(const char *path, apr_pool_t *pool)
+{
+  const char *c;
+
+  for (c = path; *c; c++)
+    {
+      if (*c == '\n')
+        return svn_error_createf(SVN_ERR_FS_PATH_SYNTAX, NULL,
+           _("Invalid control character '0x%02x' in path '%s'"),
+           (unsigned char)*c, illegal_path_escape(path, pool));
+    }
+
+  return SVN_NO_ERROR;
+}
 
 /* Create a new directory named PATH in ROOT.  The new directory has
    no entries, and no properties.  ROOT must be the root of a
@@ -1820,6 +1893,8 @@ fs_make_dir(svn_fs_root_t *root,
   dag_node_t *sub_dir;
   const char *txn_id = root->txn;
 
+  SVN_ERR(check_newline(path, pool));
+
   SVN_ERR(open_path(&parent_path, root, path, open_path_last_optional,
                     txn_id, pool));
 
@@ -2082,6 +2157,8 @@ fs_copy(svn_fs_root_t *from_root,
         const char *to_path,
         apr_pool_t *pool)
 {
+  SVN_ERR(check_newline(to_path, pool));
+
   return svn_error_trace(copy_helper(from_root, from_path, to_root, to_path,
                                      TRUE, pool));
 }
@@ -2174,6 +2251,8 @@ fs_make_file(svn_fs_root_t *root,
   dag_node_t *child;
   const char *txn_id = root->txn;
 
+  SVN_ERR(check_newline(path, pool));
+
   SVN_ERR(open_path(&parent_path, root, path, open_path_last_optional,
                     txn_id, pool));
 

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/fetch.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/fetch.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/fetch.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/fetch.c Wed Sep 11 16:54:18 2013
@@ -796,7 +796,7 @@ svn_error_t *svn_ra_neon__get_dir(svn_ra
      need to create a bc_url. */
   if ((! SVN_IS_VALID_REVNUM(revision)) && (fetched_rev == NULL))
     {
-      final_url = url;
+      SVN_ERR(svn_ra_neon__get_url_path(&final_url, url, pool));
     }
   else
     {

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/props.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/props.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/props.c Wed Sep 11 16:54:18 2013
@@ -1313,9 +1313,7 @@ svn_ra_neon__do_check_path(svn_ra_sessio
 {
   svn_ra_neon__session_t *ras = session->priv;
   const char *url = ras->url->data;
-  const char *bc_url;
-  const char *bc_relative;
-  svn_error_t *err;
+  svn_error_t *err = SVN_NO_ERROR;
   svn_boolean_t is_dir;
 
   /* ### For now, using svn_ra_neon__get_starting_props() works because
@@ -1350,18 +1348,42 @@ svn_ra_neon__do_check_path(svn_ra_sessio
   if (path)
     url = svn_path_url_add_component2(url, path, pool);
 
-  err = svn_ra_neon__get_baseline_info(&bc_url, &bc_relative, NULL, ras,
-                                       url, revision, pool);
+  /* If we're querying HEAD, we can do so against the public URL;
+     otherwise, we have to get a revision-specific URL to work with.  */
+  if (SVN_IS_VALID_REVNUM(revision))
+    {
+      const char *bc_url;
+      const char *bc_relative;
+
+      err = svn_ra_neon__get_baseline_info(&bc_url, &bc_relative, NULL, ras,
+                                           url, revision, pool);
+      if (! err)
+        url = svn_path_url_add_component2(bc_url, bc_relative, pool);
+    }
+  else
+    {
+      ne_uri parsed_url;
+
+      /* svn_ra_neon__get_starting_props() wants only the path part of URL. */
+      ne_uri_parse(url, &parsed_url);
+      if (parsed_url.path)
+        {
+          url = apr_pstrdup(pool, parsed_url.path);
+        }
+      else
+        {
+          err = svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
+                                  _("Neon was unable to parse URL '%s'"), url);
+        }
+      ne_uri_free(&parsed_url);
+    }
 
   if (! err)
     {
       svn_ra_neon__resource_t *rsrc;
-      const char *full_bc_url = svn_path_url_add_component2(bc_url,
-                                                            bc_relative,
-                                                            pool);
-
-      /* query the DAV:resourcetype of the full, assembled URL. */
-      err = svn_ra_neon__get_starting_props(&rsrc, ras, full_bc_url, pool);
+          
+      /* Query the DAV:resourcetype.  */
+      err = svn_ra_neon__get_starting_props(&rsrc, ras, url, pool);
       if (! err)
         is_dir = rsrc->is_collection;
     }

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/ra_neon.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/ra_neon.h?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/ra_neon.h (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/ra_neon.h Wed Sep 11 16:54:18 2013
@@ -1173,6 +1173,13 @@ const char *
 svn_ra_neon__uri_unparse(const ne_uri *uri,
                          apr_pool_t *pool);
 
+/* Wrapper around ne_uri_parse() which parses a URL and returns only
+   the server path portion thereof. */
+svn_error_t *
+svn_ra_neon__get_url_path(const char **urlpath,
+                          const char *url,
+                          apr_pool_t *pool);
+
 /* Sets *SUPPORTS_DEADPROP_COUNT to non-zero if server supports
  * deadprop-count property. Uses FINAL_URL to discover this informationn
  * if it is not already cached. */

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/util.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_neon/util.c Wed Sep 11 16:54:18 2013
@@ -185,7 +185,7 @@ start_207_element(int *elem, void *baton
   if (parent == ELEM_prop)
     {
       svn_stringbuf_setempty(b->propname);
-      if (strcmp(nspace, SVN_DAV_PROP_NS_DAV) == 0)
+      if (strcmp(nspace, SVN_DAV_PROP_NS_SVN) == 0)
         svn_stringbuf_set(b->propname, SVN_PROP_PREFIX);
       else if (strcmp(nspace, "DAV:") == 0)
         svn_stringbuf_set(b->propname, "DAV:");
@@ -1600,6 +1600,29 @@ svn_ra_neon__uri_unparse(const ne_uri *u
   return result;
 }
 
+svn_error_t *
+svn_ra_neon__get_url_path(const char **urlpath,
+                          const char *url,
+                          apr_pool_t *pool)
+{
+  ne_uri parsed_url;
+  svn_error_t *err = SVN_NO_ERROR;
+
+  ne_uri_parse(url, &parsed_url);
+  if (parsed_url.path)
+    {
+      *urlpath = apr_pstrdup(pool, parsed_url.path);
+    }
+  else
+    {
+      err = svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
+                              _("Neon was unable to parse URL '%s'"), url);
+    }
+  ne_uri_free(&parsed_url);
+
+  return err;
+}
+
 /* Sets *SUPPORTS_DEADPROP_COUNT to non-zero if server supports
  * deadprop-count property. */
 svn_error_t *

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/commit.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/commit.c Wed Sep 11 16:54:18 2013
@@ -1370,24 +1370,37 @@ open_root(void *edit_baton,
     }
   else
     {
-      svn_ra_serf__options_context_t *opt_ctx;
       svn_ra_serf__simple_request_context_t *mkact_ctx;
-      const char *activity_str;
+      const char *activity_str = ctx->session->activity_collection_url;
 
-      SVN_ERR(svn_ra_serf__create_options_req(&opt_ctx, ctx->session,
-                                              ctx->session->conns[0],
-                                              ctx->session->session_url.path,
-                                              ctx->pool));
-
-      SVN_ERR(svn_ra_serf__context_run_wait(
-        svn_ra_serf__get_options_done_ptr(opt_ctx),
-        ctx->session, ctx->pool));
-
-      activity_str = svn_ra_serf__options_get_activity_collection(opt_ctx);
       if (!activity_str)
-        return svn_error_create(SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
-                                _("The OPTIONS response did not include the "
-                                  "requested activity-collection-set value"));
+        {
+          svn_ra_serf__options_context_t *opt_ctx;
+
+          SVN_ERR(svn_ra_serf__create_options_req(&opt_ctx, ctx->session,
+                                                  ctx->session->conns[0],
+                                                  ctx->session->session_url.path,
+                                                  ctx->pool));
+
+          SVN_ERR(svn_ra_serf__context_run_wait(
+                      svn_ra_serf__get_options_done_ptr(opt_ctx),
+                      ctx->session, ctx->pool));
+
+          activity_str = svn_ra_serf__options_get_activity_collection(opt_ctx);
+        }
+
+      /* Cache the result. */
+      if (activity_str)
+        {
+          ctx->session->activity_collection_url =
+            apr_pstrdup(ctx->session->pool, activity_str);
+        }
+      else
+        {
+          return svn_error_create(SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
+                                  _("The OPTIONS response did not include the "
+                                    "requested activity-collection-set value"));
+        }
 
       ctx->activity_url =
         svn_path_url_add_component2(activity_str, svn_uuid_generate(ctx->pool),

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/options.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/options.c Wed Sep 11 16:54:18 2013
@@ -516,11 +516,22 @@ svn_ra_serf__exchange_capabilities(svn_r
       return SVN_NO_ERROR;
     }
 
-  return svn_error_compose_create(
-             svn_ra_serf__error_on_status(opt_ctx->status_code,
-                                          serf_sess->session_url.path,
-                                          opt_ctx->parser_ctx->location),
-             err);
+  SVN_ERR(svn_error_compose_create(
+              svn_ra_serf__error_on_status(opt_ctx->status_code,
+                                           serf_sess->session_url.path,
+                                           opt_ctx->parser_ctx->location),
+              err));
+
+  /* Opportunistically cache any reported activity URL.  (We don't
+     want to have to ask for this again later, potentially against an
+     unreadable commit anchor URL.)  */
+  if (opt_ctx->activity_collection)
+    {
+      serf_sess->activity_collection_url =
+        apr_pstrdup(serf_sess->pool, opt_ctx->activity_collection);
+    }
+
+  return SVN_NO_ERROR;
 }
 
 

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/ra_serf.h?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/ra_serf.h Wed Sep 11 16:54:18 2013
@@ -163,6 +163,10 @@ struct svn_ra_serf__session_t {
      constants' addresses, therefore). */
   apr_hash_t *capabilities;
 
+  /* Activity collection URL.  (Cached from the initial OPTIONS
+     request when run against HTTPv1 servers.)  */
+  const char *activity_collection_url;
+
   /* Are we using a proxy? */
   int using_proxy;
 

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/util.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_serf/util.c Wed Sep 11 16:54:18 2013
@@ -242,11 +242,12 @@ ssl_server_cert(void *baton, int failure
       for (i = 0; i < san->nelts; i++) {
           char *s = APR_ARRAY_IDX(san, i, char*);
           if (apr_fnmatch(s, conn->hostname,
-                          APR_FNM_PERIOD) == APR_SUCCESS) {
+                          APR_FNM_PERIOD | APR_FNM_CASE_BLIND) == APR_SUCCESS)
+            {
               found_matching_hostname = 1;
               cert_info.hostname = s;
               break;
-          }
+            }
       }
   }
 
@@ -254,7 +255,7 @@ ssl_server_cert(void *baton, int failure
   if (!found_matching_hostname && cert_info.hostname)
     {
       if (apr_fnmatch(cert_info.hostname, conn->hostname,
-                      APR_FNM_PERIOD) == APR_FNM_NOMATCH)
+                      APR_FNM_PERIOD | APR_FNM_CASE_BLIND) == APR_FNM_NOMATCH)
         {
           svn_failures |= SVN_AUTH_SSL_CNMISMATCH;
         }
@@ -758,7 +759,12 @@ start_error(svn_ra_serf__xml_parser_t *p
           SVN_ERR(svn_cstring_atoi64(&val, err_code));
           ctx->error->apr_err = (apr_status_t)val;
         }
-      else
+
+      /* If there's no error code provided, or if the provided code is
+         0 (which can happen sometimes depending on how the error is
+         constructed on the server-side), just pick a generic error
+         code to run with. */
+      if (! ctx->error->apr_err)
         {
           ctx->error->apr_err = SVN_ERR_RA_DAV_REQUEST_FAILED;
         }
@@ -1901,7 +1907,8 @@ handle_response(serf_request_t *request,
 
       if (err
           && (!SERF_BUCKET_READ_ERROR(err->apr_err)
-               || APR_STATUS_IS_ECONNRESET(err->apr_err)))
+               || APR_STATUS_IS_ECONNRESET(err->apr_err)
+               || APR_STATUS_IS_ECONNABORTED(err->apr_err)))
         {
           /* These errors are special cased in serf
              ### We hope no handler returns these by accident. */

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_svn/client.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_ra_svn/client.c Wed Sep 11 16:54:18 2013
@@ -1510,10 +1510,10 @@ static svn_error_t *ra_svn_log(svn_ra_se
           log_entry->has_children = has_children;
           log_entry->subtractive_merge = subtractive_merge;
           if (rplist)
-            SVN_ERR(svn_ra_svn_parse_proplist(rplist, pool,
+            SVN_ERR(svn_ra_svn_parse_proplist(rplist, iterpool,
                                               &log_entry->revprops));
           if (log_entry->revprops == NULL)
-            log_entry->revprops = apr_hash_make(pool);
+            log_entry->revprops = apr_hash_make(iterpool);
           if (revprops == NULL)
             {
               /* Caller requested all revprops; set author/date/log. */

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/authz.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/authz.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/authz.c Wed Sep 11 16:54:18 2013
@@ -714,14 +714,15 @@ static svn_boolean_t authz_validate_sect
 {
   struct authz_validate_baton *b = baton;
 
-  /* If the section is the groups definition, use the group checking
-     callback. Otherwise, use the rule checking callback. */
-  if (strncmp(name, "groups", 6) == 0)
+  /* Use the group checking callback for the "groups" section... */
+  if (strcmp(name, "groups") == 0)
     svn_config_enumerate2(b->config, name, authz_validate_group,
                           baton, pool);
-  else if (strncmp(name, "aliases", 7) == 0)
+  /* ...and the alias checking callback for "aliases"... */
+  else if (strcmp(name, "aliases") == 0)
     svn_config_enumerate2(b->config, name, authz_validate_alias,
                           baton, pool);
+  /* ...but for everything else use the rule checking callback. */
   else
     svn_config_enumerate2(b->config, name, authz_validate_rule,
                           baton, pool);

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/dump.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/dump.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/dump.c Wed Sep 11 16:54:18 2013
@@ -34,6 +34,7 @@
 #include "svn_time.h"
 #include "svn_checksum.h"
 #include "svn_props.h"
+#include "svn_sorts.h"
 
 #include "private/svn_mergeinfo_private.h"
 #include "private/svn_fs_private.h"
@@ -733,17 +734,20 @@ close_directory(void *dir_baton,
 {
   struct dir_baton *db = dir_baton;
   struct edit_baton *eb = db->edit_baton;
-  apr_hash_index_t *hi;
   apr_pool_t *subpool = svn_pool_create(pool);
+  unsigned int i;
+  apr_array_header_t *sorted_entries;
 
-  for (hi = apr_hash_first(pool, db->deleted_entries);
-       hi;
-       hi = apr_hash_next(hi))
+  /* Sort entries lexically instead of as paths. Even though the entries
+   * are full paths they're all in the same directory (see comment in struct
+   * dir_baton definition). So we really want to sort by basename, in which
+   * case the lexical sort function is more efficient. */
+  sorted_entries = svn_sort__hash(db->deleted_entries,
+                                  svn_sort_compare_items_lexically, pool);
+  for (i = 0; i < sorted_entries->nelts; i++)
     {
-      const void *key;
-      const char *path;
-      apr_hash_this(hi, &key, NULL, NULL);
-      path = key;
+      const char *path = APR_ARRAY_IDX(sorted_entries, i,
+                                       svn_sort__item_t).key;
 
       svn_pool_clear(subpool);
 

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/load-fs-vtable.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/load-fs-vtable.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/load-fs-vtable.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_repos/load-fs-vtable.c Wed Sep 11 16:54:18 2013
@@ -154,12 +154,12 @@ change_rev_prop(svn_repos_t *repos,
                 apr_pool_t *pool)
 {
   if (validate_props)
-    return svn_fs_change_rev_prop2(svn_repos_fs(repos), revision, name,
-                                   NULL, value, pool);
-  else
     return svn_repos_fs_change_rev_prop4(repos, revision, NULL, name,
                                          NULL, value, FALSE, FALSE,
                                          NULL, NULL, pool);
+  else
+    return svn_fs_change_rev_prop2(svn_repos_fs(repos), revision, name,
+                                   NULL, value, pool);
 }
 
 /* Change property NAME to VALUE for PATH in TXN_ROOT.  If

Propchange: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/adler32.c
------------------------------------------------------------------------------
  Merged /subversion/trunk/subversion/libsvn_subr/adler32.c:r1423646
  Merged /subversion/branches/1.7.x-r1423646/subversion/libsvn_subr/adler32.c:r1423647-1424282
  Merged /subversion/branches/1.7.x/subversion/libsvn_subr/adler32.c:r1338667-1521932

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/dirent_uri.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/dirent_uri.c Wed Sep 11 16:54:18 2013
@@ -2443,7 +2443,17 @@ svn_uri_get_file_url_from_dirent(const c
       *url = apr_pstrcat(pool, "file:", dirent, NULL);
     }
   else
-    *url = apr_pstrcat(pool, "file:///", dirent, NULL);
+    {
+      char *uri = apr_pstrcat(pool, "file:///", dirent, NULL);
+      apr_size_t len = 8 /* strlen("file:///") */ + strlen(dirent);
+
+      /* "C:/" is a canonical dirent on Windows,
+         but "file:///C:/" is not a canonical uri */
+      if (uri[len-1] == '/')
+        uri[len-1] = '\0';
+
+      *url = uri;
+    }
 #endif
 
   return SVN_NO_ERROR;

Propchange: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/hash.c
------------------------------------------------------------------------------
  Merged /subversion/trunk/subversion/libsvn_subr/hash.c:r1423646
  Merged /subversion/branches/1.7.x/subversion/libsvn_subr/hash.c:r1338667-1521932
  Merged /subversion/branches/1.7.x-r1423646/subversion/libsvn_subr/hash.c:r1423647-1424282

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/io.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/io.c Wed Sep 11 16:54:18 2013
@@ -3250,17 +3250,8 @@ svn_io_write_unique(const char **tmp_pat
 
   err = svn_io_file_write_full(new_file, buf, nbytes, NULL, pool);
 
-  /* ### BH: Windows doesn't have the race condition between the write and the
-     ###     rename that other operating systems might have. So allow windows
-     ###     to decide when it wants to perform the disk synchronization using
-     ###     the normal file locking and journaling filesystem rules.
-
-     ### Note that this function doesn't handle the rename, so we aren't even
-     ### sure that we really have to sync. */
-#ifndef WIN32
-  if (!err && nbytes > 0)
+  if (!err)
     err = svn_io_file_flush_to_disk(new_file, pool);
-#endif
 
   return svn_error_trace(
                   svn_error_compose_create(err,

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/macos_keychain.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/macos_keychain.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/macos_keychain.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/macos_keychain.c Wed Sep 11 16:54:18 2013
@@ -65,8 +65,9 @@
 
 /* Implementation of svn_auth__password_set_t that stores
    the password in the OS X KeyChain. */
-static svn_boolean_t
-keychain_password_set(apr_hash_t *creds,
+static svn_error_t *
+keychain_password_set(svn_boolean_t *done,
+                      apr_hash_t *creds,
                       const char *realmstring,
                       const char *username,
                       const char *password,
@@ -106,13 +107,16 @@ keychain_password_set(apr_hash_t *creds,
   if (non_interactive)
     SecKeychainSetUserInteractionAllowed(TRUE);
 
-  return status == 0;
+  *done = (status == 0);
+
+  return SVN_NO_ERROR;
 }
 
 /* Implementation of svn_auth__password_get_t that retrieves
    the password from the OS X KeyChain. */
-static svn_boolean_t
-keychain_password_get(const char **password,
+static svn_error_t *
+keychain_password_get(svn_boolean_t *done,
+                      const char **password,
                       apr_hash_t *creds,
                       const char *realmstring,
                       const char *username,
@@ -124,6 +128,8 @@ keychain_password_get(const char **passw
   UInt32 length;
   void *data;
 
+  *done = FALSE;
+
   if (non_interactive)
     SecKeychainSetUserInteractionAllowed(FALSE);
 
@@ -137,11 +143,12 @@ keychain_password_get(const char **passw
     SecKeychainSetUserInteractionAllowed(TRUE);
 
   if (status != 0)
-    return FALSE;
+    return SVN_NO_ERROR;
 
   *password = apr_pstrmemdup(pool, data, length);
   SecKeychainItemFreeContent(NULL, data);
-  return TRUE;
+  *done = TRUE;
+  return SVN_NO_ERROR;
 }
 
 /* Get cached encrypted credentials from the simple provider's cache. */

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/nls.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/nls.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/nls.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/nls.c Wed Sep 11 16:54:18 2013
@@ -56,7 +56,6 @@ svn_nls_init(void)
       char* utf8_path;
       const char* internal_path;
       apr_pool_t* pool;
-      apr_status_t apr_err;
       apr_size_t inwords, outbytes, outlength;
 
       apr_pool_create(&pool, 0);
@@ -99,10 +98,10 @@ svn_nls_init(void)
 
           if (outbytes == 0)
             {
-              err = svn_error_createf(apr_err, NULL,
-                                      _("Can't convert module path "
-                                        "to UTF-8 from UCS-2: '%s'"),
-                                      ucs2_path);
+              err = svn_error_wrap_apr(apr_get_os_error(),
+                                       _("Can't convert module path "
+                                         "to UTF-8 from UCS-2: '%s'"),
+                                       ucs2_path);
             }
           else
             {

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/opt.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/opt.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/opt.c Wed Sep 11 16:54:18 2013
@@ -1088,7 +1088,7 @@ svn_opt__print_version_info(const char *
                                      "   compiled %s, %s\n\n"), pgm_name,
                              SVN_VERSION, __DATE__, __TIME__));
   SVN_ERR(svn_cmdline_fputs(
-             _("Copyright (C) 2012 The Apache Software Foundation.\n"
+             _("Copyright (C) 2013 The Apache Software Foundation.\n"
                "This software consists of contributions made by many "
                "people; see the NOTICE\n"
                "file for more information.\n"

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/simple_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/simple_providers.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/simple_providers.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/simple_providers.c Wed Sep 11 16:54:18 2013
@@ -62,8 +62,9 @@ typedef struct simple_provider_baton_t
 
 /* Implementation of svn_auth__password_get_t that retrieves
    the plaintext password from CREDS. */
-svn_boolean_t
-svn_auth__simple_password_get(const char **password,
+svn_error_t *
+svn_auth__simple_password_get(svn_boolean_t *done,
+                              const char **password,
                               apr_hash_t *creds,
                               const char *realmstring,
                               const char *username,
@@ -72,6 +73,9 @@ svn_auth__simple_password_get(const char
                               apr_pool_t *pool)
 {
   svn_string_t *str;
+
+  *done = FALSE;
+
   str = apr_hash_get(creds, AUTHN_USERNAME_KEY, APR_HASH_KEY_STRING);
   if (str && username && strcmp(str->data, username) == 0)
     {
@@ -79,16 +83,18 @@ svn_auth__simple_password_get(const char
       if (str && str->data)
         {
           *password = str->data;
-          return TRUE;
+          *done = TRUE;
         }
     }
-  return FALSE;
+
+  return SVN_NO_ERROR;
 }
 
 /* Implementation of svn_auth__password_set_t that stores
    the plaintext password in CREDS. */
-svn_boolean_t
-svn_auth__simple_password_set(apr_hash_t *creds,
+svn_error_t *
+svn_auth__simple_password_set(svn_boolean_t *done,
+                              apr_hash_t *creds,
                               const char *realmstring,
                               const char *username,
                               const char *password,
@@ -98,7 +104,9 @@ svn_auth__simple_password_set(apr_hash_t
 {
   apr_hash_set(creds, AUTHN_PASSWORD_KEY, APR_HASH_KEY_STRING,
                svn_string_create(password, pool));
-  return TRUE;
+  *done = TRUE;
+
+  return SVN_NO_ERROR;
 }
 
 /* Set **USERNAME to the username retrieved from CREDS; ignore
@@ -211,8 +219,12 @@ svn_auth__simple_first_creds_helper(void
         {
           if (have_passtype)
             {
-              if (!password_get(&default_password, creds_hash, realmstring,
-                                username, parameters, non_interactive, pool))
+              svn_boolean_t done;
+
+              SVN_ERR(password_get(&done, &default_password, creds_hash,
+                                   realmstring, username, parameters,
+                                   non_interactive, pool));
+              if (!done)
                 {
                   need_to_save = TRUE;
                 }
@@ -241,9 +253,12 @@ svn_auth__simple_first_creds_helper(void
                 password = NULL;
               else
                 {
-                  if (!password_get(&password, creds_hash, realmstring,
-                                    username, parameters, non_interactive,
-                                    pool))
+                  svn_boolean_t done;
+
+                  SVN_ERR(password_get(&done, &password, creds_hash,
+                                       realmstring, username, parameters,
+                                       non_interactive, pool));
+                  if (!done)
                     password = NULL;
 
                   /* If the auth data didn't contain a password type,
@@ -452,9 +467,9 @@ svn_auth__simple_save_creds_helper(svn_b
 
       if (may_save_password)
         {
-          *saved = password_set(creds_hash, realmstring,
-                                creds->username, creds->password,
-                                parameters, non_interactive, pool);
+          SVN_ERR(password_set(saved, creds_hash, realmstring,
+                               creds->username, creds->password,
+                               parameters, non_interactive, pool));
           if (*saved && passtype)
             /* Store the password type with the auth data, so that we
                know which provider owns the password. */

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/ssl_client_cert_pw_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/ssl_client_cert_pw_providers.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/ssl_client_cert_pw_providers.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/ssl_client_cert_pw_providers.c Wed Sep 11 16:54:18 2013
@@ -63,8 +63,9 @@ typedef struct ssl_client_cert_pw_file_p
 /* This implements the svn_auth__password_get_t interface.
    Set **PASSPHRASE to the plaintext passphrase retrieved from CREDS;
    ignore other parameters. */
-svn_boolean_t
-svn_auth__ssl_client_cert_pw_get(const char **passphrase,
+svn_error_t *
+svn_auth__ssl_client_cert_pw_get(svn_boolean_t *done,
+                                 const char **passphrase,
                                  apr_hash_t *creds,
                                  const char *realmstring,
                                  const char *username,
@@ -77,15 +78,18 @@ svn_auth__ssl_client_cert_pw_get(const c
   if (str && str->data)
     {
       *passphrase = str->data;
-      return TRUE;
+      *done = TRUE;
+      return SVN_NO_ERROR;
     }
-  return FALSE;
+  *done = FALSE;
+  return SVN_NO_ERROR;
 }
 
 /* This implements the svn_auth__password_set_t interface.
    Store PASSPHRASE in CREDS; ignore other parameters. */
-svn_boolean_t
-svn_auth__ssl_client_cert_pw_set(apr_hash_t *creds,
+svn_error_t *
+svn_auth__ssl_client_cert_pw_set(svn_boolean_t *done,
+                                 apr_hash_t *creds,
                                  const char *realmstring,
                                  const char *username,
                                  const char *passphrase,
@@ -95,7 +99,8 @@ svn_auth__ssl_client_cert_pw_set(apr_has
 {
   apr_hash_set(creds, AUTHN_PASSPHRASE_KEY, APR_HASH_KEY_STRING,
                svn_string_create(passphrase, pool));
-  return TRUE;
+  *done = TRUE;
+  return SVN_NO_ERROR;
 }
 
 svn_error_t *
@@ -137,8 +142,11 @@ svn_auth__ssl_client_cert_pw_file_first_
       svn_error_clear(err);
       if (! err && creds_hash)
         {
-          if (!passphrase_get(&password, creds_hash, realmstring,
-                              NULL, parameters, non_interactive, pool))
+          svn_boolean_t done;
+
+          SVN_ERR(passphrase_get(&done, &password, creds_hash, realmstring,
+                                 NULL, parameters, non_interactive, pool));
+          if (!done)
             password = NULL;
         }
     }
@@ -301,9 +309,9 @@ svn_auth__ssl_client_cert_pw_file_save_c
 
       if (may_save_passphrase)
         {
-          *saved = passphrase_set(creds_hash, realmstring,
-                                  NULL, creds->password, parameters,
-                                  non_interactive, pool);
+          SVN_ERR(passphrase_set(saved, creds_hash, realmstring,
+                                 NULL, creds->password, parameters,
+                                 non_interactive, pool));
 
           if (*saved && passtype)
             {

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/subst.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/subst.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/subst.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/subst.c Wed Sep 11 16:54:18 2013
@@ -1743,7 +1743,12 @@ svn_subst_copy_and_translate4(const char
     }
 
   /* Now that dst_tmp contains the translated data, do the atomic rename. */
-  return svn_error_trace(svn_io_file_rename(dst_tmp, dst, pool));
+  SVN_ERR(svn_io_file_rename(dst_tmp, dst, pool));
+
+  /* Preserve the source file's permission bits. */
+  SVN_ERR(svn_io_copy_perms(src, dst, pool));
+
+  return SVN_NO_ERROR;
 }
 
 

Propchange: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/svn_base64.c
------------------------------------------------------------------------------
  Merged /subversion/trunk/subversion/libsvn_subr/svn_base64.c:r1423646
  Merged /subversion/branches/1.7.x/subversion/libsvn_subr/svn_base64.c:r1338667-1521932
  Merged /subversion/branches/1.7.x-r1423646/subversion/libsvn_subr/svn_base64.c:r1423647-1424282

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/svn_cache_config.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/svn_cache_config.c?rev=1521935&r1=1521934&r2=1521935&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/svn_cache_config.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_subr/svn_cache_config.c Wed Sep 11 16:54:18 2013
@@ -52,7 +52,7 @@ static svn_cache_config_t cache_settings
                   * has little impact on performance and a more modest
                   * value (< 100) may be more suitable.
                   */
-#ifdef APR_HAS_THREADS
+#if APR_HAS_THREADS
     FALSE        /* assume multi-threaded operation.
                   * Because this simply activates proper synchronization
                   * between threads, it is a safe default.