Modified: subversion/branches/svn-auth-x509/subversion/include/svn_string.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/include/svn_string.h?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/include/svn_string.h (original)
+++ subversion/branches/svn-auth-x509/subversion/include/svn_string.h Fri Jan 
16 14:01:35 2015
@@ -308,7 +308,7 @@ void
 svn_stringbuf_appendbyte(svn_stringbuf_t *targetstr,
                          char byte);
 
-/** Append an array of bytes onto @a targetstr.
+/** Append the array of bytes @a bytes of length @a count onto @a targetstr.
  *
  * reallocs if necessary. @a targetstr is affected, nothing else is.
  *
@@ -345,14 +345,15 @@ void
 svn_stringbuf_appendcstr(svn_stringbuf_t *targetstr,
                          const char *cstr);
 
-/** Read @a count bytes from @a bytes and insert them into @a str at
- * position @a pos and following.  The resulting string will be
- * @c count+str->len bytes long.  If @c pos is larger or equal to the
- * number of bytes currently used in @a str,  simply append @a bytes.
+/** Insert into @a str at position @a pos an array of bytes @a bytes
+ * which is @a count bytes long.
+ *
+ * The resulting string will be @c count+str->len bytes long.  If
+ * @a pos is larger than or equal to @c str->len, simply append @a bytes.
  *
  * Reallocs if necessary. @a str is affected, nothing else is.
  *
- * @note The inserted string may be a sub-range if @a str.
+ * @note The inserted string may be a sub-range of @a str.
  *
  * @since New in 1.8.
  *
@@ -364,9 +365,10 @@ svn_stringbuf_insert(svn_stringbuf_t *st
                      const char *bytes,
                      apr_size_t count);
 
-/** Removes @a count bytes from @a str, starting at position @a pos.
- * If that range exceeds the current string data,  @a str gets truncated
- * at @a pos.  If the latter is larger or equal to @c str->pos, this will
+/** Remove @a count bytes from @a str, starting at position @a pos.
+ *
+ * If that range exceeds the current string data, truncate @a str at
+ * @a pos.  If @a pos is larger than or equal to @c str->len, this will
  * be a no-op.  Otherwise, the resulting string will be @c str->len-count
  * bytes long.
  *
@@ -378,8 +380,8 @@ svn_stringbuf_remove(svn_stringbuf_t *st
                      apr_size_t count);
 
 /** Replace in @a str the substring which starts at @a pos and is @a
- * old_count bytes long with a new substring @a bytes (which is @a
- * new_count bytes long).
+ * old_count bytes long with a new substring @a bytes which is @a
+ * new_count bytes long.
  *
  * This is faster but functionally equivalent to the following sequence:
  * @code

Modified: subversion/branches/svn-auth-x509/subversion/include/svn_version.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/include/svn_version.h?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/include/svn_version.h 
(original)
+++ subversion/branches/svn-auth-x509/subversion/include/svn_version.h Fri Jan 
16 14:01:35 2015
@@ -82,7 +82,7 @@ extern "C" {
 
 /** Version tag: a string describing the version.
  *
- * This tag remains " (dev build)" in the repository so that we can
+ * This tag remains " (under development)" in the repository so that we can
  * always see from "svn --version" that the software has been built
  * from the repository rather than a "blessed" distribution.
  *
@@ -175,10 +175,25 @@ struct svn_version_t
  * Generate the implementation of a version query function.
  *
  * @since New in 1.1.
+ * @since Since 1.9, embeds a string into the compiled object
+ *        file that can be queried with the 'what' utility.
  */
-#define SVN_VERSION_BODY \
-  SVN_VERSION_DEFINE(versioninfo);              \
-  return &versioninfo
+#define SVN_VERSION_BODY            \
+  static struct versioninfo_t       \
+    {                               \
+      const char *const str;        \
+      const svn_version_t num;      \
+    } const versioninfo =           \
+    {                               \
+      "@(#)" SVN_VERSION,           \
+      {                             \
+        SVN_VER_MAJOR,              \
+        SVN_VER_MINOR,              \
+        SVN_VER_PATCH,              \
+        SVN_VER_NUMTAG              \
+      }                             \
+    };                              \
+  return &versioninfo.num
 
 /**
  * Check library version compatibility. Return #TRUE if the client's

Modified: subversion/branches/svn-auth-x509/subversion/include/svn_wc.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/include/svn_wc.h?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/include/svn_wc.h (original)
+++ subversion/branches/svn-auth-x509/subversion/include/svn_wc.h Fri Jan 16 
14:01:35 2015
@@ -907,13 +907,15 @@ svn_wc_external_item_dup(const svn_wc_ex
  *
  * Allocate the table, keys, and values in @a pool.
  *
- * Use @a parent_directory only in constructing error strings.
+ * @a defining_directory is the path or URL of the directory on which
+ * the svn:externals property corresponding to @a desc is set.
+ * @a defining_directory is only used when constructing error strings.
  *
  * @since New in 1.5.
  */
 svn_error_t *
 svn_wc_parse_externals_description3(apr_array_header_t **externals_p,
-                                    const char *parent_directory,
+                                    const char *defining_directory,
                                     const char *desc,
                                     svn_boolean_t canonicalize_url,
                                     apr_pool_t *pool);

Modified: 
subversion/branches/svn-auth-x509/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- 
subversion/branches/svn-auth-x509/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
 (original)
+++ 
subversion/branches/svn-auth-x509/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
 Fri Jan 16 14:01:35 2015
@@ -49,120 +49,19 @@
 /*-----------------------------------------------------------------------*/
 
 
-struct gnome_keyring_baton
-{
-  const char *keyring_name;
-  GnomeKeyringInfo *info;
-  GMainLoop *loop;
-};
-
-
-/* Callback function to destroy gnome_keyring_baton. */
-static void
-callback_destroy_data_keyring(void *data)
-{
-  struct gnome_keyring_baton *key_info = data;
-
-  if (data == NULL)
-    return;
-
-  free((void*)key_info->keyring_name);
-  key_info->keyring_name = NULL;
-
-  if (key_info->info)
-    {
-      gnome_keyring_info_free(key_info->info);
-      key_info->info = NULL;
-    }
-
-  return;
-}
-
-
-/* Callback function to complete the keyring operation. */
-static void
-callback_done(GnomeKeyringResult result,
-              gpointer data)
-{
-  struct gnome_keyring_baton *key_info = data;
-
-  g_main_loop_quit(key_info->loop);
-  return;
-}
-
-
-/* Callback function to get the keyring info. */
-static void
-callback_get_info_keyring(GnomeKeyringResult result,
-                          GnomeKeyringInfo *info,
-                          void *data)
-{
-  struct gnome_keyring_baton *key_info = data;
-
-  if (result == GNOME_KEYRING_RESULT_OK && info != NULL)
-    {
-      key_info->info = gnome_keyring_info_copy(info);
-    }
-  else
-    {
-      if (key_info->info != NULL)
-        gnome_keyring_info_free(key_info->info);
-
-      key_info->info = NULL;
-    }
-
-  g_main_loop_quit(key_info->loop);
-
-  return;
-}
-
-
-/* Callback function to get the default keyring string name. */
-static void
-callback_default_keyring(GnomeKeyringResult result,
-                         const char *string,
-                         void *data)
-{
-  struct gnome_keyring_baton *key_info = data;
-
-  if (result == GNOME_KEYRING_RESULT_OK && string != NULL)
-    {
-      key_info->keyring_name = strdup(string);
-    }
-  else
-    {
-      free((void*)key_info->keyring_name);
-      key_info->keyring_name = NULL;
-    }
-
-  g_main_loop_quit(key_info->loop);
-
-  return;
-}
-
 /* Returns the default keyring name, allocated in RESULT_POOL. */
 static char*
 get_default_keyring_name(apr_pool_t *result_pool)
 {
-  char *def = NULL;
-  struct gnome_keyring_baton key_info;
-
-  key_info.info = NULL;
-  key_info.keyring_name = NULL;
+  char *name, *def;
+  GnomeKeyringResult gkr;
 
-  /* Finds default keyring. */
-  key_info.loop = g_main_loop_new(NULL, FALSE);
-  gnome_keyring_get_default_keyring(callback_default_keyring, &key_info, NULL);
-  g_main_loop_run(key_info.loop);
-
-  if (key_info.keyring_name == NULL)
-    {
-      callback_destroy_data_keyring(&key_info);
-      return NULL;
-    }
+  gkr = gnome_keyring_get_default_keyring_sync(&name);
+  if (gkr != GNOME_KEYRING_RESULT_OK)
+    return NULL;
 
-  def = apr_pstrdup(result_pool, key_info.keyring_name);
-  callback_destroy_data_keyring(&key_info);
+  def = apr_pstrdup(result_pool, name);
+  g_free(name);
 
   return def;
 }
