Author: stsp
Date: Thu Nov 24 19:55:12 2011
New Revision: 1205967

URL: http://svn.apache.org/viewvc?rev=1205967&view=rev
Log:
Sync the moves-scan-log branch with trunk.

Modified:
    subversion/branches/moves-scan-log/   (props changed)
    subversion/branches/moves-scan-log/CHANGES
    subversion/branches/moves-scan-log/subversion/libsvn_client/merge.c
    
subversion/branches/moves-scan-log/subversion/libsvn_fs_base/bdb/locks-table.c
    subversion/branches/moves-scan-log/subversion/libsvn_fs_base/reps-strings.c
    subversion/branches/moves-scan-log/subversion/tests/libsvn_fs/locks-test.c

Propchange: subversion/branches/moves-scan-log/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 24 19:55:12 2011
@@ -57,4 +57,4 @@
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
 /subversion/branches/uris-as-urls:1060426-1064427
-/subversion/trunk:1186288-1205354
+/subversion/trunk:1186288-1205966

Modified: subversion/branches/moves-scan-log/CHANGES
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/CHANGES?rev=1205967&r1=1205966&r2=1205967&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/CHANGES (original)
+++ subversion/branches/moves-scan-log/CHANGES Thu Nov 24 19:55:12 2011
@@ -38,17 +38,17 @@ Version 1.7.2
 http://svn.apache.org/repos/asf/subversion/tags/1.7.2
 
   User-visible changes:
