subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dan...@apache.org
Subject svn commit: r929279 [9/20] - in /subversion/branches/svn-patch-improvements: ./ build/ac-macros/ build/generator/ build/generator/templates/ contrib/client-side/emacs/ notes/feedback/ notes/meetings/ notes/wc-ng/ subversion/ subversion/bindings/javahl/...
Date Tue, 30 Mar 2010 20:58:01 GMT
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/mergeinfo.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/mergeinfo.c Tue Mar 30 20:57:53 2010
@@ -151,8 +151,8 @@ svn_client__adjust_mergeinfo_source_path
 
   for (hi = apr_hash_first(pool, mergeinfo); hi; hi = apr_hash_next(hi))
     {
-      const char *merge_source = svn_apr_hash_index_key(hi);
-      apr_array_header_t *rangelist = svn_apr_hash_index_val(hi);
+      const char *merge_source = svn__apr_hash_index_key(hi);
+      apr_array_header_t *rangelist = svn__apr_hash_index_val(hi);
 
       /* Copy inherited mergeinfo into our output hash, adjusting the
          merge source as appropriate. */
@@ -460,7 +460,7 @@ svn_client__get_repos_mergeinfo(svn_ra_s
          descendants.  So if there is anything in the catalog it is the
          mergeinfo for REL_PATH. */
       *target_mergeinfo =
-        svn_apr_hash_index_val(apr_hash_first(pool, tgt_mergeinfo_cat));
+        svn__apr_hash_index_val(apr_hash_first(pool, tgt_mergeinfo_cat));
 
     }
 
@@ -532,7 +532,7 @@ svn_client__get_wc_or_repos_mergeinfo(sv
          so we can peek into our catalog, but it ought to be the only
          thing in the catalog, so we'll just fetch the first hash item. */
       *target_mergeinfo =
-        svn_apr_hash_index_val(apr_hash_first(pool, tgt_mergeinfo_cat));
+        svn__apr_hash_index_val(apr_hash_first(pool, tgt_mergeinfo_cat));
 
     }
 
@@ -654,7 +654,7 @@ svn_client__get_wc_or_repos_mergeinfo_ca
 
 svn_error_t *
 svn_client__mergeinfo_from_segments(svn_mergeinfo_t *mergeinfo_p,
-                                    apr_array_header_t *segments,
+                                    const apr_array_header_t *segments,
                                     apr_pool_t *pool)
 {
   svn_mergeinfo_t mergeinfo = apr_hash_make(pool);
@@ -1008,7 +1008,7 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
                                              result_pool, scratch_pool));
         }
 