@@ -171,28 +70,22 @@ get_default_keyring_name(apr_pool_t *res
 static svn_boolean_t
 check_keyring_is_locked(const char *keyring_name)
 {
-  struct gnome_keyring_baton key_info;
+  GnomeKeyringInfo *info;
+  svn_boolean_t locked;
+  GnomeKeyringResult gkr;
 
-  key_info.info = NULL;
-  key_info.keyring_name = NULL;
+  gkr = gnome_keyring_get_info_sync(keyring_name, &info);
+  if (gkr != GNOME_KEYRING_RESULT_OK)
+    return FALSE;
 
-  /* Get details about the default keyring. */
-  key_info.loop = g_main_loop_new(NULL, FALSE);
-  gnome_keyring_get_info(keyring_name, callback_get_info_keyring, &key_info,
-                         NULL);
-  g_main_loop_run(key_info.loop);
-
-  if (key_info.info == NULL)
-    {
-      callback_destroy_data_keyring(&key_info);
-      return FALSE;
-    }
-
-  /* Check if keyring is locked. */
-  if (gnome_keyring_info_get_is_locked(key_info.info))
-    return TRUE;
+  if (gnome_keyring_info_get_is_locked(info))
+    locked = TRUE;
   else
-    return FALSE;
+    locked = FALSE;
+
+  gnome_keyring_info_free(info);
+
+  return locked;
 }
 
 /* Unlock the KEYRING_NAME with the KEYRING_PASSWORD. If KEYRING was
@@ -202,34 +95,19 @@ unlock_gnome_keyring(const char *keyring
                      const char *keyring_password,
                      apr_pool_t *pool)
 {
-  struct gnome_keyring_baton key_info;
+  GnomeKeyringInfo *info;
+  GnomeKeyringResult gkr;
 
-  key_info.info = NULL;
-  key_info.keyring_name = NULL;
+  gkr = gnome_keyring_get_info_sync(keyring_name, &info);
+  if (gkr != GNOME_KEYRING_RESULT_OK)
+    return FALSE;
 
-  /* Get details about the default keyring. */
-  key_info.loop = g_main_loop_new(NULL, FALSE);
-  gnome_keyring_get_info(keyring_name, callback_get_info_keyring,
-                         &key_info, NULL);
-  g_main_loop_run(key_info.loop);
-
-  if (key_info.info == NULL)
-    {
-      callback_destroy_data_keyring(&key_info);
-      return FALSE;
-    }
-  else
-    {
-      key_info.loop = g_main_loop_new(NULL, FALSE);
-      gnome_keyring_unlock(keyring_name, keyring_password,
-                           callback_done, &key_info, NULL);
-      g_main_loop_run(key_info.loop);
-    }
-  callback_destroy_data_keyring(&key_info);
-  if (check_keyring_is_locked(keyring_name))
+  gkr = gnome_keyring_unlock_sync(keyring_name, keyring_password);
+  gnome_keyring_info_free(info);
+  if (gkr != GNOME_KEYRING_RESULT_OK)
     return FALSE;
 
-  return TRUE;
+  return check_keyring_is_locked(keyring_name);
 }
 
 

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/add.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/add.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/add.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/add.c Fri Jan 16 
14:01:35 2015
@@ -1270,11 +1270,7 @@ svn_client__make_local_parents(const cha
   else
     SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
 
-  /* Should no longer use svn_depth_empty to indicate that only the directory
-     itself is added, since it not only constraints the operation depth, but
-     also defines the depth of the target directory now. Moreover, the new
-     directory will have no children at all.*/
-  err = svn_client_add5(local_abspath, svn_depth_infinity, FALSE, FALSE, FALSE,
+  err = svn_client_add5(local_abspath, svn_depth_empty, FALSE, FALSE, FALSE,
                         make_parents, ctx, scratch_pool);
 
   /* If we created a new directory, but couldn't add it to version

Modified: 
subversion/branches/svn-auth-x509/subversion/libsvn_client/commit_util.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/commit_util.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/commit_util.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/commit_util.c 
Fri Jan 16 14:01:35 2015
@@ -779,7 +779,6 @@ harvest_status_callback(void *status_bat
                                       wc_ctx, svn_dirent_dirname(local_abspath,
                                                                  scratch_pool),
                                       FALSE /* ignore_enoent */,
-                                      FALSE /* show_hidden */,
                                       scratch_pool, scratch_pool));
 
       if (copy_mode_root || status->switched || node_rev != dir_rev)

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/copy.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/copy.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/copy.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/copy.c Fri Jan 
16 14:01:35 2015
@@ -1058,8 +1058,13 @@ repos_to_repos_copy(const apr_array_head
       SVN_ERR(svn_ra_check_path(ra_session, dst_rel, SVN_INVALID_REVNUM,
                                 &dst_kind, pool));
       if (dst_kind != svn_node_none)
-        return svn_error_createf(SVN_ERR_FS_ALREADY_EXISTS, NULL,
-                                 _("Path '%s' already exists"), dst_rel);
+        {
+          const char *path = svn_uri_skip_ancestor(repos_root,
+                                                   pair->dst_abspath_or_url,
+                                                   pool);
+          return svn_error_createf(SVN_ERR_FS_ALREADY_EXISTS, NULL,
+                                   _("Path '/%s' already exists"), path);
+        }
 
       /* More info for our INFO structure.  */
       info->src_path = src_rel;

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/diff.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/diff.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/diff.c Fri Jan 
16 14:01:35 2015
@@ -154,9 +154,6 @@ adjust_paths_for_diff_labels(const char
         new_path = ".";
       else
         return MAKE_ERR_BAD_RELATIVE_PATH(new_path, relative_to_dir);
-
-      child_path = svn_dirent_is_child(relative_to_dir, new_path1,
-                                       result_pool);
     }
 
   {

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/externals.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/externals.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/externals.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/externals.c Fri 
Jan 16 14:01:35 2015
@@ -186,7 +186,6 @@ switch_dir_external(const char *local_ab
                                 &repos_root_url, &repos_uuid,
                                 NULL, ctx->wc_ctx, local_abspath,
                                 TRUE, /* ignore_enoent */
-                                TRUE, /* show hidden */
                                 pool, pool));
   if (kind != svn_node_unknown)
     {
@@ -380,14 +379,15 @@ switch_dir_external(const char *local_ab
   return SVN_NO_ERROR;
 }
 
-/* Try to update a file external at LOCAL_ABSPATH to URL at REVISION using a
-   access baton that has a write lock.  Use SCRATCH_POOL for temporary
+/* Try to update a file external at LOCAL_ABSPATH to SWITCH_LOC. This function
+   assumes caller has a write lock in CTX.  Use SCRATCH_POOL for temporary
    allocations, and use the client context CTX. */
 static svn_error_t *
 switch_file_external(const char *local_abspath,
-                     const char *url,
-                     const svn_opt_revision_t *peg_revision,
-                     const svn_opt_revision_t *revision,
+                     const svn_client__pathrev_t *switch_loc,
+                     const char *record_url,
+                     const svn_opt_revision_t *record_peg_revision,
+                     const svn_opt_revision_t *record_revision,
                      const char *def_dir_abspath,
                      svn_ra_session_t *ra_session,
                      svn_client_ctx_t *ctx,
@@ -464,7 +464,8 @@ switch_file_external(const char *local_a
               SVN_ERR_CLIENT_FILE_EXTERNAL_OVERWRITE_VERSIONED, 0,
              _("The file external from '%s' cannot overwrite the existing "
                "versioned item at '%s'"),
-             url, svn_dirent_local_style(local_abspath, scratch_pool));
+             switch_loc->url,
+             svn_dirent_local_style(local_abspath, scratch_pool));
         }
     }
   else
@@ -486,25 +487,17 @@ switch_file_external(const char *local_a
     void *report_baton;
     const svn_delta_editor_t *switch_editor;
     void *switch_baton;
-    svn_client__pathrev_t *switch_loc;
     svn_revnum_t revnum;
     apr_array_header_t *inherited_props;
-    const char *dir_abspath;
-    const char *target;
+    const char *target = svn_dirent_basename(local_abspath, scratch_pool);
 
-    svn_dirent_split(&dir_abspath, &target, local_abspath, scratch_pool);
-
-    /* Open an RA session to 'source' URL */
-    SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &switch_loc,
-                                              url, dir_abspath,
-                                              peg_revision, revision,
-                                              ctx, scratch_pool));
     /* Get the external file's iprops. */
     SVN_ERR(svn_ra_get_inherited_props(ra_session, &inherited_props, "",
                                        switch_loc->rev,
                                        scratch_pool, scratch_pool));
 