-   * fix working copy corruption (issue #4040)
+   * fix working copy corruption after interrupted update/switch (issue #4040)
    * avoid segfaults against pre-1.5 servers (r1186928)
-   * avoid configure error when using apr-util and bdb (r1186784)
-   * make 'svn patch' ignore '/dev/null' targets (r1197998)
-   * fix segfault on path that skips and deletes (r1199950)
-   * omit output from 'commit --quiet' (r1200837)
-   * fix authz denial when svnserve root is a repo (issue #4060)
+   * improve configure error message if apr-util uses old or no bdb (r1186784)
+   * make 'svn patch' ignore '/dev/null' targets for compat with git (r1197998)
+   * fix 'svn patch' segfault on patch that skips and deletes files (r1199950)
+   * omit "Committed revision N." output from 'svn commit --quiet' (r1200837)
+   * fix authz denial when svnserve root is a repository (issue #4060)
    * fix uninitialized memory read in client diff code (r1201002)
    * avoid potential segfault during merges (r1202807)
    * fix an assertion failure when a symlink is updated (r1186944, -81, -83)
-   * more working copy corruption protection (r1202603)
+   * make working copy operations fail if nodes have no base checksum 
(r1202630)
    * fix nested <Location>s when using v2 protocol (r1203546, -651, -653)
    * make mod_dav_svn ignore non-Subversion POST requests (r1187695)
    * avoid reading freed memory (r1204478)

Modified: subversion/branches/moves-scan-log/subversion/libsvn_client/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/libsvn_client/merge.c?rev=1205967&r1=1205966&r2=1205967&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/subversion/libsvn_client/merge.c 
(original)
+++ subversion/branches/moves-scan-log/subversion/libsvn_client/merge.c Thu Nov 
24 19:55:12 2011
@@ -1254,6 +1254,8 @@ merge_props_changed(svn_wc_notify_state_
       else if (err)
         return svn_error_trace(err);
     }
+  else if (state)
+    *state = svn_wc_notify_state_unchanged;
 
   return SVN_NO_ERROR;
 }
@@ -2640,9 +2642,6 @@ typedef struct notification_receiver_bat
   svn_wc_notify_func2_t wrapped_func;
   void *wrapped_baton;
 
-  /* The number of notifications received. */
-  apr_uint32_t nbr_notifications;
-
   /* The number of operative notifications received. */
   apr_uint32_t nbr_operative_notifications;
 
@@ -2725,6 +2724,7 @@ find_nearest_ancestor(const apr_array_he
 }
 
 
+/* Is the notification the result of a real operative merge? */
 #define IS_OPERATIVE_NOTIFICATION(notify)  \
                     (notify->content_state == svn_wc_notify_state_conflicted \
                      || notify->content_state == svn_wc_notify_state_merged  \
@@ -2741,7 +2741,7 @@ notification_receiver(void *baton, const
                       apr_pool_t *pool)
 {
   notification_receiver_baton_t *notify_b = baton;
-  svn_boolean_t is_operative_notification = FALSE;
+  svn_boolean_t is_operative_notification = IS_OPERATIVE_NOTIFICATION(notify);
   const char *notify_abspath;
 
   /* Skip notifications if this is a --record-only merge that is adding
@@ -2753,11 +2753,9 @@ notification_receiver(void *baton, const
           && notify->action != svn_wc_notify_merge_record_info_begin))
     return;
 
-  /* Is the notification the result of a real operative merge? */
-  if (IS_OPERATIVE_NOTIFICATION(notify))
+  if (is_operative_notification)
     {
       notify_b->nbr_operative_notifications++;
-      is_operative_notification = TRUE;
     }
 
   /* If the node was moved-away, use its new path in the notification. */
@@ -2794,6 +2792,7 @@ notification_receiver(void *baton, const
         notify_abspath = moved_to_abspath;
     }
 
+  /* Update the lists of merged, skipped, tree-conflicted and added paths. */
   if (notify_b->merge_b->sources_ancestral
       || notify_b->merge_b->reintegrate_merge)
     {
@@ -2855,6 +2854,9 @@ notification_receiver(void *baton, const
           else
             {
               added_path_parent = svn_dirent_dirname(added_path, pool);
+              /* ### Bug. Testing whether its immediate parent is in the
+               * hash isn't enough: this is letting every other level of
+               * the added subtree hierarchy into the hash. */
               if (!apr_hash_get(notify_b->added_abspaths, added_path_parent,
                                 APR_HASH_KEY_STRING))
                 is_root_of_added_subtree = TRUE;
@@ -2865,11 +2867,11 @@ notification_receiver(void *baton, const
         }
     }
 
+  /* Notify that a merge is beginning, if we haven't already done so.
+   * (A single-file merge is notified separately: see 
single_file_merge_notify().) */
   /* If our merge sources are ancestors of one another... */
   if (notify_b->merge_b->sources_ancestral)
     {
-      notify_b->nbr_notifications++;
-
       /* See if this is an operative directory merge. */
       if (!(notify_b->is_single_file_merge) && is_operative_notification)
         {
@@ -2903,6 +2905,8 @@ notification_receiver(void *baton, const
               notify_b->cur_ancestor_index = new_nearest_ancestor_index;
               if (!child->absent && child->remaining_ranges->nelts > 0
                   && !(new_nearest_ancestor_index == 0
+                       /* ### 'remaining_ranges == 0'? It was already assumed
+                        * non-null earlier in this expression. See r872890. */
                        && child->remaining_ranges == 0))
                 {
                   svn_wc_notify_t *notify_merge_begin;
@@ -4738,11 +4742,10 @@ record_skips(const char *mergeinfo_path,
                    apr_array_make(scratch_pool, 0,
                                   sizeof(svn_merge_range_t *)));
 
-      if (nbr_skips < notify_b->nbr_notifications)
-        /* ### Use RANGELIST as the mergeinfo for all children of
+      /* if (nbr_skips < notify_b->nbr_notifications)
+           ### Use RANGELIST as the mergeinfo for all children of
            ### this path which were not also explicitly
            ### skipped? */
-        ;
     }
   SVN_ERR(update_wc_mergeinfo(NULL, merge_b->target_abspath,
                               mergeinfo_path, merges,
@@ -5278,7 +5281,7 @@ single_file_merge_get_file(const char **
    send the header notification before sending the state notification,
    and set *HEADER_SENT to TRUE. */
 static APR_INLINE void
-single_file_merge_notify(void *notify_baton,
+single_file_merge_notify(notification_receiver_baton_t *notify_baton,
                          const char *local_abspath,
                          svn_wc_notify_action_t action,
                          svn_wc_notify_state_t text_state,
@@ -7173,22 +7176,21 @@ process_children_with_new_mergeinfo(merg
   return SVN_NO_ERROR;
 }
 
-/* SUBTREES is one of the following notification_receiver_baton_t members:
-   merged_paths, skipped_paths, or added_paths.  Return true if any path in
-   SUBTRESS is equal to, or is a subtree of, LOCAL_ABSPATH.  Return false
-   otherwise.  If LOCAL_ABSPATH or SUBTREES are NULL return false. */
+/* Return true if any path in SUBTRESS is equal to, or is a subtree of,
+   LOCAL_ABSPATH.  Return false otherwise.  The keys of SUBTREES are
+   (const char *) absolute paths and its values are irrelevant.
+   If SUBTREES is NULL return false. */
 static svn_boolean_t
 path_is_subtree(const char *local_abspath,
                 apr_hash_t *subtrees,
                 apr_pool_t *pool)
 {
-  if (local_abspath && subtrees)
+  if (subtrees)
     {
       apr_hash_index_t *hi;
 
       for (hi = apr_hash_first(pool, subtrees);
-           hi;
-           hi = apr_hash_next(hi))
+           hi; hi = apr_hash_next(hi))
         {
           const char *path_touched_by_merge = svn__apr_hash_index_key(hi);
           if (svn_dirent_is_ancestor(local_abspath, path_touched_by_merge))
@@ -8310,6 +8312,9 @@ do_directory_merge(svn_mergeinfo_catalog
   honor_mergeinfo = HONOR_MERGEINFO(merge_b);
   record_mergeinfo = RECORD_MERGEINFO(merge_b);
 
+  /* Note that this is not a single-file merge. */
+  notify_b->is_single_file_merge = FALSE;
+
   /* Initialize NOTIFY_B->CHILDREN_WITH_MERGEINFO. See the comment
      'THE CHILDREN_WITH_MERGEINFO ARRAY' at the start of this file. */
   notify_b->children_with_mergeinfo =
@@ -8674,8 +8679,9 @@ ensure_ra_session_url(svn_ra_session_t *
    RECORD_MERGEINFO().
 
    If MODIFIED_SUBTREES is not NULL and SOURCES_ANCESTRAL or
-   REINTEGRATE_MERGE is true, then set *MODIFIED_SUBTREES to a hash
-   containing every path modified, skipped, added, or tree-conflicted
+   REINTEGRATE_MERGE is true, then replace *MODIFIED_SUBTREES with a new
+   hash containing all the paths that *MODIFIED_SUBTREES contained before,
+   and also every path modified, skipped, added, or tree-conflicted
    by the merge.  Keys and values of the hash are both (const char *)
    absolute paths.  The contents of the hash are allocated in RESULT_POOL.
 
@@ -8827,7 +8833,6 @@ do_merge(apr_hash_t **modified_subtrees,
   /* Build the notification receiver baton. */
   notify_baton.wrapped_func = ctx->notify_func2;
   notify_baton.wrapped_baton = ctx->notify_baton2;
-  notify_baton.nbr_notifications = 0;
   notify_baton.nbr_operative_notifications = 0;
 
   /* Do we already know the specific subtrees with mergeinfo we want
@@ -8840,7 +8845,6 @@ do_merge(apr_hash_t **modified_subtrees,
   notify_baton.skipped_abspaths = NULL;
   notify_baton.added_abspaths = NULL;
   notify_baton.tree_conflicted_abspaths = NULL;
-  notify_baton.is_single_file_merge = FALSE;
   notify_baton.children_with_mergeinfo = NULL;
   notify_baton.cur_ancestor_index = -1;
   notify_baton.merge_b = &merge_cmd_baton;
@@ -8923,6 +8927,7 @@ do_merge(apr_hash_t **modified_subtrees,
                                      iterpool));
 
           /* Does the caller want to know what the merge has done? */
+          /* ### Why only if the target is a dir and not a file? */
           if (modified_subtrees)
             {
               if (notify_baton.merged_abspaths)

Modified: 
subversion/branches/moves-scan-log/subversion/libsvn_fs_base/bdb/locks-table.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/libsvn_fs_base/bdb/locks-table.c?rev=1205967&r1=1205966&r2=1205967&view=diff
==============================================================================
--- 
subversion/branches/moves-scan-log/subversion/libsvn_fs_base/bdb/locks-table.c 
(original)
+++ 
subversion/branches/moves-scan-log/subversion/libsvn_fs_base/bdb/locks-table.c 
Thu Nov 24 19:55:12 2011
@@ -207,6 +207,7 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
   svn_lock_t *lock;
   svn_error_t *err;
   const char *lookup_path = path;
+  apr_size_t lookup_len;
 
   /* First, try to lookup PATH itself. */
   err = svn_fs_bdb__lock_token_get(&lock_token, fs, path, trail, pool);
@@ -224,7 +225,12 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
     {
       SVN_ERR(get_lock(&lock, fs, path, lock_token, trail, pool));
       if (lock && get_locks_func)
-        SVN_ERR(get_locks_func(get_locks_baton, lock, pool));
+        {
+          SVN_ERR(get_locks_func(get_locks_baton, lock, pool));
+
+          /* Found a lock so PATH is a file and we can ignore depth */
+          return SVN_NO_ERROR;
+        }
     }
 
   /* If we're only looking at PATH itself (depth = empty), stop here. */
@@ -250,11 +256,13 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
 
   if (!svn_fspath__is_root(path, strlen(path)))
     lookup_path = apr_pstrcat(pool, path, "/", (char *)NULL);
+  lookup_len = strlen(lookup_path);
 
   /* As long as the prefix of the returned KEY matches LOOKUP_PATH we
      know it is either LOOKUP_PATH or a decendant thereof.  */
   while ((! db_err)
-         && strncmp(lookup_path, key.data, strlen(lookup_path)) == 0)
+         && lookup_len < key.size
+         && strncmp(lookup_path, key.data, lookup_len) == 0)
     {
       const char *child_path;
 

Modified: 
subversion/branches/moves-scan-log/subversion/libsvn_fs_base/reps-strings.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/libsvn_fs_base/reps-strings.c?rev=1205967&r1=1205966&r2=1205967&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/subversion/libsvn_fs_base/reps-strings.c 
(original)
+++ subversion/branches/moves-scan-log/subversion/libsvn_fs_base/reps-strings.c 
Thu Nov 24 19:55:12 2011
@@ -674,8 +674,10 @@ struct rep_read_baton
      is digestified. */
   svn_boolean_t checksum_finalized;
 
-  /* Used for temporary allocations, iff `trail' (above) is null.  */
-  apr_pool_t *pool;
+  /* Used for temporary allocations.  This pool is cleared at the
+     start of each invocation of the relevant stream read function --
+     see rep_read_contents().  */
+  apr_pool_t *scratch_pool;
 
 };
 
@@ -703,7 +705,7 @@ rep_read_get_baton(struct rep_read_baton
   b->checksum_finalized = FALSE;
   b->fs = fs;
   b->trail = use_trail_for_reads ? trail : NULL;
-  b->pool = pool;
+  b->scratch_pool = svn_pool_create(pool);
   b->rep_key = rep_key;
   b->offset = 0;
 
@@ -869,7 +871,7 @@ txn_body_read_rep(void *baton, trail_t *
                              args->buf,
                              args->len,
                              trail,
-                             trail->pool));
+                             args->rb->scratch_pool));
 
       args->rb->offset += *(args->len);
 
@@ -956,6 +958,9 @@ rep_read_contents(void *baton, char *buf
   struct rep_read_baton *rb = baton;
   struct read_rep_args args;
 
+  /* Clear the scratch pool of the results of previous invocations. */
+  svn_pool_clear(rb->scratch_pool);
+
   args.rb = rb;
   args.buf = buf;
   args.len = len;
@@ -974,7 +979,7 @@ rep_read_contents(void *baton, char *buf
                                      txn_body_read_rep,
                                      &args,
                                      TRUE,
-                                     rb->pool));
+                                     rb->scratch_pool));
     }
   return SVN_NO_ERROR;
 }

Modified: 
subversion/branches/moves-scan-log/subversion/tests/libsvn_fs/locks-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/tests/libsvn_fs/locks-test.c?rev=1205967&r1=1205966&r2=1205967&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/subversion/tests/libsvn_fs/locks-test.c 
(original)
+++ subversion/branches/moves-scan-log/subversion/tests/libsvn_fs/locks-test.c 
Thu Nov 24 19:55:12 2011
@@ -358,6 +358,18 @@ get_locks(const svn_test_opts_t *opts,
                                        num_expected_paths, pool));
   }
 
+  /* A path that is longer and alphabetically earlier than some locked
+     paths, this exercises the r1205848 BDB lock code. */
+  {
+    static const char *expected_paths[] = { 0 };
+    num_expected_paths = 0;
+    get_locks_baton = make_get_locks_baton(pool);
+    SVN_ERR(svn_fs_get_locks(fs, "A/D/H/ABCDEFGHIJKLMNOPQR", 
get_locks_callback,
+                             get_locks_baton, pool));
+    SVN_ERR(verify_matching_lock_paths(get_locks_baton, expected_paths,
+                                       num_expected_paths, pool));
+  }
+
   return SVN_NO_ERROR;
 }
 


Reply via email to