-      
+
       if (peg_rev.kind == svn_opt_revision_date
           || peg_rev.kind == svn_opt_revision_head
           || peg_rev.kind == svn_opt_revision_previous
@@ -1236,7 +1236,7 @@ svn_client__elide_mergeinfo_catalog(svn_
    If DEPTH_FIRST_CATALOG_INDEX is NULL, empty, or no ancestor is found, then
    return NULL. */
 static svn_mergeinfo_t
-find_nearest_ancestor(apr_array_header_t *depth_first_catalog_index,
+find_nearest_ancestor(const apr_array_header_t *depth_first_catalog_index,
                       const char *abs_repos_path)
 {
   int i;
@@ -1270,7 +1270,7 @@ struct filter_log_entry_baton_t
 
   /* Unsorted array of repository relative paths representing the merge
      sources.  There will be more than one source  */
-  apr_array_header_t *merge_source_paths;
+  const apr_array_header_t *merge_source_paths;
 
   /* The repository-absolute path we are calling svn_client_log5() on. */
   const char *abs_repos_target_path;
@@ -1285,7 +1285,7 @@ struct filter_log_entry_baton_t
 
   /* A rangelist describing all the ranges merged to ABS_REPOS_TARGET_PATH
      from the */
-  apr_array_header_t *rangelist;
+  const apr_array_header_t *rangelist;
 
   /* The wrapped svn_log_entry_receiver_t callback and baton which
      filter_log_entry_with_rangelist() is acting as a filter for. */
@@ -1296,7 +1296,12 @@ struct filter_log_entry_baton_t
 };
 
 /* Implements the svn_log_entry_receiver_t interface.  BATON is a
-   `struct filter_log_entry_baton_t *' */
+   `struct filter_log_entry_baton_t *'.
+
+   Call the wrapped log receiver BATON->log_receiver (with
+   BATON->log_receiver_baton), only if the log entry falls within the
+   ranges in BATON->rangelist.
+ */
 static svn_error_t *
 filter_log_entry_with_rangelist(void *baton,
                                 svn_log_entry_t *log_entry,
@@ -1308,10 +1313,14 @@ filter_log_entry_with_rangelist(void *ba
   if (fleb->ctx->cancel_func)
     SVN_ERR(fleb->ctx->cancel_func(fleb->ctx->cancel_baton));
 
+  /* Ignore r0 because there can be no "change 0" in a merge range. */
+  if (log_entry->revision == 0)
+    return SVN_NO_ERROR;
+
   this_rangelist = svn_rangelist__initialize(log_entry->revision - 1,
                                              log_entry->revision,
                                              TRUE, pool);
-  
+
   /* Don't consider inheritance yet, see if LOG_ENTRY->REVISION is
      fully or partially represented in BATON->RANGELIST. */
   SVN_ERR(svn_rangelist_intersect(&intersection, fleb->rangelist,
@@ -1348,8 +1357,8 @@ filter_log_entry_with_rangelist(void *ba
            hi;
            hi = apr_hash_next(hi))
         {
-          const char *path = svn_apr_hash_index_key(hi);
-          svn_log_changed_path2_t *change = svn_apr_hash_index_val(hi);
+          const char *path = svn__apr_hash_index_key(hi);
+          svn_log_changed_path2_t *change = svn__apr_hash_index_val(hi);
           const char *target_path_affected;
           svn_mergeinfo_t nearest_ancestor_mergeinfo;
           apr_hash_index_t *hi2;
@@ -1397,7 +1406,7 @@ filter_log_entry_with_rangelist(void *ba
                    hi2;
                    hi2 = apr_hash_next(hi2))
                 {
-                  apr_array_header_t *rangelist = svn_apr_hash_index_val(hi2);
+                  apr_array_header_t *rangelist = svn__apr_hash_index_val(hi2);
                   SVN_ERR(svn_rangelist_intersect(&intersection, rangelist,
                                                   this_rev_rangelist, FALSE,
                                                   iterpool));
@@ -1436,15 +1445,15 @@ filter_log_entry_with_rangelist(void *ba
         }
     }
 
-  /* Call the wrapped log reveiver which this function is filtering for. */
+  /* Call the wrapped log receiver which this function is filtering for. */
   return fleb->log_receiver(fleb->log_receiver_baton, log_entry, pool);
 }
 
 static svn_error_t *
 logs_for_mergeinfo_rangelist(const char *source_url,
-                             apr_array_header_t *merge_source_paths,
+                             const apr_array_header_t *merge_source_paths,
                              svn_boolean_t filtering_merged,
-                             apr_array_header_t *rangelist,
+                             const apr_array_header_t *rangelist,
                              svn_mergeinfo_t target_mergeinfo_catalog,
                              const char *abs_repos_target_path,
                              svn_boolean_t discover_changed_paths,
@@ -1495,13 +1504,13 @@ logs_for_mergeinfo_rangelist(const char 
            hi;
            hi = apr_hash_next(hi))
         {
-          const char *path = svn_apr_hash_index_key(hi);
+          const char *path = svn__apr_hash_index_key(hi);
 
           if (!svn_dirent_is_absolute(path))
             apr_hash_set(rekeyed_catalog,
                          svn_dirent_join("/", path, scratch_pool),
                          APR_HASH_KEY_STRING,
-                         svn_apr_hash_index_val(hi));
+                         svn__apr_hash_index_val(hi));
         }
       target_mergeinfo_catalog = rekeyed_catalog;
     }
@@ -1633,8 +1642,8 @@ svn_client_mergeinfo_get_merged(apr_hash
       full_path_mergeinfo = apr_hash_make(pool);
       for (hi = apr_hash_first(pool, mergeinfo); hi; hi = apr_hash_next(hi))
         {
-          const char *key = svn_apr_hash_index_key(hi);
-          void *val = svn_apr_hash_index_val(hi);
+          const char *key = svn__apr_hash_index_key(hi);
+          void *val = svn__apr_hash_index_val(hi);
           const char *source_url;
 
           source_url = svn_path_uri_encode(key, pool);
@@ -1650,8 +1659,8 @@ svn_client_mergeinfo_get_merged(apr_hash
 
 
 svn_error_t *
-svn_client_mergeinfo_log(const char *path_or_url,
-                         svn_boolean_t finding_merged,
+svn_client_mergeinfo_log(svn_boolean_t finding_merged,
+                         const char *path_or_url,
                          const svn_opt_revision_t *peg_revision,
                          const char *merge_source_path_or_url,
                          const svn_opt_revision_t *src_peg_revision,
@@ -1772,14 +1781,14 @@ svn_client_mergeinfo_log(const char *pat
        hi_catalog = apr_hash_next(hi_catalog))
     {
       svn_mergeinfo_t subtree_mergeinfo =
-        svn_apr_hash_index_val(hi_catalog);
+        svn__apr_hash_index_val(hi_catalog);
       svn_mergeinfo_t subtree_history;
       svn_mergeinfo_t subtree_source_history;
       svn_mergeinfo_t subtree_inheritable_mergeinfo;
       svn_mergeinfo_t subtree_noninheritable_mergeinfo;
       svn_mergeinfo_t merged_noninheritable;
       svn_mergeinfo_t merged;
-      const char *subtree_path = svn_apr_hash_index_key(hi_catalog);
+      const char *subtree_path = svn__apr_hash_index_key(hi_catalog);
       svn_boolean_t is_subtree = strcmp(subtree_path,
                                         path_or_url_repos_rel) != 0;
       svn_pool_clear(iterpool);
@@ -1853,7 +1862,7 @@ svn_client_mergeinfo_log(const char *pat
                hi;
                hi = apr_hash_next(hi))
             {
-              apr_array_header_t *list = svn_apr_hash_index_val(hi);
+              apr_array_header_t *list = svn__apr_hash_index_val(hi);
               SVN_ERR(svn_rangelist_merge(
                 &master_noninheritable_rangelist,
                 svn_rangelist_dup(list, scratch_pool),
@@ -1881,7 +1890,7 @@ svn_client_mergeinfo_log(const char *pat
                hi;
                hi = apr_hash_next(hi))
             {
-              apr_array_header_t *list = svn_apr_hash_index_val(hi);
+              apr_array_header_t *list = svn__apr_hash_index_val(hi);
 
               SVN_ERR(svn_rangelist_merge(&master_inheritable_rangelist,
                                           svn_rangelist_dup(list,
@@ -1927,7 +1936,7 @@ svn_client_mergeinfo_log(const char *pat
           apr_array_header_t *deleted_rangelist;
           apr_array_header_t *added_rangelist;
           apr_array_header_t *subtree_merged_rangelist =
-            svn_apr_hash_index_val(hi);
+            svn__apr_hash_index_val(hi);
 
           svn_pool_clear(iterpool);
 
@@ -1970,7 +1979,7 @@ svn_client_mergeinfo_log(const char *pat
            hi = apr_hash_next(hi))
         {
           apr_array_header_t *subtree_merged_rangelist =
-            svn_apr_hash_index_val(hi);
+            svn__apr_hash_index_val(hi);
 
           SVN_ERR(svn_rangelist_merge(&source_master_rangelist,
                                       subtree_merged_rangelist,
@@ -2017,9 +2026,9 @@ svn_client_mergeinfo_log(const char *pat
            hi;
            hi = apr_hash_next(hi))
         {
-          const char *key = svn_apr_hash_index_key(hi);
+          const char *key = svn__apr_hash_index_key(hi);
           apr_array_header_t *subtree_merged_rangelist =
-            svn_apr_hash_index_val(hi);
+            svn__apr_hash_index_val(hi);
           apr_array_header_t *intersecting_rangelist;
           svn_pool_clear(iterpool);
           SVN_ERR(svn_rangelist_intersect(&intersecting_rangelist,
@@ -2099,7 +2108,7 @@ svn_client_suggest_merge_sources(apr_arr
       /* We asked only for the PATH_OR_URL's mergeinfo, not any of its
          descendants.  So if there is anything in the catalog it is the
          mergeinfo for PATH_OR_URL. */
-      mergeinfo = svn_apr_hash_index_val(apr_hash_first(pool, mergeinfo_cat));
+      mergeinfo = svn__apr_hash_index_val(apr_hash_first(pool, mergeinfo_cat));
     }
   else
     {
@@ -2119,7 +2128,7 @@ svn_client_suggest_merge_sources(apr_arr
     {
       for (hi = apr_hash_first(pool, mergeinfo); hi; hi = apr_hash_next(hi))
         {
-          const char *rel_path = svn_apr_hash_index_key(hi);
+          const char *rel_path = svn__apr_hash_index_key(hi);
 
           if (copyfrom_path == NULL || strcmp(rel_path, copyfrom_path) != 0)
             APR_ARRAY_PUSH(list, const char *) = \

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/mergeinfo.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/mergeinfo.h?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/mergeinfo.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/mergeinfo.h Tue Mar 30 20:57:53 2010
@@ -258,7 +258,7 @@ svn_client__get_history_as_mergeinfo(svn
    *MERGEINFO_P, allocated in POOL. */
 svn_error_t *
 svn_client__mergeinfo_from_segments(svn_mergeinfo_t *mergeinfo_p,
-                                    apr_array_header_t *segments,
+                                    const apr_array_header_t *segments,
                                     apr_pool_t *pool);
 
 /* Parse any explicit mergeinfo on LOCAL_ABSPATH and store it in

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c Tue Mar 30 20:57:53 2010
@@ -31,6 +31,7 @@
 #include <apr_fnmatch.h>
 #include "svn_client.h"
 #include "svn_dirent_uri.h"
+#include "svn_diff.h"
 #include "svn_io.h"
 #include "svn_path.h"
 #include "svn_pools.h"
@@ -40,7 +41,6 @@
 #include "client.h"
 
 #include "svn_private_config.h"
-#include "private/svn_diff_private.h"
 #include "private/svn_eol_private.h"
 #include "private/svn_wc_private.h"
 
@@ -325,18 +325,24 @@ resolve_target_path(patch_target_t *targ
  * which should be stripped from target paths in the patch.
  * Upon success, allocate the patch target structure in RESULT_POOL.
  * Else, set *target to NULL.
- * If a target matches a glob in FILTER_GLOBS, mark it as filtered.
+ * If a target does not match a glob in INCLUDE_PATTERNS, mark it as filtered.
+ * If a target matches a glob in EXCLUDE_PATTERNS, mark it as filtered.
+ * If PATCHED_TEMPFILES or REJECT_TEMPFILES are not NULL, add the path
+ * to temporary patched/reject files to them, keyed by the target's path
+ * as parsed from the patch file (after canonicalization).
  * Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *
 init_patch_target(patch_target_t **patch_target,
                   const svn_patch_t *patch,
                   const char *base_dir,
                   svn_wc_context_t *wc_ctx, int strip_count,
-                  apr_array_header_t *filter_globs,
+                  const apr_array_header_t *include_patterns,
+                  const apr_array_header_t *exclude_patterns,
+                  apr_hash_t *patched_tempfiles,
+                  apr_hash_t *reject_tempfiles,
                   apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
   patch_target_t *target;
-  int i;
 
   target = apr_pcalloc(result_pool, sizeof(*target));
 
@@ -345,13 +351,37 @@ init_patch_target(patch_target_t **patch
                               result_pool, scratch_pool));
 
   target->filtered = FALSE;
-  if (filter_globs)
+  if (include_patterns)
     {
-      for (i = 0; i < filter_globs->nelts; i++)
+      int i;
+      const char *glob;
+      svn_boolean_t match;
+
+      match = FALSE;
+      for (i = 0; i < include_patterns->nelts; i++)
         {
-          const char *glob;
+          glob = APR_ARRAY_IDX(include_patterns, i, const char *);
+          match = (apr_fnmatch(glob, target->canon_path_from_patchfile,
+                               APR_FNM_CASE_BLIND) == APR_SUCCESS);
+          if (match)
+            break;
+        }
 
-          glob = APR_ARRAY_IDX(filter_globs, i, const char *);
+      if (! match)
+        {
+          target->filtered = TRUE;
+          *patch_target = target;
+          return SVN_NO_ERROR;
+        }
+    }
+  if (exclude_patterns)
+    {
+      int i;
+      const char *glob;
+
+      for (i = 0; i < exclude_patterns->nelts; i++)
+        {
+          glob = APR_ARRAY_IDX(exclude_patterns, i, const char *);
           target->filtered = (apr_fnmatch(glob,
                                           target->canon_path_from_patchfile,
                                           APR_FNM_CASE_BLIND) == APR_SUCCESS);
@@ -381,7 +411,7 @@ init_patch_target(patch_target_t **patch
 
       if (target->kind == svn_node_file)
         {
-          /* Open the file. */ 
+          /* Open the file. */
           SVN_ERR(svn_io_file_open(&target->file, target->abs_path,
                                    APR_READ | APR_BINARY | APR_BUFFERED,
                                    APR_OS_DEFAULT, result_pool));
@@ -441,8 +471,14 @@ init_patch_target(patch_target_t **patch
       /* Create a temporary file to write the patched result to. */
       SVN_ERR(svn_stream_open_unique(&target->patched_raw,
                                      &target->patched_path, NULL,
-                                     svn_io_file_del_on_pool_cleanup,
+                                     patched_tempfiles ?
+                                       svn_io_file_del_none :
+                                       svn_io_file_del_on_pool_cleanup,
                                      result_pool, scratch_pool));
+      if (patched_tempfiles)
+        apr_hash_set(patched_tempfiles, target->canon_path_from_patchfile,
+                     APR_HASH_KEY_STRING, target->patched_path);
+
       /* Expand keywords in the patched file.
        * Repair newlines if svn:eol-style dictates a particular style. */
       repair_eol = (target->eol_style == svn_subst_eol_style_fixed ||
@@ -456,8 +492,13 @@ init_patch_target(patch_target_t **patch
        * in reject files. */
       SVN_ERR(svn_stream_open_unique(&target->reject,
                                      &target->reject_path, NULL,
-                                     svn_io_file_del_on_pool_cleanup,
+                                     reject_tempfiles ?
+                                       svn_io_file_del_none :
+                                       svn_io_file_del_on_pool_cleanup,
                                      result_pool, scratch_pool));
+      if (reject_tempfiles)
+        apr_hash_set(reject_tempfiles, target->canon_path_from_patchfile,
+                     APR_HASH_KEY_STRING, target->reject_path);
 
       /* The reject stream needs a diff header. */
       diff_header = apr_psprintf(scratch_pool, "--- %s%s+++ %s%s",
@@ -688,7 +729,7 @@ scan_for_match(svn_linenum_t *matched_li
           for (i = 0; i < target->hunks->nelts; i++)
             {
               const hunk_info_t *hi;
-              
+
               hi = APR_ARRAY_IDX(target->hunks, i, const hunk_info_t *);
               taken = (! hi->rejected &&
                        target->current_line >= hi->matched_line &&
@@ -1055,12 +1096,20 @@ send_patch_notification(const patch_targ
  * in RESULT_POOL. Use WC_CTX as the working copy context.
  * STRIP_COUNT specifies the number of leading path components
  * which should be stripped from target paths in the patch.
- * If a target matches a glob in FILTER_GLOBS, mark it as filtered.
+ * If a target does not match a glob in INCLUDE_PATTERNS, mark it as filtered.
+ * If a target matches a glob in EXCLUDE_PATTERNS, mark it as filtered.
+ * If PATCHED_TEMPFILES or REJECT_TEMPFILES are not NULL, add the path
+ * to temporary patched/reject files to them, keyed by the target's path
+ * as parsed from the patch file (after canonicalization).
  * Do temporary allocations in SCRATCH_POOL. */
 static svn_error_t *
 apply_one_patch(patch_target_t **patch_target, svn_patch_t *patch,
                 const char *abs_wc_path, svn_wc_context_t *wc_ctx,
-                int strip_count, apr_array_header_t *filter_globs,
+                int strip_count,
+                const apr_array_header_t *include_patterns,
+                const apr_array_header_t *exclude_patterns,
+                apr_hash_t *patched_tempfiles,
+                apr_hash_t *reject_tempfiles,
                 apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
   patch_target_t *target;
@@ -1069,7 +1118,9 @@ apply_one_patch(patch_target_t **patch_t
   static const int MAX_FUZZ = 2;
 
   SVN_ERR(init_patch_target(&target, patch, abs_wc_path, wc_ctx, strip_count,
-                            filter_globs, result_pool, scratch_pool));
+                            include_patterns, exclude_patterns,
+                            patched_tempfiles, reject_tempfiles,
+                            result_pool, scratch_pool));
 
   if (target->skipped || target->filtered)
     {
@@ -1091,7 +1142,7 @@ apply_one_patch(patch_target_t **patch_t
 
       /* Determine the line the hunk should be applied at.
        * If no match is found initially, try with fuzz. */
-      do 
+      do
         {
           SVN_ERR(get_hunk_info(&hi, target, hunk, fuzz,
                                 result_pool, iterpool));
@@ -1267,7 +1318,7 @@ install_patched_target(patch_target_t *t
                   /* The WC_DB doesn't know much about this node.
                    * Check what's on disk. */
                   svn_node_kind_t disk_kind;
- 
+
                   SVN_ERR(svn_io_check_path(abs_path, &disk_kind, iterpool));
                   if (disk_kind != svn_node_none)
                     {
@@ -1295,7 +1346,7 @@ install_patched_target(patch_target_t *t
                     {
                       if (ctx->notify_func2)
                         {
-                          /* Just do notification. */ 
+                          /* Just do notification. */
                           svn_wc_notify_t *notify;
                           notify = svn_wc_create_notify(abs_path,
                                                         svn_wc_notify_add,
@@ -1378,8 +1429,18 @@ typedef struct {
   /* Whether to apply the patch in reverse. */
   svn_boolean_t reverse;
 
-  /* Glob patterns. Files matching any of these patterns won't be patched. */
-  apr_array_header_t *filter_globs;
+  /* Files not matching any of these patterns won't be patched. */
+  const apr_array_header_t *include_patterns;
+
+  /* Files matching any of these patterns won't be patched. */
+  const apr_array_header_t *exclude_patterns;
+
+  /* Mapping patch target path -> path to tempfile with patched result. */
+  apr_hash_t *patched_tempfiles;
+
+  /* Mapping patch target path -> path to tempfile with rejected hunks. */
+  apr_hash_t *reject_tempfiles;
+
 
   /* The client context. */
   svn_client_ctx_t *ctx;
@@ -1399,7 +1460,7 @@ apply_patches(void *baton,
   apr_array_header_t *targets;
   int i;
   apply_patches_baton_t *btn;
-  
+
   btn = (apply_patches_baton_t *)baton;
 
   /* Try to open the patch file. */
@@ -1425,17 +1486,19 @@ apply_patches(void *baton,
       if (btn->ctx->cancel_func)
         SVN_ERR(btn->ctx->cancel_func(btn->ctx->cancel_baton));
 
-      SVN_ERR(svn_diff__parse_next_patch(&patch, patch_file,
-                                         btn->reverse, scratch_pool, iterpool));
+      SVN_ERR(svn_diff_parse_next_patch(&patch, patch_file,
+                                        btn->reverse, scratch_pool, iterpool));
       if (patch)
         {
           patch_target_t *target;
 
           SVN_ERR(apply_one_patch(&target, patch, btn->abs_wc_path,
                                   btn->ctx->wc_ctx, btn->strip_count,
-                                  btn->filter_globs, scratch_pool, iterpool));
+                                  btn->include_patterns, btn->exclude_patterns,
+                                  btn->patched_tempfiles, btn->reject_tempfiles,
+                                  result_pool, iterpool));
           if (target->filtered)
-            SVN_ERR(svn_diff__close_patch(patch));
+            SVN_ERR(svn_diff_close_patch(patch));
           else
             APR_ARRAY_PUSH(targets, patch_target_t *) = target;
         }
@@ -1457,7 +1520,7 @@ apply_patches(void *baton,
         SVN_ERR(install_patched_target(target, btn->abs_wc_path,
                                        btn->ctx, btn->dry_run, iterpool));
       SVN_ERR(send_patch_notification(target, btn->ctx, iterpool));
-      SVN_ERR(svn_diff__close_patch(target->patch));
+      SVN_ERR(svn_diff_close_patch(target->patch));
     }
 
   SVN_ERR(svn_io_file_close(patch_file, iterpool));
@@ -1473,9 +1536,13 @@ svn_client_patch(const char *abs_patch_p
                  svn_boolean_t dry_run,
                  int strip_count,
                  svn_boolean_t reverse,
-                 apr_array_header_t *filter_globs,
+                 const apr_array_header_t *include_patterns,
+                 const apr_array_header_t *exclude_patterns,
+                 apr_hash_t **patched_tempfiles,
+                 apr_hash_t **reject_tempfiles,
                  svn_client_ctx_t *ctx,
-                 apr_pool_t *pool)
+                 apr_pool_t *result_pool,
+                 apr_pool_t *scratch_pool)
 {
   apply_patches_baton_t baton;
 
@@ -1489,11 +1556,26 @@ svn_client_patch(const char *abs_patch_p
   baton.ctx = ctx;
   baton.strip_count = strip_count;
   baton.reverse = reverse;
-  baton.filter_globs = filter_globs;
+  baton.include_patterns = include_patterns;
+  baton.exclude_patterns = exclude_patterns;
+  if (patched_tempfiles)
+    {
+      (*patched_tempfiles) = apr_hash_make(result_pool);
+      baton.patched_tempfiles = (*patched_tempfiles);
+    }
+  else
+    baton.patched_tempfiles = NULL;
+  if (reject_tempfiles)
+    {
+      (*reject_tempfiles) = apr_hash_make(result_pool);
+      baton.reject_tempfiles = (*reject_tempfiles);
+    }
+  else
+    baton.reject_tempfiles = NULL;
 
   SVN_ERR(svn_wc__call_with_write_lock(apply_patches, &baton,
                                        ctx->wc_ctx, local_abspath,
-                                       pool, pool));
+                                       result_pool, scratch_pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/prop_commands.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/prop_commands.c Tue Mar 30 20:57:53 2010
@@ -711,8 +711,8 @@ remote_propget(apr_hash_t *props,
            hi;
            hi = apr_hash_next(hi))
         {
-          const char *this_name = svn_apr_hash_index_key(hi);
-          svn_dirent_t *this_ent = svn_apr_hash_index_val(hi);
+          const char *this_name = svn__apr_hash_index_key(hi);
+          svn_dirent_t *this_ent = svn__apr_hash_index_val(hi);
           const char *new_target_relative;
           svn_depth_t depth_below_here = depth;
 
@@ -1008,9 +1008,9 @@ remote_proplist(const char *target_prefi
        hi;
        hi = apr_hash_next(hi))
     {
-      const char *name = svn_apr_hash_index_key(hi);
-      apr_ssize_t klen = svn_apr_hash_index_klen(hi);
-      svn_string_t *value = svn_apr_hash_index_val(hi);
+      const char *name = svn__apr_hash_index_key(hi);
+      apr_ssize_t klen = svn__apr_hash_index_klen(hi);
+      svn_string_t *value = svn__apr_hash_index_val(hi);
       svn_prop_kind_t prop_kind;
 
       prop_kind = svn_property_kind(NULL, name);
@@ -1036,8 +1036,8 @@ remote_proplist(const char *target_prefi
            hi;
            hi = apr_hash_next(hi))
         {
-          const char *this_name = svn_apr_hash_index_key(hi);
-          svn_dirent_t *this_ent = svn_apr_hash_index_val(hi);
+          const char *this_name = svn__apr_hash_index_key(hi);
+          svn_dirent_t *this_ent = svn__apr_hash_index_val(hi);
           const char *new_target_relative;
 
           svn_pool_clear(subpool);

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/ra.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/ra.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/ra.c Tue Mar 30 20:57:53 2010
@@ -57,7 +57,7 @@ typedef struct
 
   /* An array of svn_client_commit_item3_t * structures, present only
      during working copy commits. */
-  apr_array_header_t *commit_items;
+  const apr_array_header_t *commit_items;
 
   /* A client context. */
   svn_client_ctx_t *ctx;
@@ -290,7 +290,7 @@ svn_error_t *
 svn_client__open_ra_session_internal(svn_ra_session_t **ra_session,
                                      const char *base_url,
                                      const char *base_dir,
-                                     apr_array_header_t *commit_items,
+                                     const apr_array_header_t *commit_items,
                                      svn_boolean_t use_admin,
                                      svn_boolean_t read_only_wc,
                                      svn_client_ctx_t *ctx,
@@ -754,9 +754,9 @@ svn_client__get_youngest_common_ancestor
      remembering the youngest matching location. */
   for (hi = apr_hash_first(pool, history1); hi; hi = apr_hash_next(hi))
     {
-      const char *path = svn_apr_hash_index_key(hi);
-      apr_ssize_t path_len = svn_apr_hash_index_klen(hi);
-      apr_array_header_t *ranges1 = svn_apr_hash_index_val(hi);
+      const char *path = svn__apr_hash_index_key(hi);
+      apr_ssize_t path_len = svn__apr_hash_index_klen(hi);
+      apr_array_header_t *ranges1 = svn__apr_hash_index_val(hi);
       apr_array_header_t *ranges2, *common;
 
       ranges2 = apr_hash_get(history2, path, path_len);

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/repos_diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/repos_diff.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/repos_diff.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/repos_diff.c Tue Mar 30 20:57:53 2010
@@ -50,8 +50,9 @@ struct edit_baton {
      URL open in RA_SESSION below. */
   const char *target;
 
-  /* ADM_ACCESS is an access baton that includes the TARGET directory */
-  svn_wc_adm_access_t *adm_access;
+  /* A working copy context for TARGET, NULL if this is purely a
+     repository operation. */
+  svn_wc_context_t *wc_ctx;
 
   /* The callback and calback argument that implement the file comparison
      function */
@@ -321,56 +322,65 @@ get_dirprops_from_ra(struct dir_baton *b
 }
 
 
-/* Return in *LOCAL_DIR_ABSPATH the absolute path for the directory PATH by
-   searching the access baton set of ADM_ACCESS.  If ADM_ACCESS is NULL then
-   *LOCAL_DIR_ABSPATH will be NULL.  If LENIENT is TRUE then failure to find
-   an access baton will not return an error but will set *LOCAL_DIR_ABSPATH to
-   NULL instead. */
+/* If WC_CTX is NULL then set *LOCAL_DIR_ABSPATH to NULL otherwise
+   return in *LOCAL_DIR_ABSPATH the absolute path for the directory
+   PATH if PATH is a versioned directory. If PATH is not a versioned
+   directory and LENIENT is FALSE then return an error
+   SVN_ERR_WC_NOT_WORKING_COPY.  If LENIENT is TRUE then no error will
+   be returned but instead *LOCAL_DIR_ABSPATH will be set to NULL.
+
+   This rather odd interface was originally designed around searching
+   an access baton set. */
 static svn_error_t *
 get_dir_abspath(const char **local_dir_abspath,
-                svn_wc_adm_access_t *adm_access,
+                svn_wc_context_t *wc_ctx,
                 const char *path,
                 svn_boolean_t lenient,
                 apr_pool_t *pool)
 {
   *local_dir_abspath = NULL;
 
-  if (adm_access)
+  if (wc_ctx)
     {
-      svn_wc_adm_access_t *path_access;
-      svn_error_t *err = svn_wc_adm_retrieve(&path_access, adm_access, path,
-                                             pool);
+      svn_node_kind_t kind;
+      svn_error_t *err;
+      const char *local_abspath;
+      SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+      err = svn_wc__node_get_kind(&kind, wc_ctx, local_abspath, FALSE, pool);
       if (err)
         {
-          if (! lenient)
+          if (lenient)
+            kind = svn_node_none;
+          else
             return svn_error_return(err);
-          svn_error_clear(err);
         }
-      else if (path_access != NULL)
-        SVN_ERR(svn_dirent_get_absolute(local_dir_abspath,
-                                        svn_wc_adm_access_path(path_access),
-                                        pool));
-
+      svn_error_clear(err);
+      if (kind == svn_node_dir)
+        *local_dir_abspath = local_abspath;
+      else if (!lenient)
+        return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,
+                                 "'%s' is not a versioned directory",
+                                 svn_dirent_local_style(local_abspath, pool));
     }
 
   return SVN_NO_ERROR;
 }
 
-/* Like get_path_access except the returned access baton, in
-   *PARENT_ACCESS, is for the parent of PATH rather than for PATH
-   itself. */
+/* Like get_path_access except the returned path, in
+   *LOCAL_PARENT_DIR_ABSPATH, is for the parent of PATH rather than
+   for PATH itself.  As for get_path_access WC_CTX may be NULL. */
 static svn_error_t *
 get_parent_dir_abspath(const char **local_parent_dir_abspath,
-                       svn_wc_adm_access_t *adm_access,
+                       svn_wc_context_t *wc_ctx,
                        const char *path,
                        svn_boolean_t lenient,
-                      apr_pool_t *pool)
+                       apr_pool_t *pool)
 {
-  if (! adm_access)
+  if (!wc_ctx)
     *local_parent_dir_abspath = NULL;  /* Avoid messing around with paths */
   else
     {
-      SVN_ERR(get_dir_abspath(local_parent_dir_abspath, adm_access,
+      SVN_ERR(get_dir_abspath(local_parent_dir_abspath, wc_ctx,
                               svn_dirent_dirname(path, pool),
                               lenient, pool));
     }
@@ -450,9 +460,9 @@ delete_entry(const char *path,
 
   /* We need to know if this is a directory or a file */
   SVN_ERR(svn_ra_check_path(eb->ra_session, path, eb->revision, &kind, pool));
-  SVN_ERR(get_dir_abspath(&local_dir_abspath, eb->adm_access, pb->wcpath,
+  SVN_ERR(get_dir_abspath(&local_dir_abspath, eb->wc_ctx, pb->wcpath,
                           TRUE, pool));
-  if ((! eb->adm_access) || local_dir_abspath)
+  if ((! eb->wc_ctx) || local_dir_abspath)
     {
       switch (kind)
         {
@@ -554,7 +564,7 @@ add_directory(const char *path,
     }
 
 
-  SVN_ERR(get_dir_abspath(&local_dir_abspath, eb->adm_access, pb->wcpath, TRUE,
+  SVN_ERR(get_dir_abspath(&local_dir_abspath, eb->wc_ctx, pb->wcpath, TRUE,
                           pool));
 
   SVN_ERR(eb->diff_callbacks->dir_added
@@ -642,7 +652,7 @@ open_directory(const char *path,
 
   SVN_ERR(get_dirprops_from_ra(b, base_revision));
 
-  SVN_ERR(get_dir_abspath(&local_dir_abspath, eb->adm_access, pb->wcpath, TRUE,
+  SVN_ERR(get_dir_abspath(&local_dir_abspath, eb->wc_ctx, pb->wcpath, TRUE,
                           pool));
 
   SVN_ERR(eb->diff_callbacks->dir_opened
@@ -799,10 +809,10 @@ close_file(void *file_baton,
   if (b->skip)
     return SVN_NO_ERROR;
 
-  err = get_parent_dir_abspath(&local_dir_abspath, eb->adm_access,
+  err = get_parent_dir_abspath(&local_dir_abspath, eb->wc_ctx,
                                b->wcpath, eb->dry_run, b->pool);
 
-  if (err && err->apr_err == SVN_ERR_WC_NOT_LOCKED)
+  if (err && err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY)
     {
       /* ### maybe try to stat the local b->wcpath? */
       /* If the file path doesn't exist, then send a 'skipped' notification. */
@@ -934,10 +944,10 @@ close_directory(void *dir_baton,
   if (eb->dry_run)
     svn_hash__clear(svn_client__dry_run_deletions(eb->diff_cmd_baton), pool);
 
-  err = get_dir_abspath(&local_dir_abspath, eb->adm_access, b->wcpath,
+  err = get_dir_abspath(&local_dir_abspath, eb->wc_ctx, b->wcpath,
                         eb->dry_run, b->pool);
 
-  if (err && err->apr_err == SVN_ERR_WC_NOT_LOCKED)
+  if (err && err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY)
     {
       /* ### maybe try to stat the local b->wcpath? */
       /* If the path doesn't exist, then send a 'skipped' notification.
@@ -991,8 +1001,8 @@ close_directory(void *dir_baton,
       for (hi = apr_hash_first(pool, eb->deleted_paths); hi;
            hi = apr_hash_next(hi))
         {
-          const char *deleted_path = svn_apr_hash_index_key(hi);
-          deleted_path_notify_t *dpn = svn_apr_hash_index_val(hi);
+          const char *deleted_path = svn__apr_hash_index_key(hi);
+          deleted_path_notify_t *dpn = svn__apr_hash_index_val(hi);
 
           notify = svn_wc_create_notify(deleted_path, dpn->action, pool);
           notify->kind = dpn->kind;
@@ -1161,8 +1171,7 @@ svn_client__get_diff_editor(const char *
   SVN_ERR(svn_dirent_get_absolute(&target_abspath, target, pool));
 
   eb->target = target;
-  SVN_ERR(svn_wc__adm_retrieve_from_context(&(eb->adm_access), wc_ctx,
-                                            target_abspath, pool));
+  eb->wc_ctx = wc_ctx;
   eb->diff_callbacks = diff_callbacks;
   eb->diff_cmd_baton = diff_cmd_baton;
   eb->dry_run = dry_run;

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/revert.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/revert.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/revert.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/revert.c Tue Mar 30 20:57:53 2010
@@ -50,7 +50,7 @@ struct revert_with_write_lock_baton {
 };
 
 /* (Note: All arguments are in the baton above.)
-  
+
    Attempt to revert LOCAL_ABSPATH.
 
    If DEPTH is svn_depth_empty, revert just the properties on the

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/switch.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/switch.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/switch.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/switch.c Tue Mar 30 20:57:53 2010
@@ -55,7 +55,7 @@
 */
 
 
-svn_error_t *
+static svn_error_t *
 switch_internal(svn_revnum_t *result_rev,
                 const char *path,
                 const char *local_abspath,
@@ -216,12 +216,12 @@ switch_internal(svn_revnum_t *result_rev
 
      We pass in an external_func for recording all externals. It
      shouldn't be needed for a switch if it wasn't for the relative
-     externals of type '../path'. All of those must be resolved to 
+     externals of type '../path'. All of those must be resolved to
      the new location.  */
   err = svn_wc_crawl_revisions5(ctx->wc_ctx, local_abspath, reporter,
                                 report_baton, TRUE, depth, (! depth_is_sticky),
                                 (! server_supports_depth),
-                                use_commit_times, 
+                                use_commit_times,
                                 svn_client__external_info_gatherer, &efb,
                                 ctx->notify_func2, ctx->notify_baton2, pool);
 

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/update.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/update.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/update.c Tue Mar 30 20:57:53 2010
@@ -222,7 +222,7 @@ update_internal(svn_revnum_t *result_rev
      the RA driver will call editor->set_target_revision later on. */
   SVN_ERR(svn_wc_get_update_editor4(&update_editor, &update_edit_baton,
                                     &revnum, ctx->wc_ctx, anchor_abspath,
-                                    target, use_commit_times, depth, 
+                                    target, use_commit_times, depth,
                                     depth_is_sticky, allow_unver_obstructions,
                                     diff3_cmd, preserved_exts,
                                     file_fetcher, ffb,
@@ -248,7 +248,7 @@ update_internal(svn_revnum_t *result_rev
   /* Drive the reporter structure, describing the revisions within
      PATH.  When we call reporter->finish_report, the
      update_editor will be driven by svn_repos_dir_delta2. */
-  err = svn_wc_crawl_revisions5(ctx->wc_ctx, local_abspath, reporter, 
+  err = svn_wc_crawl_revisions5(ctx->wc_ctx, local_abspath, reporter,
                                 report_baton, TRUE, depth, (! depth_is_sticky),
                                 (! server_supports_depth),
                                 use_commit_times,
@@ -271,7 +271,7 @@ update_internal(svn_revnum_t *result_rev
   if (SVN_DEPTH_IS_RECURSIVE(depth) && (! ignore_externals))
     {
       SVN_ERR(svn_client__handle_externals(efb.externals_old,
-                                           efb.externals_new, 
+                                           efb.externals_new,
                                            efb.ambient_depths,
                                            anchor_url, anchor,
                                            repos_root,

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/util.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/util.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/util.c Tue Mar 30 20:57:53 2010
@@ -50,9 +50,9 @@ string_hash_dup(apr_hash_t *hash, apr_po
 
   for (hi = apr_hash_first(pool, hash); hi; hi = apr_hash_next(hi))
     {
-      const char *key = apr_pstrdup(pool, svn_apr_hash_index_key(hi));
-      apr_ssize_t klen = svn_apr_hash_index_klen(hi);
-      svn_string_t *val = svn_string_dup(svn_apr_hash_index_val(hi), pool);
+      const char *key = apr_pstrdup(pool, svn__apr_hash_index_key(hi));
+      apr_ssize_t klen = svn__apr_hash_index_klen(hi);
+      svn_string_t *val = svn_string_dup(svn__apr_hash_index_val(hi), pool);
 
       apr_hash_set(new_hash, key, klen, val);
     }

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_delta/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_delta/compat.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_delta/compat.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_delta/compat.c Tue Mar 30 20:57:53 2010
@@ -33,7 +33,7 @@ struct file_rev_handler_wrapper_baton {
   svn_file_rev_handler_old_t handler;
 };
 
-/* This implements svn_repos_file_rev_handler2_t. */
+/* This implements svn_file_rev_handler_t. */
 static svn_error_t *
 file_rev_handler_wrapper(void *baton,
                          const char *path,

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_delta/compose_delta.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_delta/compose_delta.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_delta/compose_delta.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_delta/compose_delta.c Tue Mar 30 20:57:53 2010
@@ -160,36 +160,49 @@ create_offset_index(const svn_txdelta_wi
 }
 
 /* Find the index of the delta op thet defines that data at OFFSET in
-   NDX. */
+   NDX. HINT is an arbitrary positin within NDX and doesn't even need 
+   to be valid. To effectively speed up the search, use the last result
+   as hint because most lookups come as a sequence of decreasing values
+   for OFFSET and they concentrate on the lower end of the array. */
 
 static int
-search_offset_index(const offset_index_t *ndx, apr_size_t offset)
+search_offset_index(const offset_index_t *ndx, apr_size_t offset, int hint)
 {
   int lo, hi, op;
 
   assert(offset < ndx->offs[ndx->length]);
 
-  for (lo = 0, hi = ndx->length, op = (lo + hi)/2;
-       lo < hi;
-       op = (lo + hi)/2)
-    {
-      const apr_size_t this_offset = ndx->offs[op];
-      const apr_size_t next_offset = ndx->offs[op + 1];
-      if (offset < this_offset)
-        hi = op;
-      else if (offset > next_offset)
-        lo = op;
+  lo = 0;
+  hi = ndx->length;
+
+  /* If we got a valid hint, use it to reduce the range to cover.
+     Note that this will only be useful if either the hint is a
+     hit (i.e. equals the desired result) or narrows the range
+     length by a factor larger than 2. */
+
+  if (hint < hi)
+    {
+      if (offset < ndx->offs[hint])
+        hi = hint;
+      else if (offset < ndx->offs[hint+1])
+        return hint;
       else
-        {
-          /* this_offset <= offset <= next_offset */
-          if (offset == next_offset)
-            ++op;
-          break;
-        }
+        lo = hint+1;
     }
 
-  assert(ndx->offs[op] <= offset && offset < ndx->offs[op + 1]);
-  return op;
+  /* ordinary binary search */
+
+  for (op = (lo + hi)/2; lo != hi; op = (lo + hi)/2)
+    {
+      if (offset < ndx->offs[op])
+        hi = op;
+      else 
+        lo = ++op;
+    }
+
+  --lo;
+  assert(ndx->offs[lo] <= offset && offset < ndx->offs[lo + 1]);
+  return lo;
 }
 
 
@@ -614,28 +627,33 @@ build_range_list(apr_size_t offset, apr_
 
 /* Copy the instructions from WINDOW that define the range [OFFSET,
    LIMIT) in WINDOW's target stream to TARGET_OFFSET in the window
-   represented by BUILD_BATON. Use NDX to find the instructions in
-   WINDOW. Allocate space in BUILD_BATON from POOL. */
+   represented by BUILD_BATON. HINT is a position in the instructions
+   array that helps finding the position for OFFSET. A safe default 
+   is 0. Use NDX to find the instructions in WINDOW. Allocate space 
+   in BUILD_BATON from POOL. */
 
 static void
-copy_source_ops(apr_size_t offset, apr_size_t limit,
+copy_source_ops(apr_size_t offset, apr_size_t limit,  
                 apr_size_t target_offset,
+                int hint,
                 svn_txdelta__ops_baton_t *build_baton,
                 const svn_txdelta_window_t *window,
                 const offset_index_t *ndx,
                 apr_pool_t *pool)
 {
-  const int first_op = search_offset_index(ndx, offset);
-  const int last_op = search_offset_index(ndx, limit - 1);
-  int op_ndx;
-
-  for (op_ndx = first_op; op_ndx <= last_op; ++op_ndx)
+  int op_ndx = search_offset_index(ndx, offset, hint);
+  for (;; ++op_ndx)
     {
       const svn_txdelta_op_t *const op = &window->ops[op_ndx];
       const apr_size_t *const off = &ndx->offs[op_ndx];
+      apr_size_t fix_offset;
+      apr_size_t fix_limit;
+
+      if (off[0] >= limit)
+          break;
 
-      const apr_size_t fix_offset = (offset > off[0] ? offset - off[0] : 0);
-      const apr_size_t fix_limit = (off[1] > limit ? off[1] - limit : 0);
+      fix_offset = (offset > off[0] ? offset - off[0] : 0);
+      fix_limit = (off[1] > limit ? off[1] - limit : 0);
 
       /* It would be extremely weird if the fixed-up op had zero length. */
       assert(fix_offset + fix_limit < op->length);
@@ -667,6 +685,7 @@ copy_source_ops(apr_size_t offset, apr_s
               copy_source_ops(op->offset + fix_offset,
                               op->offset + op->length - fix_limit,
                               target_offset,
+                              op_ndx,
                               build_baton, window, ndx, pool);
             }
           else
@@ -692,6 +711,7 @@ copy_source_ops(apr_size_t offset, apr_s
                   copy_source_ops(op->offset + ptn_overlap,
                                   op->offset + ptn_overlap + length,
                                   tgt_off,
+                                  op_ndx,
                                   build_baton, window, ndx, pool);
                   fix_off += length;
                   tgt_off += length;
@@ -707,6 +727,7 @@ copy_source_ops(apr_size_t offset, apr_s
                   copy_source_ops(op->offset,
                                   op->offset + length,
                                   tgt_off,
+                                  op_ndx,
                                   build_baton, window, ndx, pool);
                   fix_off += length;
                   tgt_off += length;
@@ -788,7 +809,7 @@ svn_txdelta_compose_windows(const svn_tx
                                        range->limit - range->offset,
                                        NULL, pool);
               else
-                copy_source_ops(range->offset, range->limit, tgt_off,
+                copy_source_ops(range->offset, range->limit, tgt_off, 0,
                                 &build_baton, window_A, offset_index,
                                 pool);
 

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_delta/path_driver.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_delta/path_driver.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_delta/path_driver.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_delta/path_driver.c Tue Mar 30 20:57:53 2010
@@ -133,7 +133,7 @@ svn_error_t *
 svn_delta_path_driver(const svn_delta_editor_t *editor,
                       void *edit_baton,
                       svn_revnum_t revision,
-                      apr_array_header_t *paths,
+                      const apr_array_header_t *paths,
                       svn_delta_path_driver_cb_func_t callback_func,
                       void *callback_baton,
                       apr_pool_t *pool)

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_diff/diff.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_diff/diff.h?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_diff/diff.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_diff/diff.h Tue Mar 30 20:57:53 2010
@@ -91,7 +91,7 @@ typedef enum svn_diff__normalize_state_t
 svn_diff__lcs_t *
 svn_diff__lcs(svn_diff__position_t *position_list1, /* pointer to tail (ring) */
               svn_diff__position_t *position_list2, /* pointer to tail (ring) */
-	      apr_pool_t *pool);
+              apr_pool_t *pool);
 
 
 /*

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_diff/parse-diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_diff/parse-diff.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_diff/parse-diff.c Tue Mar 30 20:57:53 2010
@@ -31,9 +31,7 @@
 #include "svn_pools.h"
 #include "svn_utf.h"
 #include "svn_dirent_uri.h"
-
-#include "private/svn_diff_private.h"
-
+#include "svn_diff.h"
 
 /* Helper macro for readability */
 #define starts_with(str, start)  \
@@ -411,7 +409,7 @@ parse_next_hunk(svn_hunk_t **hunk,
 
   if (! eof)
     /* Rewind to the start of the line just read, so subsequent calls
-     * to this function or svn_diff__parse_next_patch() don't end
+     * to this function or svn_diff_parse_next_patch() don't end
      * up skipping the line -- it may contain a patch or hunk header. */
     SVN_ERR(svn_io_file_seek(patch->patch_file, APR_SET, &last_line,
                              scratch_pool));
@@ -499,11 +497,11 @@ close_hunk(const svn_hunk_t *hunk)
 }
 
 svn_error_t *
-svn_diff__parse_next_patch(svn_patch_t **patch,
-                           apr_file_t *patch_file,
-                           svn_boolean_t reverse,
-                           apr_pool_t *result_pool,
-                           apr_pool_t *scratch_pool)
+svn_diff_parse_next_patch(svn_patch_t **patch,
+                          apr_file_t *patch_file,
+                          svn_boolean_t reverse,
+                          apr_pool_t *result_pool,
+                          apr_pool_t *scratch_pool)
 {
   static const char * const minus = "--- ";
   static const char * const plus = "+++ ";
@@ -633,7 +631,7 @@ svn_diff__parse_next_patch(svn_patch_t *
 }
 
 svn_error_t *
-svn_diff__close_patch(const svn_patch_t *patch)
+svn_diff_close_patch(const svn_patch_t *patch)
 {
   int i;
 

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs/fs-loader.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs/fs-loader.c Tue Mar 30 20:57:53 2010
@@ -760,7 +760,7 @@ svn_fs_change_txn_prop(svn_fs_txn_t *txn
 }
 
 svn_error_t *
-svn_fs_change_txn_props(svn_fs_txn_t *txn, apr_array_header_t *props,
+svn_fs_change_txn_props(svn_fs_txn_t *txn, const apr_array_header_t *props,
                         apr_pool_t *pool)
 {
   return txn->vtable->change_props(txn, props, pool);

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs/fs-loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs/fs-loader.h?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs/fs-loader.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs/fs-loader.h Tue Mar 30 20:57:53 2010
@@ -214,7 +214,7 @@ typedef struct txn_vtable_t
                               const svn_string_t *value, apr_pool_t *pool);
   svn_error_t *(*root)(svn_fs_root_t **root_p, svn_fs_txn_t *txn,
                        apr_pool_t *pool);
-  svn_error_t *(*change_props)(svn_fs_txn_t *txn, apr_array_header_t *props,
+  svn_error_t *(*change_props)(svn_fs_txn_t *txn, const apr_array_header_t *props,
                                apr_pool_t *pool);
 } txn_vtable_t;
 

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/bdb/changes-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/bdb/changes-table.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/bdb/changes-table.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/bdb/changes-table.c Tue Mar 30 20:57:53 2010
@@ -168,6 +168,15 @@ fold_change(apr_hash_t *changes,
           (SVN_ERR_FS_CORRUPT, NULL,
            _("Invalid change ordering: non-add change on deleted path"));
 
+      /* Sanity check: an add can't follow anything except
+         a delete or reset.  */
+      if ((change->kind == svn_fs_path_change_add)
+          && (old_change->change_kind != svn_fs_path_change_delete)
+          && (old_change->change_kind != svn_fs_path_change_reset))
+        return svn_error_create
+          (SVN_ERR_FS_CORRUPT, NULL,
+           _("Invalid change ordering: add change on preexisting path"));
+
       /* Now, merge that change in. */
       switch (change->kind)
         {

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/obliterate.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/obliterate.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/obliterate.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/obliterate.c Tue Mar 30 20:57:53 2010
@@ -161,8 +161,8 @@ svn_fs_base__node_rev_dup(const svn_fs_i
           for (hi = apr_hash_first(scratch_pool, entries); hi;
                hi = apr_hash_next(hi))
             {
-              const char *child_name = svn_apr_hash_index_key(hi);
-              svn_fs_dirent_t *child_entry = svn_apr_hash_index_val(hi);
+              const char *child_name = svn__apr_hash_index_key(hi);
+              svn_fs_dirent_t *child_entry = svn__apr_hash_index_val(hi);
               const svn_fs_id_t *new_child_id;
 
               svn_pool_clear(iterpool);

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/reps-strings.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/reps-strings.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/reps-strings.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/reps-strings.c Tue Mar 30 20:57:53 2010
@@ -132,7 +132,7 @@ delta_string_keys(apr_array_header_t **k
 
 /* Delete the strings associated with array KEYS in FS as part of TRAIL.  */
 static svn_error_t *
-delete_strings(apr_array_header_t *keys,
+delete_strings(const apr_array_header_t *keys,
                svn_fs_t *fs,
                trail_t *trail,
                apr_pool_t *pool)
@@ -323,7 +323,7 @@ get_one_window(struct compose_handler_ba
 
 static svn_error_t *
 rep_undeltify_range(svn_fs_t *fs,
-                    apr_array_header_t *deltas,
+                    const apr_array_header_t *deltas,
                     representation_t *fulltext,
                     int cur_chunk,
                     char *buf,

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/revs-txns.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/revs-txns.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/revs-txns.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/revs-txns.c Tue Mar 30 20:57:53 2010
@@ -637,7 +637,7 @@ svn_fs_base__change_txn_prop(svn_fs_txn_
 
 svn_error_t *
 svn_fs_base__change_txn_props(svn_fs_txn_t *txn,
-                              apr_array_header_t *props,
+                              const apr_array_header_t *props,
                               apr_pool_t *pool)
 {
   apr_pool_t *iterpool = svn_pool_create(pool);

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/revs-txns.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/revs-txns.h?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/revs-txns.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/revs-txns.h Tue Mar 30 20:57:53 2010
@@ -226,7 +226,7 @@ svn_error_t *svn_fs_base__change_txn_pro
                                           apr_pool_t *pool);
 
 svn_error_t *svn_fs_base__change_txn_props(svn_fs_txn_t *txn,
-                                           apr_array_header_t *props,
+                                           const apr_array_header_t *props,
                                            apr_pool_t *pool);
 
 

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/tree.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/tree.h?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/tree.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/tree.h Tue Mar 30 20:57:53 2010
@@ -95,6 +95,13 @@ svn_error_t *svn_fs_base__get_path_creat
                                                trail_t *trail,
                                                apr_pool_t *pool);
 
+/* ### Experimental obliterate-like-deltify - see implementation. */
+svn_error_t *
+svn_fs_base__obliterate_rep(svn_fs_t *fs,
+                            const char *path,
+                            svn_revnum_t revision,
+                            apr_pool_t *pool);
+
 
 #ifdef __cplusplus
 }

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/util/fs_skels.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/util/fs_skels.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/util/fs_skels.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_base/util/fs_skels.c Tue Mar 30 20:57:53 2010
@@ -433,8 +433,9 @@ svn_fs_base__parse_transaction_skel(tran
     {
       /* Committed transactions have a revision number... */
       transaction->base_id = NULL;
-      transaction->revision = atoi(apr_pstrmemdup(pool, base_id_or_rev->data,
-                                                  base_id_or_rev->len));
+      transaction->revision =
+        SVN_STR_TO_REV(apr_pstrmemdup(pool, base_id_or_rev->data,
+                                      base_id_or_rev->len));
       if (! SVN_IS_VALID_REVNUM(transaction->revision))
         return skel_err("transaction");
 

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/caching.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/caching.c Tue Mar 30 20:57:53 2010
@@ -93,7 +93,7 @@ dup_dir_listing(void **out,
 
   for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
     {
-      svn_fs_dirent_t *dirent = svn_apr_hash_index_val(hi);
+      svn_fs_dirent_t *dirent = svn__apr_hash_index_val(hi);
       svn_fs_dirent_t *new_dirent;
 
       new_dirent = apr_palloc(pool, sizeof(*new_dirent));

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/dag.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/dag.c Tue Mar 30 20:57:53 2010
@@ -844,7 +844,7 @@ svn_fs_fs__dag_delete_if_mutable(svn_fs_
                hi;
                hi = apr_hash_next(hi))
             {
-              svn_fs_dirent_t *dirent = svn_apr_hash_index_val(hi);
+              svn_fs_dirent_t *dirent = svn__apr_hash_index_val(hi);
 
               SVN_ERR(svn_fs_fs__dag_delete_if_mutable(fs, dirent->id,
                                                        pool));

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs.h?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs.h Tue Mar 30 20:57:53 2010
@@ -59,8 +59,8 @@ extern "C" {
 #define PATH_LOCKS_DIR        "locks"            /* Directory of locks */
 #define PATH_MIN_UNPACKED_REV "min-unpacked-rev" /* Oldest revision which
                                                     has not been packed. */
-#define PATH_MIN_UNPACKED_REVPROP "min-unpacked-revprop" /* Oldest revision 
-                                                            property which has 
+#define PATH_MIN_UNPACKED_REVPROP "min-unpacked-revprop" /* Oldest revision
+                                                            property which has
                                                             not been packed. */
 #define PATH_REVPROPS_DB "revprops.db"
 /* If you change this, look at tests/svn_test_fs.c(maybe_install_fsfs_conf) */

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.c Tue Mar 30 20:57:53 2010
@@ -1182,7 +1182,7 @@ static svn_error_t *
 update_min_unpacked_revprop(svn_fs_t *fs, apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
-  
+
   return read_min_unpacked_rev(&ffd->min_unpacked_revprop,
                                path_min_unpacked_revprop(fs, pool),
                                pool);
@@ -1852,6 +1852,7 @@ get_packed_offset(apr_off_t *rev_offset,
       if (eof)
         break;
 
+      errno = 0; /* apr_atoi64() in APR-0.9 does not always set errno */
       APR_ARRAY_PUSH(manifest, apr_off_t) =
                 apr_atoi64(svn_string_create_from_buf(sb, iterpool)->data);
       if (errno == ERANGE)
@@ -2163,7 +2164,7 @@ svn_fs_fs__read_noderev(node_revision_t 
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                                 _("Malformed copyroot line in node-rev"));
 
-      noderev->copyroot_rev = atoi(str);
+      noderev->copyroot_rev = SVN_STR_TO_REV(str);
 
       if (last_str == NULL)
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
@@ -2187,7 +2188,7 @@ svn_fs_fs__read_noderev(node_revision_t 
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                                 _("Malformed copyfrom line in node-rev"));
 
-      noderev->copyfrom_rev = atoi(str);
+      noderev->copyfrom_rev = SVN_STR_TO_REV(str);
 
       if (last_str == NULL)
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
@@ -2419,7 +2420,7 @@ read_rep_line(struct rep_args **rep_args
 
   str = apr_strtok(NULL, " ", &last_str);
   if (! str) goto err;
-  rep_args->base_revision = atol(str);
+  rep_args->base_revision = SVN_STR_TO_REV(str);
 
   str = apr_strtok(NULL, " ", &last_str);
   if (! str) goto err;
@@ -2685,7 +2686,7 @@ set_revision_proplist(svn_fs_t *fs,
 
   SVN_ERR(ensure_revision_exists(fs, rev, pool));
 
-  if (ffd->format < SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT || 
+  if (ffd->format < SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT ||
       rev >= ffd->min_unpacked_revprop)
     {
       const char *final_path = path_revprops(fs, rev, pool);
@@ -2727,9 +2728,9 @@ revision_proplist(apr_hash_t **proplist_
 {
   fs_fs_data_t *ffd = fs->fsap_data;
   apr_hash_t *proplist;
- 
+
   SVN_ERR(ensure_revision_exists(fs, rev, pool));
- 
+
   if (ffd->format < SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT ||
       rev >= ffd->min_unpacked_revprop)
     {
@@ -2737,7 +2738,7 @@ revision_proplist(apr_hash_t **proplist_
       svn_error_t *err = SVN_NO_ERROR;
       int i;
       apr_pool_t *iterpool;
- 
+
       proplist = apr_hash_make(pool);
       iterpool = svn_pool_create(pool);
       for (i = 0; i < RECOVERABLE_RETRY_COUNT; i++)
@@ -3553,7 +3554,7 @@ unparse_dir_entries(apr_hash_t **str_ent
     {
       const void *key;
       apr_ssize_t klen;
-      svn_fs_dirent_t *dirent = svn_apr_hash_index_val(hi);
+      svn_fs_dirent_t *dirent = svn__apr_hash_index_val(hi);
       const char *new_val;
 
       apr_hash_this(hi, &key, &klen, NULL);
@@ -3601,8 +3602,8 @@ parse_dir_entries(apr_hash_t **entries_p
   /* Translate the string dir entries into real entries. */
   for (hi = apr_hash_first(pool, str_entries); hi; hi = apr_hash_next(hi))
     {
-      const char *name = svn_apr_hash_index_key(hi);
-      svn_string_t *str_val = svn_apr_hash_index_val(hi);
+      const char *name = svn__apr_hash_index_key(hi);
+      svn_string_t *str_val = svn__apr_hash_index_val(hi);
       char *str, *last_str;
       svn_fs_dirent_t *dirent = apr_pcalloc(pool, sizeof(*dirent));
 
@@ -3860,6 +3861,15 @@ fold_change(apr_hash_t *changes,
           (SVN_ERR_FS_CORRUPT, NULL,
            _("Invalid change ordering: non-add change on deleted path"));
 
+      /* Sanity check: an add can't follow anything except
+         a delete or reset.  */
+      if ((change->kind == svn_fs_path_change_add)
+          && (old_change->change_kind != svn_fs_path_change_delete)
+          && (old_change->change_kind != svn_fs_path_change_reset))
+        return svn_error_create
+          (SVN_ERR_FS_CORRUPT, NULL,
+           _("Invalid change ordering: add change on preexisting path"));
+
       /* Now, merge that change in. */
       switch (change->kind)
         {
@@ -4138,7 +4148,7 @@ read_change(change_t **change_p,
       if (! str)
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                                 _("Invalid changes line in rev-file"));
-      change->copyfrom_rev = atol(str);
+      change->copyfrom_rev = SVN_STR_TO_REV(str);
 
       if (! last_str)
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
@@ -4198,8 +4208,8 @@ fetch_all_changes(apr_hash_t *changed_pa
                hi = apr_hash_next(hi))
             {
               /* KEY is the path. */
-              const char *path = svn_apr_hash_index_key(hi);
-              apr_ssize_t klen = svn_apr_hash_index_klen(hi);
+              const char *path = svn__apr_hash_index_key(hi);
+              apr_ssize_t klen = svn__apr_hash_index_klen(hi);
 
               /* If we come across our own path, ignore it. */
               if (strcmp(change->path, path) == 0)
@@ -4595,7 +4605,7 @@ svn_fs_fs__change_txn_prop(svn_fs_txn_t 
 
 svn_error_t *
 svn_fs_fs__change_txn_props(svn_fs_txn_t *txn,
-                            apr_array_header_t *props,
+                            const apr_array_header_t *props,
                             apr_pool_t *pool)
 {
   const char *txn_prop_filename;
@@ -5512,7 +5522,7 @@ write_final_rev(const svn_fs_id_t **new_
 
       for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
         {
-          svn_fs_dirent_t *dirent = svn_apr_hash_index_val(hi);
+          svn_fs_dirent_t *dirent = svn__apr_hash_index_val(hi);
 
           svn_pool_clear(subpool);
           SVN_ERR(write_final_rev(&new_id, file, rev, fs, dirent->id,
@@ -5662,8 +5672,8 @@ write_final_changed_path_info(apr_off_t 
 
       svn_pool_clear(iterpool);
 
-      change = svn_apr_hash_index_val(hi);
-      path = svn_apr_hash_index_key(hi);
+      change = svn__apr_hash_index_val(hi);
+      path = svn__apr_hash_index_key(hi);
 
       id = change->node_rev_id;
 
@@ -5798,7 +5808,7 @@ verify_locks(svn_fs_t *fs,
   changed_paths = apr_array_make(pool, apr_hash_count(changes) + 1,
                                  sizeof(const char *));
   for (hi = apr_hash_first(pool, changes); hi; hi = apr_hash_next(hi))
-    APR_ARRAY_PUSH(changed_paths, const char *) = svn_apr_hash_index_key(hi);
+    APR_ARRAY_PUSH(changed_paths, const char *) = svn__apr_hash_index_key(hi);
   qsort(changed_paths->elts, changed_paths->nelts,
         changed_paths->elt_size, svn_sort_compare_paths);
 
@@ -6144,7 +6154,7 @@ commit_obliteration_body(void *baton, ap
  * to the rep-cache database of FS. */
 static svn_error_t *
 write_reps_to_cache(svn_fs_t *fs,
-                    apr_array_header_t *reps_to_cache,
+                    const apr_array_header_t *reps_to_cache,
                     apr_pool_t *scratch_pool)
 {
   int i;
@@ -6354,7 +6364,7 @@ svn_fs_fs__create(svn_fs_t *fs,
                                                         PATH_REVPROPS_DIR,
                                                         pool),
                                         pool));
-  
+
   /* Create the revprops directory. */
   if (format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
     {
@@ -6605,7 +6615,7 @@ recover_find_max_ids(svn_fs_t *fs, svn_r
       svn_fs_id_t *id;
       const char *node_id, *copy_id;
       apr_off_t child_dir_offset;
-      const svn_string_t *path = svn_apr_hash_index_val(hi);
+      const svn_string_t *path = svn__apr_hash_index_val(hi);
 
       svn_pool_clear(iterpool);
 
@@ -7032,8 +7042,8 @@ svn_fs_fs__list_transactions(apr_array_h
   /* Loop through all the entries and return anything that ends with '.txn'. */
   for (hi = apr_hash_first(pool, dirents); hi; hi = apr_hash_next(hi))
     {
-      const char *name = svn_apr_hash_index_key(hi);
-      apr_ssize_t klen = svn_apr_hash_index_klen(hi);
+      const char *name = svn__apr_hash_index_key(hi);
+      apr_ssize_t klen = svn__apr_hash_index_klen(hi);
       const char *id;
 
       /* The name must end with ".txn" to be considered a transaction. */
@@ -7423,20 +7433,20 @@ pack_revprop_shard(svn_fs_t *fs,
   svn_sqlite__stmt_t *stmt;
   svn_stream_t *tmp_stream;
   apr_pool_t *iterpool;
-  
+
   shard_path = svn_dirent_join(revprops_dir,
                                apr_psprintf(pool, "%" APR_INT64_T_FMT, shard),
                                pool);
-  
+
   /* Notify caller we're starting to pack this shard. */
   if (notify_func)
     SVN_ERR(notify_func(notify_baton, shard, svn_fs_pack_notify_start,
                         pool));
-  
+
   start_rev = (svn_revnum_t) (shard * max_files_per_dir);
   end_rev = (svn_revnum_t) ((shard + 1) * (max_files_per_dir) - 1);
   iterpool = svn_pool_create(pool);
-  
+
   /* Iterate over the revisions in this shard, squashing them together. */
   SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->revprop_db, STMT_SET_REVPROP));
   for (rev = start_rev; rev <= end_rev; rev++)
@@ -7449,7 +7459,7 @@ pack_revprop_shard(svn_fs_t *fs,
       SVN_ERR(svn_sqlite__bind_properties(stmt, 2, proplist, pool));
       SVN_ERR(svn_sqlite__insert(NULL, stmt));
     }
-  
+
   /* Update the min-unpacked-rev file to reflect our newly packed shard.
    * (ffd->min_unpacked_rev will be updated by open_pack_or_rev_file().)
    */
@@ -7461,16 +7471,16 @@ pack_revprop_shard(svn_fs_t *fs,
   SVN_ERR(svn_stream_close(tmp_stream));
   SVN_ERR(move_into_place(tmp_path, final_path, final_path, iterpool));
   svn_pool_destroy(iterpool);
-  
+
   /* Finally, remove the existing shard directory. */
   SVN_ERR(svn_io_remove_dir2(shard_path, TRUE, cancel_func, cancel_baton,
                              pool));
-  
+
   /* Notify caller we're starting to pack this shard. */
   if (notify_func)
     SVN_ERR(notify_func(notify_baton, shard, svn_fs_pack_notify_end,
                         pool));
-  
+
   return SVN_NO_ERROR;
 }
 
@@ -7533,7 +7543,7 @@ pack_body(void *baton,
   completed_shards = (youngest + 1) / max_files_per_dir;
 
   /* See if we've already completed all possible shards thus far. */
-  if (min_unpacked_rev == (completed_shards * max_files_per_dir) && 
+  if (min_unpacked_rev == (completed_shards * max_files_per_dir) &&
       min_unpacked_revprop == (completed_shards * max_files_per_dir))
     return SVN_NO_ERROR;
 

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.h?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.h Tue Mar 30 20:57:53 2010
@@ -207,7 +207,7 @@ svn_error_t *svn_fs_fs__change_txn_prop(
 /* Change transaction properties in transaction TXN based on PROPS.
    Perform temporary allocations from POOL. */
 svn_error_t *svn_fs_fs__change_txn_props(svn_fs_txn_t *txn,
-                                         apr_array_header_t *props,
+                                         const apr_array_header_t *props,
                                          apr_pool_t *pool);
 
 /* Return whether or not the given FS supports mergeinfo metadata. */

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/lock.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/lock.c Tue Mar 30 20:57:53 2010
@@ -190,8 +190,8 @@ write_digest_file(apr_hash_t *children,
       for (hi = apr_hash_first(pool, children); hi; hi = apr_hash_next(hi))
         {
           svn_stringbuf_appendbytes(children_list,
-                                    svn_apr_hash_index_key(hi),
-                                    svn_apr_hash_index_klen(hi));
+                                    svn__apr_hash_index_key(hi),
+                                    svn__apr_hash_index_klen(hi));
           svn_stringbuf_appendbytes(children_list, "\n", 1);
         }
       hash_store(hash, CHILDREN_KEY, sizeof(CHILDREN_KEY)-1,
@@ -559,7 +559,7 @@ walk_digest_files(svn_fs_t *fs,
   subpool = svn_pool_create(pool);
   for (hi = apr_hash_first(pool, children); hi; hi = apr_hash_next(hi))
     {
-      const char *digest = svn_apr_hash_index_key(hi);
+      const char *digest = svn__apr_hash_index_key(hi);
       svn_pool_clear(subpool);
       SVN_ERR(walk_digest_files
               (fs, digest_path_from_digest(fs, digest, subpool),

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/tree.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/tree.c Tue Mar 30 20:57:53 2010
@@ -1380,9 +1380,9 @@ merge(svn_stringbuf_t *conflict_p,
 
       svn_pool_clear(iterpool);
 
-      name = svn_apr_hash_index_key(hi);
-      klen = svn_apr_hash_index_klen(hi);
-      a_entry = svn_apr_hash_index_val(hi);
+      name = svn__apr_hash_index_key(hi);
+      klen = svn__apr_hash_index_klen(hi);
+      a_entry = svn__apr_hash_index_val(hi);
 
       s_entry = apr_hash_get(s_entries, name, klen);
       t_entry = apr_hash_get(t_entries, name, klen);
@@ -1510,13 +1510,13 @@ merge(svn_stringbuf_t *conflict_p,
        hi = apr_hash_next(hi))
     {
       svn_fs_dirent_t *s_entry, *t_entry;
-      const char *name = svn_apr_hash_index_key(hi);
-      apr_ssize_t klen = svn_apr_hash_index_klen(hi);
+      const char *name = svn__apr_hash_index_key(hi);
+      apr_ssize_t klen = svn__apr_hash_index_klen(hi);
       dag_node_t *s_ent_node;
 
       svn_pool_clear(iterpool);
 
-      s_entry = svn_apr_hash_index_val(hi);
+      s_entry = svn__apr_hash_index_val(hi);
       t_entry = apr_hash_get(t_entries, name, klen);
 
       /* If NAME exists in TARGET, declare a conflict. */
@@ -2188,7 +2188,7 @@ fs_copied_from(svn_revnum_t *rev_p,
           /* Parse the copyfrom string for our cached entry. */
           buf = apr_pstrdup(pool, copyfrom_str);
           str = apr_strtok(buf, " ", &last_str);
-          copyfrom_rev = atol(str);
+          copyfrom_rev = SVN_STR_TO_REV(str);
           copyfrom_path = last_str;
         }
     }
@@ -3410,7 +3410,7 @@ crawl_directory_dag_for_mergeinfo(svn_fs
        hi;
        hi = apr_hash_next(hi))
     {
-      svn_fs_dirent_t *dirent = svn_apr_hash_index_val(hi);
+      svn_fs_dirent_t *dirent = svn__apr_hash_index_val(hi);
       const char *kid_path;
       dag_node_t *kid_dag;
       svn_boolean_t has_mergeinfo, go_down;
@@ -3482,8 +3482,8 @@ append_to_merged_froms(svn_mergeinfo_t *
 
   for (hi = apr_hash_first(pool, input); hi; hi = apr_hash_next(hi))
     {
-      const char *path = svn_apr_hash_index_key(hi);
-      apr_array_header_t *rangelist = svn_apr_hash_index_val(hi);
+      const char *path = svn__apr_hash_index_key(hi);
+      apr_array_header_t *rangelist = svn__apr_hash_index_val(hi);
       char *newpath;
 
       newpath = svn_uri_join(path, path_piece, pool);

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_ra/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_ra/compat.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_ra/compat.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_ra/compat.c Tue Mar 30 20:57:53 2010
@@ -284,7 +284,7 @@ svn_ra__locations_from_log(svn_ra_sessio
                            apr_hash_t **locations_p,
                            const char *path,
                            svn_revnum_t peg_revision,
-                           apr_array_header_t *location_revisions,
+                           const apr_array_header_t *location_revisions,
                            apr_pool_t *pool)
 {
   apr_hash_t *locations = apr_hash_make(pool);

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_ra/ra_loader.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_ra/ra_loader.c Tue Mar 30 20:57:53 2010
@@ -880,7 +880,7 @@ svn_error_t *svn_ra_get_locations(svn_ra
                                   apr_hash_t **locations,
                                   const char *path,
                                   svn_revnum_t peg_revision,
-                                  apr_array_header_t *location_revisions,
+                                  const apr_array_header_t *location_revisions,
                                   apr_pool_t *pool)
 {
   svn_error_t *err;
@@ -971,7 +971,7 @@ svn_error_t *svn_ra_lock(svn_ra_session_
 
   for (hi = apr_hash_first(pool, path_revs); hi; hi = apr_hash_next(hi))
     {
-      const char *path = svn_apr_hash_index_key(hi);
+      const char *path = svn__apr_hash_index_key(hi);
 
       SVN_ERR_ASSERT(*path != '/');
     }
@@ -996,7 +996,7 @@ svn_error_t *svn_ra_unlock(svn_ra_sessio
 
   for (hi = apr_hash_first(pool, path_tokens); hi; hi = apr_hash_next(hi))
     {
-      const char *path = svn_apr_hash_index_key(hi);
+      const char *path = svn__apr_hash_index_key(hi);
 
       SVN_ERR_ASSERT(*path != '/');
     }

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_ra/ra_loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_ra/ra_loader.h?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_ra/ra_loader.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_ra/ra_loader.h Tue Mar 30 20:57:53 2010
@@ -192,7 +192,7 @@ typedef struct svn_ra__vtable_t {
                                 apr_hash_t **locations,
                                 const char *path,
                                 svn_revnum_t peg_revision,
-                                apr_array_header_t *location_revisions,
+                                const apr_array_header_t *location_revisions,
                                 apr_pool_t *pool);
   svn_error_t *(*get_location_segments)(svn_ra_session_t *session,
                                         const char *path,
@@ -330,7 +330,7 @@ svn_ra__locations_from_log(svn_ra_sessio
                            apr_hash_t **locations_p,
                            const char *path,
                            svn_revnum_t peg_revision,
-                           apr_array_header_t *location_revisions,
+                           const apr_array_header_t *location_revisions,
                            apr_pool_t *pool);
 
 /**

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_ra_local/ra_plugin.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_ra_local/ra_plugin.c Tue Mar 30 20:57:53 2010
@@ -1160,7 +1160,7 @@ svn_ra_local__get_locations(svn_ra_sessi
                             apr_hash_t **locations,
                             const char *path,
                             svn_revnum_t peg_revision,
-                            apr_array_header_t *location_revisions,
+                            const apr_array_header_t *location_revisions,
                             apr_pool_t *pool)
 {
   svn_ra_local__session_baton_t *sess = session->priv;



Mime
View raw message