-    SVN_ERR(svn_ra_reparent(ra_session, svn_uri_dirname(url, scratch_pool),
+    SVN_ERR(svn_ra_reparent(ra_session,
+                            svn_uri_dirname(switch_loc->url, scratch_pool),
                             scratch_pool));
 
     SVN_ERR(svn_wc__get_file_external_editor(&switch_editor, &switch_baton,
@@ -518,7 +511,9 @@ switch_file_external(const char *local_a
                                              use_commit_times,
                                              diff3_cmd, preserved_exts,
                                              def_dir_abspath,
-                                             url, peg_revision, revision,
+                                             record_url,
+                                             record_peg_revision,
+                                             record_revision,
                                              ctx->cancel_func,
                                              ctx->cancel_baton,
                                              ctx->notify_func2,
@@ -529,7 +524,7 @@ switch_file_external(const char *local_a
      invalid revnum, that means RA will use the latest revision. */
     SVN_ERR(svn_ra_do_switch3(ra_session, &reporter, &report_baton,
                               switch_loc->rev,
-                              target, svn_depth_unknown, url,
+                              target, svn_depth_unknown, switch_loc->url,
                               FALSE /* send_copyfrom */,
                               TRUE /* ignore_ancestry */,
                               switch_editor, switch_baton,
@@ -742,6 +737,8 @@ handle_external_item_change(svn_client_c
                                                   &(new_item->peg_revision),
                                                   &(new_item->revision), ctx,
                                                   scratch_pool));
+
+          SVN_ERR(svn_ra_reparent(ra_session, new_loc->url, scratch_pool));
         }
     }
 
@@ -856,6 +853,7 @@ handle_external_item_change(svn_client_c
           }
 
         SVN_ERR(switch_file_external(local_abspath,
+                                     new_loc,
                                      new_url,
                                      &new_item->peg_revision,
                                      &new_item->revision,

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/info.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/info.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/info.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/info.c Fri Jan 
16 14:01:35 2015
@@ -388,8 +388,7 @@ svn_client_info4(const char *abspath_or_
   SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &pathrev,
                                             abspath_or_url, NULL, peg_revision,
                                             revision, ctx, pool));
-
-  svn_uri_split(NULL, &base_name, pathrev->url, pool);
+  base_name = svn_uri_basename(pathrev->url, pool);
 
   /* Get the dirent for the URL itself. */
   SVN_ERR(svn_ra_stat(ra_session, "", pathrev->rev, &the_ent, pool));

Modified: 
subversion/branches/svn-auth-x509/subversion/libsvn_client/locking_commands.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/locking_commands.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- 
subversion/branches/svn-auth-x509/subversion/libsvn_client/locking_commands.c 
(original)
+++ 
subversion/branches/svn-auth-x509/subversion/libsvn_client/locking_commands.c 
Fri Jan 16 14:01:35 2015
@@ -375,7 +375,6 @@ organize_lock_targets(apr_array_header_t
                                             &wli->lock_token,
                                             wc_ctx, local_abspath,
                                             FALSE /* ignore_enoent */,
-                                            FALSE /* show_hidden */,
                                             result_pool, iterpool));
 
               if (kind != svn_node_file)
@@ -403,10 +402,9 @@ organize_lock_targets(apr_array_header_t
                                 _("Unable to lock/unlock across multiple "
                                   "repositories"));
 
-      /* Now we need to create a couple of different hash mappings. */
+      /* Now we need to create our mapping. */
       rel_fs_paths = apr_hash_make(result_pool);
-      target_urls = apr_array_make(scratch_pool, targets->nelts,
-                                   sizeof(const char *));
+
       for (hi = apr_hash_first(scratch_pool, wc_info);
            hi;
            hi = apr_hash_next(hi))

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/log.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/log.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/log.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/log.c Fri Jan 16 
14:01:35 2015
@@ -852,10 +852,12 @@ svn_client_log5(const apr_array_header_t
   svn_ra_session_t *ra_session;
   const char *old_session_url;
   const char *ra_target;
+  const char *path_or_url;
   svn_opt_revision_t youngest_opt_rev;
   svn_revnum_t youngest_rev;
   svn_revnum_t oldest_rev;
   svn_opt_revision_t peg_rev;
+  svn_client__pathrev_t *ra_session_loc;
   svn_client__pathrev_t *actual_loc;
   apr_array_header_t *log_segments;
   apr_array_header_t *revision_ranges;
@@ -875,7 +877,7 @@ svn_client_log5(const apr_array_header_t
   SVN_ERR(resolve_log_targets(&relative_targets, &ra_target, &peg_rev,
                               targets, ctx, pool, pool));
 
-  SVN_ERR(svn_client__ra_session_from_path2(&ra_session, NULL,
+  SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &ra_session_loc,
                                             ra_target, NULL, &peg_rev, 
&peg_rev,
                                             ctx, pool));
 
@@ -889,11 +891,22 @@ svn_client_log5(const apr_array_header_t
                                                    opt_rev_ranges, &peg_rev,
                                                    ctx, pool,  pool));
 
+  /* For some peg revisions we must resolve revision and url via a local path
+     so use the original RA_TARGET. For others, use the potentially corrected
+     (redirected) ra session URL. */
+  if (peg_rev.kind == svn_opt_revision_previous ||
+      peg_rev.kind == svn_opt_revision_base ||
+      peg_rev.kind == svn_opt_revision_committed ||
+      peg_rev.kind == svn_opt_revision_working)
+    path_or_url = ra_target;
+  else
+    path_or_url = ra_session_loc->url;
+
   /* Make ACTUAL_LOC and RA_SESSION point to the youngest operative rev. */
   youngest_opt_rev.kind = svn_opt_revision_number;
   youngest_opt_rev.value.number = youngest_rev;
   SVN_ERR(svn_client__resolve_rev_and_url(&actual_loc, ra_session,
-                                          ra_target, &peg_rev,
+                                          path_or_url, &peg_rev,
                                           &youngest_opt_rev, ctx, pool));
   SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url, ra_session,
                                             actual_loc->url, pool));

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/merge.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/merge.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/merge.c Fri Jan 
16 14:01:35 2015
@@ -4706,7 +4706,6 @@ calculate_remaining_ranges(svn_client__m
                                 NULL, NULL, NULL, NULL,
                                 ctx->wc_ctx, child->abspath,
                                 TRUE /* ignore_enoent */,
-                                FALSE /* show_hidden */,
                                 scratch_pool, scratch_pool));
   /* If CHILD has no base revision then it hasn't been committed yet, so it
      can't have any "future" history. */

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/mergeinfo.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/mergeinfo.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/mergeinfo.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/mergeinfo.c Fri 
Jan 16 14:01:35 2015
@@ -224,7 +224,6 @@ svn_client__get_wc_mergeinfo(svn_mergein
   SVN_ERR(svn_wc__node_get_base(NULL, &base_revision, NULL, NULL, NULL, NULL,
                                 ctx->wc_ctx, local_abspath,
                                 TRUE /* ignore_enoent */,
-                                FALSE /* show_hidden */,
                                 scratch_pool, scratch_pool));
 
   iterpool = svn_pool_create(scratch_pool);
@@ -295,7 +294,7 @@ svn_client__get_wc_mergeinfo(svn_mergein
           SVN_ERR(svn_wc__node_get_base(NULL, &parent_base_rev, NULL, NULL,
                                         NULL, NULL,
                                         ctx->wc_ctx, local_abspath,
-                                        TRUE, FALSE,
+                                        TRUE /* ignore_enoent */,
                                         scratch_pool, scratch_pool));
 
           /* ### This checks the WORKING changed_rev, so invalid on replacement

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/mtcc.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/mtcc.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/mtcc.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/mtcc.c Fri Jan 
16 14:01:35 2015
@@ -337,7 +337,6 @@ svn_client__mtcc_create(svn_client__mtcc
 
   *mtcc = apr_pcalloc(mtcc_pool, sizeof(**mtcc));
   (*mtcc)->pool = mtcc_pool;
-  (*mtcc)->base_revision = base_revision;
 
   (*mtcc)->root_op = mtcc_op_create(NULL, FALSE, TRUE, mtcc_pool);
 
@@ -350,9 +349,12 @@ svn_client__mtcc_create(svn_client__mtcc
   SVN_ERR(svn_ra_get_latest_revnum((*mtcc)->ra_session, 
&(*mtcc)->head_revision,
                                    scratch_pool));
 
-  if (! SVN_IS_VALID_REVNUM(base_revision))
-    base_revision = (*mtcc)->head_revision;
-  else if (base_revision > (*mtcc)->head_revision)
+  if (SVN_IS_VALID_REVNUM(base_revision))
+    (*mtcc)->base_revision = base_revision;
+  else
+    (*mtcc)->base_revision = (*mtcc)->head_revision;
+
+  if ((*mtcc)->base_revision > (*mtcc)->head_revision)
     return svn_error_createf(SVN_ERR_FS_NO_SUCH_REVISION, NULL,
                              _("No such revision %ld (HEAD is %ld)"),
                              base_revision, (*mtcc)->head_revision);

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/patch.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/patch.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/patch.c Fri Jan 
16 14:01:35 2015
@@ -48,6 +48,7 @@
 #include "private/svn_dep_compat.h"
 #include "private/svn_string_private.h"
 #include "private/svn_subr_private.h"
+#include "private/svn_sorts_private.h"
 
 typedef struct hunk_info_t {
   /* The hunk. */
@@ -1578,7 +1579,8 @@ match_existing_target(svn_boolean_t *mat
 /* Determine the line at which a HUNK applies to CONTENT of the TARGET
  * file, and return an appropriate hunk_info object in *HI, allocated from
  * RESULT_POOL. Use fuzz factor FUZZ. Set HI->FUZZ to FUZZ. If no correct
- * line can be determined, set HI->REJECTED to TRUE.
+ * line can be determined, set HI->REJECTED to TRUE.  PREVIOUS_OFFSET
+ * is the offset at which the previous matching hunk was applied, or zero.
  * IGNORE_WHITESPACE tells whether whitespace should be considered when
  * matching. IS_PROP_HUNK indicates whether the hunk patches file content
  * or a property.
@@ -1590,6 +1592,7 @@ static svn_error_t *
 get_hunk_info(hunk_info_t **hi, patch_target_t *target,
               target_content_t *content,
               svn_diff_hunk_t *hunk, svn_linenum_t fuzz,
+              apr_int64_t previous_offset,
               svn_boolean_t ignore_whitespace,
               svn_boolean_t is_prop_hunk,
               svn_cancel_func_t cancel_func, void *cancel_baton,
@@ -1599,7 +1602,7 @@ get_hunk_info(hunk_info_t **hi, patch_ta
   svn_linenum_t original_start;
   svn_boolean_t already_applied;
 
-  original_start = svn_diff_hunk_get_original_start(hunk);
+  original_start = svn_diff_hunk_get_original_start(hunk) + previous_offset;
   already_applied = FALSE;
 
   /* An original offset of zero means that this hunk wants to create
@@ -1707,7 +1710,9 @@ get_hunk_info(hunk_info_t **hi, patch_ta
               modified_start = svn_diff_hunk_get_modified_start(hunk);
               if (modified_start == 0)
                 {
-                  /* Patch wants to delete the file. */
+                  /* Patch wants to delete the file.
+
+                     ### locally_deleted is always false here? */
                   already_applied = target->locally_deleted;
                 }
               else
@@ -1728,26 +1733,73 @@ get_hunk_info(hunk_info_t **hi, patch_ta
 
           if (! already_applied)
             {
-              /* Scan the whole file again from the start. */
-              SVN_ERR(seek_to_line(content, 1, scratch_pool));
+              int i;
+              svn_linenum_t search_start = 1, search_end = 0;
+              svn_linenum_t matched_line2;
+
+              /* Search for closest match before or after original
+                 start.  We have no backward search so search forwards
+                 from the previous match (or start of file) to the
+                 original start looking for the last match.  Then
+                 search forwards from the original start looking for a
+                 better match.  Finally search forwards from the start
+                 of file to the previous hunk if that could result in
+                 a better match. */
 
-              /* Scan forward towards the hunk's line and look for a line
-               * where the hunk matches. */
+              for (i = content->hunks->nelts; i > 0; --i)
+                {
+                  const hunk_info_t *prev
+                    = APR_ARRAY_IDX(content->hunks, i - 1, const hunk_info_t 
*);
+                  if (!prev->rejected)
+                    {
+                      svn_linenum_t length;
+
+                      length = svn_diff_hunk_get_original_length(prev->hunk);
+                      search_start = prev->matched_line + length;
+                      break;
+                    }
+                }
+
+              /* Search from the previous match, or start of file,
+                 towards the original location. */
+              SVN_ERR(seek_to_line(content, search_start, scratch_pool));
               SVN_ERR(scan_for_match(&matched_line, content, hunk, FALSE,
                                      original_start, fuzz,
                                      ignore_whitespace, FALSE,
                                      cancel_func, cancel_baton,
                                      scratch_pool));
 
-              /* In tie-break situations, we arbitrarily prefer early matches
-               * to save us from scanning the rest of the file. */
-              if (matched_line == 0)
+              /* If a match we only need to search forwards for a
+                 better match, otherwise to the end of the file. */
+              if (matched_line)
+                search_end = original_start + (original_start - matched_line);
+
+              /* Search from original location, towards the end. */
+              SVN_ERR(seek_to_line(content, original_start + 1, scratch_pool));
+              SVN_ERR(scan_for_match(&matched_line2, content, hunk,
+                                     TRUE, search_end, fuzz, ignore_whitespace,
+                                     FALSE, cancel_func, cancel_baton,
+                                     scratch_pool));
+
+              /* Chose the forward match if it is closer than the
+                 backward match or if there is no backward match. */
+              if (matched_line2
+                  && (!matched_line
+                      || (matched_line2 - original_start
+                          < original_start - matched_line)))
+                  matched_line = matched_line2;
+
+              /* Search from start of file if there could be a better match. */
+              if (search_start > 1
+                  && (!matched_line
+                      || (matched_line > original_start
+                          && (matched_line - original_start > 
original_start)))) 
                 {
-                  /* Scan forward towards the end of the file and look
-                   * for a line where the hunk matches. */
-                  SVN_ERR(scan_for_match(&matched_line, content, hunk,
-                                         TRUE, 0, fuzz, ignore_whitespace,
-                                         FALSE, cancel_func, cancel_baton,
+                  SVN_ERR(seek_to_line(content, 1, scratch_pool));
+                  SVN_ERR(scan_for_match(&matched_line, content, hunk, FALSE,
+                                         search_start - 1, fuzz,
+                                         ignore_whitespace, FALSE,
+                                         cancel_func, cancel_baton,
                                          scratch_pool));
                 }
             }
@@ -2139,6 +2191,38 @@ send_patch_notification(const patch_targ
   return SVN_NO_ERROR;
 }
 
+/* Implements the callback for svn_sort__array.  Puts hunks that match
+   before hunks that do not match, puts hunks that match in order
+   based on postion matched, puts hunks that do not match in order
+   based on original position. */
+static int
+sort_matched_hunks(const void *a, const void *b)
+{
+  const hunk_info_t *item1 = *((const hunk_info_t * const *)a);
+  const hunk_info_t *item2 = *((const hunk_info_t * const *)b);
+  svn_boolean_t matched1 = !item1->rejected && !item1->already_applied;
+  svn_boolean_t matched2 = !item2->rejected && !item2->already_applied;
+
+  if (matched1 && matched2)
+    {
+      /* Both match so use order matched in file. */
+      if (item1->matched_line > item2->matched_line)
+        return 1;
+    }
+  else if (matched2)
+    /* Only second matches, put it before first. */
+    return 1;
+  else
+    {
+      /* Neither matches, sort by original_start. */
+      if (svn_diff_hunk_get_original_start(item1->hunk)
+          > svn_diff_hunk_get_original_start(item2->hunk))
+        return 1;
+    }
+
+  return -1;
+}
+
 /* Apply a PATCH to a working copy at ABS_WC_PATH and put the result
  * into temporary files, to be installed in the working copy later.
  * Return information about the patch target in *PATCH_TARGET, allocated
@@ -2167,6 +2251,7 @@ apply_one_patch(patch_target_t **patch_t
   int i;
   static const svn_linenum_t MAX_FUZZ = 2;
   apr_hash_index_t *hash_index;
+  apr_int64_t previous_offset = 0;
 
   SVN_ERR(init_patch_target(&target, patch, abs_wc_path, wc_ctx, strip_count,
                             remove_tempfiles, result_pool, scratch_pool));
@@ -2209,6 +2294,7 @@ apply_one_patch(patch_target_t **patch_t
       do
         {
           SVN_ERR(get_hunk_info(&hi, target, target->content, hunk, fuzz,
+                                previous_offset,
                                 ignore_whitespace,
                                 FALSE /* is_prop_hunk */,
                                 cancel_func, cancel_baton,
@@ -2217,9 +2303,17 @@ apply_one_patch(patch_target_t **patch_t
         }
       while (hi->rejected && fuzz <= MAX_FUZZ && ! hi->already_applied);
 
+      if (hi->matched_line)
+        previous_offset
+          = hi->matched_line - svn_diff_hunk_get_original_start(hunk);
+
       APR_ARRAY_PUSH(target->content->hunks, hunk_info_t *) = hi;
     }
 
+  /* Hunks are applied in the order determined by the matched line and
+     this may be different from the order of the original lines. */
+  svn_sort__array(target->content->hunks, sort_matched_hunks);
+
   /* Apply or reject hunks. */
   for (i = 0; i < target->content->hunks->nelts; i++)
     {
@@ -2291,7 +2385,7 @@ apply_one_patch(patch_target_t **patch_t
           do
             {
               SVN_ERR(get_hunk_info(&hi, target, prop_target->content,
-                                    hunk, fuzz,
+                                    hunk, fuzz, 0,
                                     ignore_whitespace,
                                     TRUE /* is_prop_hunk */,
                                     cancel_func, cancel_baton,

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/update.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/update.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/update.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/update.c Fri Jan 
16 14:01:35 2015
@@ -262,7 +262,7 @@ update_internal(svn_revnum_t *result_rev
   SVN_ERR(svn_wc__node_get_base(NULL, NULL, &repos_relpath, &repos_root_url,
                                 &repos_uuid, NULL,
                                 ctx->wc_ctx, anchor_abspath,
-                                TRUE, FALSE,
+                                TRUE /* ignore_enoent */,
                                 scratch_pool, scratch_pool));
 
   /* It does not make sense to update conflict victims. */

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_client/util.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_client/util.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_client/util.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_client/util.c Fri Jan 
16 14:01:35 2015
@@ -200,7 +200,6 @@ svn_client__wc_node_get_base(svn_client_
                                 NULL,
                                 wc_ctx, wc_abspath,
                                 TRUE /* ignore_enoent */,
-                                TRUE /* show_hidden */,
                                 result_pool, scratch_pool));
   if ((*base_p)->repos_root_url && relpath)
     {

Modified: 
subversion/branches/svn-auth-x509/subversion/libsvn_delta/path_driver.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_delta/path_driver.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_delta/path_driver.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_delta/path_driver.c Fri 
Jan 16 14:01:35 2015
@@ -187,7 +187,7 @@ svn_delta_path_driver2(const svn_delta_e
      driving the editor. */
   for (; i < paths->nelts; i++)
     {
-      const char *pdir, *bname;
+      const char *pdir;
       const char *common = "";
       size_t common_len;
 
@@ -224,9 +224,10 @@ svn_delta_path_driver2(const svn_delta_e
       /*** Step C - Open any directories between the common ancestor
            and the parent of the current path. ***/
       if (*path == '/')
-        svn_fspath__split(&pdir, &bname, path, iterpool);
+        pdir = svn_fspath__dirname(path, iterpool);
       else
-        svn_relpath_split(&pdir, &bname, path, iterpool);
+        pdir = svn_relpath_dirname(path, iterpool);
+
       if (strlen(pdir) > common_len)
         {
           const char *piece = pdir + common_len + 1;

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_delta/text_delta.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_delta/text_delta.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_delta/text_delta.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_delta/text_delta.c Fri 
Jan 16 14:01:35 2015
@@ -637,13 +637,17 @@ patterning_copy(char *target, const char
   const apr_size_t overlap = target - source;
   while (len > overlap)
     {
-      target = memcpy(target, source, overlap);
+      memcpy(target, source, overlap);
+      target += overlap;
       len -= overlap;
     }
 
   /* Copy any remaining source pattern. */
   if (len)
-    target = memcpy(target, source, len);
+    {
+      memcpy(target, source, len);
+      target += len;
+    }
 
   return target;
 }

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_diff/diff_file.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_diff/diff_file.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_diff/diff_file.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_diff/diff_file.c Fri 
Jan 16 14:01:35 2015
@@ -544,7 +544,6 @@ find_identical_suffix(apr_off_t *suffix_
   int suffix_lines_to_keep = SUFFIX_LINES_TO_KEEP;
   svn_boolean_t is_match;
   apr_off_t lines = 0;
-  svn_boolean_t had_cr;
   svn_boolean_t had_nl;
   apr_size_t i;
 
@@ -685,7 +684,6 @@ find_identical_suffix(apr_off_t *suffix_
 
           /* We skipped some bytes, so there are no closing EOLs */
           had_nl = FALSE;
-          had_cr = FALSE;
         }
 
       /* The > min_curp[i] check leaves at least one final byte for checking
@@ -712,7 +710,7 @@ find_identical_suffix(apr_off_t *suffix_
      one file reaches its end. */
   do
     {
-      had_cr = FALSE;
+      svn_boolean_t had_cr = FALSE;
       while (!is_one_at_eof(file_for_suffix, file_len)
              && *file_for_suffix[0].curp != '\n'
              && *file_for_suffix[0].curp != '\r')

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/fs.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/fs.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/fs.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/fs.c Fri Jan 16 
14:01:35 2015
@@ -1516,6 +1516,7 @@ svn_fs_base__init(const svn_version_t *l
     {
       { "svn_subr",  svn_subr_version },
       { "svn_delta", svn_delta_version },
+      { "svn_fs_util", svn_fs_util__version },
       { NULL, NULL }
     };
 

Modified: 
subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/reps-strings.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/reps-strings.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/reps-strings.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/reps-strings.c 
Fri Jan 16 14:01:35 2015
@@ -920,7 +920,7 @@ txn_body_read_rep(void *baton, trail_t *
                                            args->rb->md5_checksum)))
                 return svn_error_create(SVN_ERR_FS_CORRUPT,
                         svn_checksum_mismatch_err(rep->md5_checksum,
-                             args->rb->sha1_checksum, trail->pool,
+                             args->rb->md5_checksum, trail->pool,
                              _("MD5 checksum mismatch on representation '%s'"),
                              args->rb->rep_key),
                         NULL);

Modified: 
subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/cached_data.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/cached_data.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/cached_data.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/cached_data.c Fri 
Jan 16 14:01:35 2015
@@ -277,11 +277,10 @@ err_dangling_id(svn_fs_t *fs, const svn_
      id_str->data, fs->path);
 }
 
-/* Return TRUE, if REVISION in FS is of a format that supports block-read
-   and the feature has been enabled. */
+/* Return TRUE, if FS is of a format that supports block-read and the
+   feature has been enabled. */
 static svn_boolean_t
-use_block_read(svn_fs_t *fs,
-               svn_revnum_t revision)
+use_block_read(svn_fs_t *fs)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
   return svn_fs_fs__use_log_addressing(fs) && ffd->use_block_read;
@@ -359,7 +358,7 @@ get_node_revision_body(node_revision_t *
                                      rev_item->number,
                                      scratch_pool));
 
-      if (use_block_read(fs, rev_item->revision))
+      if (use_block_read(fs))
         {
           /* block-read will parse the whole block and will also return
              the one noderev that we need right now. */
@@ -839,7 +838,7 @@ create_rep_state_body(rep_state_t **rep_
       /* populate the cache if appropriate */
       if (! svn_fs_fs__id_txn_used(&rep->txn_id))
         {
-          if (use_block_read(fs, rep->revision))
+          if (use_block_read(fs))
             SVN_ERR(block_read(NULL, fs, rep->revision, rep->item_index,
                                rs->sfile->rfile, result_pool, scratch_pool));
           else
@@ -1484,7 +1483,7 @@ read_delta_window(svn_txdelta_window_t *
      because the block is unlikely to contain other data. */
   if (   rs->chunk_index == 0
       && SVN_IS_VALID_REVNUM(rs->revision)
-      && use_block_read(rs->sfile->fs, rs->revision)
+      && use_block_read(rs->sfile->fs)
       && rs->raw_window_cache)
     {
       SVN_ERR(block_read(NULL, rs->sfile->fs, rs->revision, rs->item_index,
@@ -2717,7 +2716,7 @@ svn_fs_fs__get_changes(apr_array_header_
       SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&revision_file, fs, rev,
                                                scratch_pool, scratch_pool));
 
-      if (use_block_read(fs, rev))
+      if (use_block_read(fs))
         {
           /* 'block-read' will also provide us with the desired data */
           SVN_ERR(block_read((void **)changes, fs,

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/caching.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/caching.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/caching.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/caching.c Fri Jan 
16 14:01:35 2015
@@ -676,12 +676,44 @@ struct txn_cleanup_baton_t
 
   /* the position where to reset it */
   svn_cache__t **to_reset;
+
+  /* pool that TXN_CACHE was allocated in */
+  apr_pool_t *txn_pool;
+
+  /* pool that the FS containing the TO_RESET pointer was allocator */
+  apr_pool_t *fs_pool;
 };
 
+/* Forward declaration. */
+static apr_status_t
+remove_txn_cache_fs(void *baton_void);
+
 /* APR pool cleanup handler that will reset the cache pointer given in
-   BATON_VOID. */
+   BATON_VOID when the TXN_POOL gets cleaned up. */
 static apr_status_t
-remove_txn_cache(void *baton_void)
+remove_txn_cache_txn(void *baton_void)
+{
+  struct txn_cleanup_baton_t *baton = baton_void;
+
+  /* be careful not to hurt performance by resetting newer txn's caches. */
+  if (*baton->to_reset == baton->txn_cache)
+    {
+      /* This is equivalent to calling svn_fs_fs__reset_txn_caches(). */
+      *baton->to_reset = NULL;
+    }
+
+  /* It's cleaned up now. Prevent double cleanup. */
+  apr_pool_cleanup_kill(baton->fs_pool,
+                        baton,
+                        remove_txn_cache_fs);
+
+  return  APR_SUCCESS;
+}
+
+/* APR pool cleanup handler that will reset the cache pointer given in
+   BATON_VOID when the FS_POOL gets cleaned up. */
+static apr_status_t
+remove_txn_cache_fs(void *baton_void)
 {
   struct txn_cleanup_baton_t *baton = baton_void;
 
@@ -689,19 +721,25 @@ remove_txn_cache(void *baton_void)
   if (*baton->to_reset == baton->txn_cache)
     {
      /* This is equivalent to calling svn_fs_fs__reset_txn_caches(). */
-      *baton->to_reset  = NULL;
+      *baton->to_reset = NULL;
     }
 
+  /* It's cleaned up now. Prevent double cleanup. */
+  apr_pool_cleanup_kill(baton->txn_pool,
+                        baton,
+                        remove_txn_cache_txn);
+
   return  APR_SUCCESS;
 }
 
 /* This function sets / registers the required callbacks for a given
- * transaction-specific *CACHE object, if CACHE is not NULL and a no-op
- * otherwise. In particular, it will ensure that *CACHE gets reset to NULL
- * upon POOL destruction latest.
+ * transaction-specific *CACHE object in FS, if CACHE is not NULL and
+ * a no-op otherwise. In particular, it will ensure that *CACHE gets
+ * reset to NULL upon POOL or FS->POOL destruction latest.
  */
 static void
-init_txn_callbacks(svn_cache__t **cache,
+init_txn_callbacks(svn_fs_t *fs,
+                   svn_cache__t **cache,
                    apr_pool_t *pool)
 {
   if (*cache != NULL)
@@ -711,10 +749,20 @@ init_txn_callbacks(svn_cache__t **cache,
       baton = apr_palloc(pool, sizeof(*baton));
       baton->txn_cache = *cache;
       baton->to_reset = cache;
+      baton->txn_pool = pool;
+      baton->fs_pool = fs->pool;
 
+      /* If any of these pools gets cleaned, we must reset the cache.
+       * We don't know which one will get cleaned up first, so register
+       * cleanup actions for both and during the cleanup action, unregister
+       * the respective other action. */
       apr_pool_cleanup_register(pool,
                                 baton,
-                                remove_txn_cache,
+                                remove_txn_cache_txn,
+                                apr_pool_cleanup_null);
+      apr_pool_cleanup_register(fs->pool,
+                                baton,
+                                remove_txn_cache_fs,
                                 apr_pool_cleanup_null);
     }
 }
@@ -764,7 +812,7 @@ svn_fs_fs__initialize_txn_caches(svn_fs_
                        pool, pool));
 
   /* reset the transaction-specific cache if the pool gets cleaned up. */
-  init_txn_callbacks(&(ffd->txn_dir_cache), pool);
+  init_txn_callbacks(fs, &(ffd->txn_dir_cache), pool);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/dag.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/dag.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/dag.c Fri Jan 16 
14:01:35 2015
@@ -866,14 +866,20 @@ svn_fs_fs__dag_delete_if_mutable(svn_fs_
     {
       apr_array_header_t *entries;
       int i;
+      apr_pool_t *iterpool = svn_pool_create(pool);
 
       /* Loop over directory entries */
       SVN_ERR(svn_fs_fs__dag_dir_entries(&entries, node, pool));
       if (entries)
         for (i = 0; i < entries->nelts; ++i)
-          SVN_ERR(svn_fs_fs__dag_delete_if_mutable(fs,
-                        APR_ARRAY_IDX(entries, i, svn_fs_dirent_t *)->id,
-                        pool));
+          {
+            svn_pool_clear(iterpool);
+            SVN_ERR(svn_fs_fs__dag_delete_if_mutable(fs,
+                          APR_ARRAY_IDX(entries, i, svn_fs_dirent_t *)->id,
+                          iterpool));
+          }
+
+      svn_pool_destroy(iterpool);
     }
 
   /* ... then delete the node itself, after deleting any mutable
@@ -1099,6 +1105,15 @@ svn_fs_fs__dag_dup(const dag_node_t *nod
   return new_node;
 }
 
+dag_node_t *
+svn_fs_fs__dag_copy_into_pool(dag_node_t *node,
+                              apr_pool_t *pool)
+{
+  return (node->node_pool == pool
+            ? node
+            : svn_fs_fs__dag_dup(node, pool));
+}
+
 svn_error_t *
 svn_fs_fs__dag_serialize(void **data,
                          apr_size_t *data_len,

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/dag.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/dag.h?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/dag.h (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/dag.h Fri Jan 16 
14:01:35 2015
@@ -80,6 +80,12 @@ dag_node_t *
 svn_fs_fs__dag_dup(const dag_node_t *node,
                    apr_pool_t *pool);
 
+/* If NODE has been allocated in POOL, return NODE.  Otherwise, return
+   a copy created in POOL with svn_fs_fs__dag_dup. */
+dag_node_t *
+svn_fs_fs__dag_copy_into_pool(dag_node_t *node,
+                              apr_pool_t *pool);
+
 /* Serialize a DAG node, except don't try to preserve the 'fs' member.
    Implements svn_cache__serialize_func_t */
 svn_error_t *

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/fs.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/fs.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/fs.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/fs.c Fri Jan 16 
14:01:35 2015
@@ -597,6 +597,7 @@ svn_fs_fs__init(const svn_version_t *loa
     {
       { "svn_subr",  svn_subr_version },
       { "svn_delta", svn_delta_version },
+      { "svn_fs_util", svn_fs_util__version },
       { NULL, NULL }
     };
 

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/fs_fs.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/fs_fs.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/fs_fs.c Fri Jan 
16 14:01:35 2015
@@ -1759,6 +1759,7 @@ svn_fs_fs__create(svn_fs_t *fs,
 {
   int format = SVN_FS_FS__FORMAT_NUMBER;
   int shard_size = SVN_FS_FS_DEFAULT_MAX_FILES_PER_DIR;
+  svn_boolean_t log_addressing;
 
   /* Process the given filesystem config. */
   if (fs->config)
@@ -1806,8 +1807,13 @@ svn_fs_fs__create(svn_fs_t *fs,
         }
     }
 
+  log_addressing = svn_hash__get_bool(fs->config,
+                                      SVN_FS_CONFIG_FSFS_LOG_ADDRESSING,
+                                      TRUE);
+
   /* Actual FS creation. */
-  SVN_ERR(svn_fs_fs__create_file_tree(fs, path, format, shard_size, TRUE, 
pool));
+  SVN_ERR(svn_fs_fs__create_file_tree(fs, path, format, shard_size,
+                                      log_addressing, pool));
 
   /* This filesystem is ready.  Stamp it with a format number. */
   SVN_ERR(svn_fs_fs__write_format(fs, FALSE, pool));

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/index.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/index.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/index.c Fri Jan 
16 14:01:35 2015
@@ -1980,8 +1980,8 @@ svn_fs_fs__p2l_index_append(svn_checksum
 
   apr_uint64_t last_entry_end = 0;
   apr_uint64_t last_page_end = 0;
-  apr_size_t last_buffer_size = 0;  /* byte offset in the spill buffer at
-                                       the begin of the current revision */
+  apr_uint64_t last_buffer_size = 0;  /* byte offset in the spill buffer at
+                                         the begin of the current revision */
   apr_uint64_t file_size = 0;
 
   /* temporary data structures that collect the data which will be moved

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/lock.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/lock.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/lock.c Fri Jan 16 
14:01:35 2015
@@ -103,8 +103,7 @@ hash_store(apr_hash_t *hash,
    of that value (if it exists). */
 static const char *
 hash_fetch(apr_hash_t *hash,
-           const char *key,
-           apr_pool_t *pool)
+           const char *key)
 {
   svn_string_t *str = svn_hash_gets(hash, key);
   return str ? str->data : NULL;
@@ -284,7 +283,7 @@ read_digest_file(apr_hash_t **children_p
 
   /* If our caller cares, see if we have a lock path in our hash. If
      so, we'll assume we have a lock here. */
-  val = hash_fetch(hash, PATH_KEY, pool);
+  val = hash_fetch(hash, PATH_KEY);
   if (val && lock_p)
     {
       const char *path = val;
@@ -293,30 +292,30 @@ read_digest_file(apr_hash_t **children_p
       lock = svn_lock_create(pool);
       lock->path = path;
 
-      if (! ((lock->token = hash_fetch(hash, TOKEN_KEY, pool))))
+      if (! ((lock->token = hash_fetch(hash, TOKEN_KEY))))
         return svn_error_trace(err_corrupt_lockfile(fs_path, path));
 
-      if (! ((lock->owner = hash_fetch(hash, OWNER_KEY, pool))))
+      if (! ((lock->owner = hash_fetch(hash, OWNER_KEY))))
         return svn_error_trace(err_corrupt_lockfile(fs_path, path));
 
-      if (! ((val = hash_fetch(hash, IS_DAV_COMMENT_KEY, pool))))
+      if (! ((val = hash_fetch(hash, IS_DAV_COMMENT_KEY))))
         return svn_error_trace(err_corrupt_lockfile(fs_path, path));
       lock->is_dav_comment = (val[0] == '1');
 
-      if (! ((val = hash_fetch(hash, CREATION_DATE_KEY, pool))))
+      if (! ((val = hash_fetch(hash, CREATION_DATE_KEY))))
         return svn_error_trace(err_corrupt_lockfile(fs_path, path));
       SVN_ERR(svn_time_from_cstring(&(lock->creation_date), val, pool));
 
-      if ((val = hash_fetch(hash, EXPIRATION_DATE_KEY, pool)))
+      if ((val = hash_fetch(hash, EXPIRATION_DATE_KEY)))
         SVN_ERR(svn_time_from_cstring(&(lock->expiration_date), val, pool));
 
-      lock->comment = hash_fetch(hash, COMMENT_KEY, pool);
+      lock->comment = hash_fetch(hash, COMMENT_KEY);
 
       *lock_p = lock;
     }
 
   /* If our caller cares, see if we have any children for this path. */
-  val = hash_fetch(hash, CHILDREN_KEY, pool);
+  val = hash_fetch(hash, CHILDREN_KEY);
   if (val && children_p)
     {
       apr_array_header_t *kiddos = svn_cstring_split(val, "\n", FALSE, pool);

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/pack.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/pack.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/pack.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/pack.c Fri Jan 16 
14:01:35 2015
@@ -643,7 +643,6 @@ compare_dir_entries_format6(const svn_so
 apr_array_header_t *
 svn_fs_fs__order_dir_entries(svn_fs_t *fs,
                              apr_hash_t *directory,
-                             svn_revnum_t revision,
                              apr_pool_t *pool)
 {
   apr_array_header_t *ordered

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/pack.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/pack.h?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/pack.h (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/pack.h Fri Jan 16 
14:01:35 2015
@@ -52,13 +52,11 @@ svn_fs_fs__get_packed_offset(apr_off_t *
 
 /* Return the svn_dir_entry_t* objects of DIRECTORY in an APR array
  * allocated in POOL with entries added in storage (on-disk) order.
- * FS format and the directory's REVISION number will be used to pick
- * the optimal ordering strategy.
+ * FS format will be used to pick the optimal ordering strategy.
  */
 apr_array_header_t *
 svn_fs_fs__order_dir_entries(svn_fs_t *fs,
                              apr_hash_t *directory,
-                             svn_revnum_t revision,
                              apr_pool_t *pool);
 
 

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/stats.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/stats.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/stats.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/stats.c Fri Jan 
16 14:01:35 2015
@@ -249,8 +249,8 @@ add_to_histogram(svn_fs_fs__histogram_t
  */
 static void
 add_change(svn_fs_fs__stats_t *stats,
-           apr_int64_t rep_size,
-           apr_int64_t expanded_size,
+           apr_uint64_t rep_size,
+           apr_uint64_t expanded_size,
            svn_revnum_t revision,
            const char *path,
            rep_kind_t kind,
@@ -293,29 +293,25 @@ add_change(svn_fs_fs__stats_t *stats,
   /* specific histograms by type */
   switch (kind)
     {
-      case unused_rep:        add_to_histogram(&stats->unused_rep_histogram,
-                                               rep_size);
-                              break;
-      case dir_property_rep:  add_to_histogram(&stats->dir_prop_rep_histogram,
-                                               rep_size);
-                              add_to_histogram(&stats->dir_prop_histogram,
-                                              expanded_size);
-                              break;
-      case file_property_rep: add_to_histogram(&stats->file_prop_rep_histogram,
-                                               rep_size);
-                              add_to_histogram(&stats->file_prop_histogram,
-                                               expanded_size);
-                              break;
-      case dir_rep:           add_to_histogram(&stats->dir_rep_histogram,
-                                               rep_size);
-                              add_to_histogram(&stats->dir_histogram,
-                                               expanded_size);
-                              break;
-      case file_rep:          add_to_histogram(&stats->file_rep_histogram,
-                                               rep_size);
-                              add_to_histogram(&stats->file_histogram,
-                                               expanded_size);
-                              break;
+      case unused_rep:
+        add_to_histogram(&stats->unused_rep_histogram, rep_size);
+        break;
+      case dir_property_rep:
+        add_to_histogram(&stats->dir_prop_rep_histogram, rep_size);
+        add_to_histogram(&stats->dir_prop_histogram, expanded_size);
+        break;
+      case file_property_rep: 
+        add_to_histogram(&stats->file_prop_rep_histogram, rep_size);
+        add_to_histogram(&stats->file_prop_histogram, expanded_size);
+        break;
+      case dir_rep:
+        add_to_histogram(&stats->dir_rep_histogram, rep_size);
+        add_to_histogram(&stats->dir_histogram, expanded_size);
+        break;
+      case file_rep:
+        add_to_histogram(&stats->file_rep_histogram, rep_size);
+        add_to_histogram(&stats->file_histogram, expanded_size);
+        break;
     }
 
   /* by extension */
@@ -618,13 +614,12 @@ read_noderev(query_t *query,
 
   /* record largest changes */
   if (text && text->ref_count == 1)
-    add_change(query->stats, (apr_int64_t)text->size,
-               (apr_int64_t)text->expanded_size, text->revision,
+    add_change(query->stats, text->size, text->expanded_size, text->revision,
                noderev->created_path, text->kind, !noderev->predecessor_id);
   if (props && props->ref_count == 1)
-    add_change(query->stats, (apr_int64_t)props->size,
-               (apr_int64_t)props->expanded_size, props->revision,
-               noderev->created_path, props->kind, !noderev->predecessor_id);
+    add_change(query->stats, props->size, props->expanded_size,
+               props->revision, noderev->created_path, props->kind,
+               !noderev->predecessor_id);
 
   /* if this is a directory and has not been processed, yet, read and
    * process it recursively */
@@ -1250,7 +1245,7 @@ svn_fs_fs__get_stats(svn_fs_fs__stats_t
   query_t *query;
 
   *stats = create_stats(result_pool);
-  SVN_ERR(create_query(&query, fs, *stats, progress_func, progress_func,
+  SVN_ERR(create_query(&query, fs, *stats, progress_func, progress_baton,
                        cancel_func, cancel_baton, scratch_pool,
                        scratch_pool));
   SVN_ERR(read_revisions(query, scratch_pool, scratch_pool));

Modified: 
subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/transaction.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/transaction.c?rev=1652409&r1=1652408&r2=1652409&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/transaction.c 
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/transaction.c Fri 
Jan 16 14:01:35 2015
@@ -1660,15 +1660,12 @@ store_p2l_index_entry(svn_fs_t *fs,
  * of file system FS and return it in *ITEM_INDEX.  For old formats, it
  * will simply return the offset as item index; in new formats, it will
  * increment the txn's item index counter file and store the mapping in
- * the proto index file.  If FINAL_REVISION is not SVN_INVALID_REVNUM, use
- * it to determine whether to actually write to the proto-index.
- * Use POOL for allocations.
+ * the proto index file.  Use POOL for allocations.
  */
 static svn_error_t *
 allocate_item_index(apr_uint64_t *item_index,
                     svn_fs_t *fs,
                     const svn_fs_fs__id_part_t *txn_id,
-                    svn_revnum_t final_revision,
                     apr_off_t my_offset,
                     apr_pool_t *pool)
 {
@@ -2295,8 +2292,7 @@ rep_write_contents_close(void *baton)
       /* Write out our cosmetic end marker. */
       SVN_ERR(svn_stream_puts(b->rep_stream, "ENDREP\n"));
       SVN_ERR(allocate_item_index(&rep->item_index, b->fs, &rep->txn_id,
-                                  SVN_INVALID_REVNUM, b->rep_offset,
-                                  b->scratch_pool));
+                                  b->rep_offset, b->scratch_pool));
 
       b->noderev->data_rep = rep;
     }
@@ -2505,9 +2501,7 @@ write_directory_to_stream(svn_stream_t *
    is not NULL, it will be used in addition to the on-disk cache to find
    earlier reps with the same content.  When such existing reps can be
    found, we will truncate the one just written from the file and return
-   the existing rep.  If FINAL_REVISION is not SVN_INVALID_REVNUM, use it
-   to determine whether to write to the proto-index files.
-   Perform temporary allocations in SCRATCH_POOL. */
+   the existing rep.  Perform temporary allocations in SCRATCH_POOL. */
 static svn_error_t *
 write_container_rep(representation_t *rep,
                     apr_file_t *file,
@@ -2516,7 +2510,6 @@ write_container_rep(representation_t *re
                     svn_fs_t *fs,
                     apr_hash_t *reps_hash,
                     apr_uint32_t item_type,
-                    svn_revnum_t final_revision,
                     apr_pool_t *scratch_pool)
 {
   svn_stream_t *stream;
@@ -2568,7 +2561,7 @@ write_container_rep(representation_t *re
       SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n"));
 
       SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id,
-                                  final_revision, offset, scratch_pool));
+                                  offset, scratch_pool));
 
       entry.offset = offset;
       SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool));
@@ -2601,8 +2594,6 @@ write_container_rep(representation_t *re
 
    If ITEM_TYPE is IS_PROPS equals SVN_FS_FS__ITEM_TYPE_*_PROPS, assume
    that we want to a props representation as the base for our delta.
-   If FINAL_REVISION is not SVN_INVALID_REVNUM, use it to determine whether
-   to write to the proto-index files.
    Perform temporary allocations in SCRATCH_POOL.
  */
 static svn_error_t *
@@ -2614,7 +2605,6 @@ write_container_delta_rep(representation
                           node_revision_t *noderev,
                           apr_hash_t *reps_hash,
                           apr_uint32_t item_type,
-                          svn_revnum_t final_revision,
                           apr_pool_t *scratch_pool)
 {
   svn_txdelta_window_handler_t diff_wh;
@@ -2711,7 +2701,7 @@ write_container_delta_rep(representation
       SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n"));
 
       SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id,
-                                  final_revision, offset, scratch_pool));
+                                  offset, scratch_pool));
 
       entry.offset = offset;
       SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool));
@@ -2910,12 +2900,11 @@ write_final_rev(const svn_fs_id_t **new_
                                               write_directory_to_stream,
                                               fs, noderev, NULL,
                                               SVN_FS_FS__ITEM_TYPE_DIR_REP,
-                                              rev, pool));
+                                              pool));
           else
             SVN_ERR(write_container_rep(noderev->data_rep, file, entries,
                                         write_directory_to_stream, fs, NULL,
-                                        SVN_FS_FS__ITEM_TYPE_DIR_REP, rev,
-                                        pool));
+                                        SVN_FS_FS__ITEM_TYPE_DIR_REP, pool));
 
           reset_txn_in_rep(noderev->data_rep);
         }
@@ -2960,11 +2949,11 @@ write_final_rev(const svn_fs_id_t **new_
       if (ffd->deltify_properties)
         SVN_ERR(write_container_delta_rep(noderev->prop_rep, file, proplist,
                                           write_hash_to_stream, fs, noderev,
-                                          reps_hash, item_type, rev, pool));
+                                          reps_hash, item_type, pool));
       else
         SVN_ERR(write_container_rep(noderev->prop_rep, file, proplist,
                                     write_hash_to_stream, fs, reps_hash,
-                                    item_type, rev, pool));
+                                    item_type, pool));
 
       reset_txn_in_rep(noderev->prop_rep);
     }
@@ -2988,7 +2977,7 @@ write_final_rev(const svn_fs_id_t **new_
                                     rev_item.number, pool));
     }
   else
-    SVN_ERR(allocate_item_index(&rev_item.number, fs, txn_id, rev,
+    SVN_ERR(allocate_item_index(&rev_item.number, fs, txn_id,
                                 my_offset, pool));
 
   rev_item.revision = rev;
@@ -3070,17 +3059,15 @@ write_final_rev(const svn_fs_id_t **new_
 }
 
 /* Write the changed path info CHANGED_PATHS from transaction TXN_ID to the
-   permanent rev-file FILE representing NEW_REV in filesystem FS.  *OFFSET_P
-   is set the to offset in the file of the beginning of this information.
-   NEW_REV is the revision currently being committed.
-   Perform temporary allocations in POOL. */
+   permanent rev-file FILE in filesystem FS.  *OFFSET_P is set the to offset
+   in the file of the beginning of this information.  Perform temporary
+   allocations in POOL. */
 static svn_error_t *
 write_final_changed_path_info(apr_off_t *offset_p,
                               apr_file_t *file,
                               svn_fs_t *fs,
                               const svn_fs_fs__id_part_t *txn_id,
                               apr_hash_t *changed_paths,
-                              svn_revnum_t new_rev,
                               apr_pool_t *pool)
 {
   apr_off_t offset;
@@ -3204,44 +3191,41 @@ verify_locks(svn_fs_t *fs,
              apr_hash_t *changed_paths,
              apr_pool_t *pool)
 {
-  apr_pool_t *subpool = svn_pool_create(pool);
-  apr_hash_index_t *hi;
+  apr_pool_t *iterpool;
   apr_array_header_t *changed_paths_sorted;
   svn_stringbuf_t *last_recursed = NULL;
   int i;
 
   /* Make an array of the changed paths, and sort them depth-first-ily.  */
-  changed_paths_sorted = apr_array_make(pool,
-                                        apr_hash_count(changed_paths) + 1,
-                                        sizeof(const char *));
-  for (hi = apr_hash_first(pool, changed_paths); hi; hi = apr_hash_next(hi))
-    {
-      APR_ARRAY_PUSH(changed_paths_sorted, const char *) =
-        apr_hash_this_key(hi);
-    }
-  svn_sort__array(changed_paths_sorted, svn_sort_compare_paths);
+  changed_paths_sorted = svn_sort__hash(changed_paths,
+                                        svn_sort_compare_items_as_paths,
+                                        pool);
 
   /* Now, traverse the array of changed paths, verify locks.  Note
      that if we need to do a recursive verification a path, we'll skip
      over children of that path when we get to them. */
+  iterpool = svn_pool_create(pool);
   for (i = 0; i < changed_paths_sorted->nelts; i++)
     {
+      const svn_sort__item_t *item;
       const char *path;
       svn_fs_path_change2_t *change;
       svn_boolean_t recurse = TRUE;
 
-      svn_pool_clear(subpool);
-      path = APR_ARRAY_IDX(changed_paths_sorted, i, const char *);
+      svn_pool_clear(iterpool);
+
+      item = &APR_ARRAY_IDX(changed_paths_sorted, i, svn_sort__item_t);
+
+      /* Fetch the change associated with our path.  */
+      path = item->key;
+      change = item->value;
 
       /* If this path has already been verified as part of a recursive
          check of one of its parents, no need to do it again.  */
       if (last_recursed
-          && svn_dirent_is_child(last_recursed->data, path, subpool))
+          && svn_fspath__skip_ancestor(last_recursed->data, path))
         continue;
 
-      /* Fetch the change associated with our path.  */
-      change = svn_hash_gets(changed_paths, path);
-
       /* What does it mean to succeed at lock verification for a given
          path?  For an existing file or directory getting modified
          (text, props), it means we hold the lock on the file or
@@ -3254,7 +3238,7 @@ verify_locks(svn_fs_t *fs,
       if (change->change_kind == svn_fs_path_change_modify)
         recurse = FALSE;
       SVN_ERR(svn_fs_fs__allow_locked_operation(path, fs, recurse, TRUE,
-                                                subpool));
+                                                iterpool));
 
       /* If we just did a recursive check, remember the path we
          checked (so children can be skipped).  */
@@ -3266,7 +3250,7 @@ verify_locks(svn_fs_t *fs,
             svn_stringbuf_set(last_recursed, path);
         }
     }
-  svn_pool_destroy(subpool);
+  svn_pool_destroy(iterpool);
   return SVN_NO_ERROR;
 }
 
@@ -3459,7 +3443,7 @@ commit_body(void *baton, apr_pool_t *poo
   /* Write the changed-path information. */
   SVN_ERR(write_final_changed_path_info(&changed_path_offset, proto_file,
                                         cb->fs, txn_id, changed_paths,
-                                        new_rev, pool));
+                                        pool));
 
   if (svn_fs_fs__use_log_addressing(cb->fs))
     {


Reply via email to