You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/03/30 15:55:31 UTC

svn commit: r1307424 [6/11] - in /subversion/branches/revprop-packing: ./ build/ac-macros/ notes/ notes/directory-index/ notes/wc-ng/ subversion/bindings/javahl/ subversion/bindings/swig/python/svn/ subversion/bindings/swig/python/tests/ subversion/bin...

Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/adm_crawler.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_wc/adm_crawler.c Fri Mar 30 13:55:26 2012
@@ -494,10 +494,14 @@ report_revisions_and_depths(svn_wc__db_t
         {
           svn_boolean_t is_incomplete;
           svn_boolean_t start_empty;
+          svn_depth_t report_depth = ths->depth;
 
           is_incomplete = (ths->status == svn_wc__db_status_incomplete);
           start_empty = is_incomplete;
 
+          if (!SVN_DEPTH_IS_RECURSIVE(depth))
+            report_depth = svn_depth_empty;
+
           /* When a <= 1.6 working copy is upgraded without some of its
              subdirectories we miss some information in the database. If we
              report the revision as -1, the update editor will receive an
@@ -525,7 +529,7 @@ report_revisions_and_depths(svn_wc__db_t
                                                 dir_repos_root,
                                                 ths->repos_relpath, iterpool),
                                             ths->revnum,
-                                            ths->depth,
+                                            report_depth,
                                             start_empty,
                                             ths->lock ? ths->lock->token
                                                       : NULL,
@@ -534,7 +538,7 @@ report_revisions_and_depths(svn_wc__db_t
                 SVN_ERR(reporter->set_path(report_baton,
                                            this_report_relpath,
                                            ths->revnum,
-                                           ths->depth,
+                                           report_depth,
                                            start_empty,
                                            ths->lock ? ths->lock->token : NULL,
                                            iterpool));
@@ -548,7 +552,7 @@ report_revisions_and_depths(svn_wc__db_t
                                               dir_repos_root,
                                               ths->repos_relpath, iterpool),
                                           ths->revnum,
-                                          ths->depth,
+                                          report_depth,
                                           start_empty,
                                           ths->lock ? ths->lock->token : NULL,
                                           iterpool));
@@ -572,7 +576,7 @@ report_revisions_and_depths(svn_wc__db_t
               SVN_ERR(reporter->set_path(report_baton,
                                          this_report_relpath,
                                          ths->revnum,
-                                         ths->depth,
+                                         report_depth,
                                          start_empty,
                                          ths->lock ? ths->lock->token : NULL,
                                          iterpool));

Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/props.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_wc/props.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_wc/props.c Fri Mar 30 13:55:26 2012
@@ -788,7 +788,7 @@ set_prop_merge_state(svn_wc_notify_state
  * 'choose_postpone', then set *CONFLICT_REMAINS to TRUE and return.
  *
  * If the callback responds with a choice of 'base', 'theirs', 'mine',
- * or 'merged', then install the proper value into WORKING_PROPS and
+ * or 'merged', then install the proper value into ACTUAL_PROPS and
  * set *CONFLICT_REMAINS to FALSE.
  */
 static svn_error_t *
@@ -799,7 +799,7 @@ maybe_generate_propconflict(svn_boolean_
                             const svn_wc_conflict_version_t *right_version,
                             svn_boolean_t is_dir,
                             const char *propname,
-                            apr_hash_t *working_props,
+                            apr_hash_t *actual_props,
                             const svn_string_t *incoming_old_val,
                             const svn_string_t *incoming_new_val,
                             const svn_string_t *base_val,
@@ -936,7 +936,7 @@ maybe_generate_propconflict(svn_boolean_
     }
 
   /* Build the rest of the description object: */
-  cdesc->mime_type = (is_dir ? NULL : svn_prop_get_value(working_props,
+  cdesc->mime_type = (is_dir ? NULL : svn_prop_get_value(actual_props,
                                                          SVN_PROP_MIME_TYPE));
   cdesc->is_binary = (cdesc->mime_type
                       && svn_mime_type_is_binary(cdesc->mime_type));
@@ -978,7 +978,7 @@ maybe_generate_propconflict(svn_boolean_
         }
       case svn_wc_conflict_choose_mine_full:
         {
-          /* No need to change working_props; it already contains working_val */
+          /* No need to change actual_props; it already contains working_val */
           *conflict_remains = FALSE;
           break;
         }
@@ -989,14 +989,14 @@ maybe_generate_propconflict(svn_boolean_
          then choose _mine side or _theirs side for conflicting ones. */
       case svn_wc_conflict_choose_theirs_full:
         {
-          apr_hash_set(working_props, propname, APR_HASH_KEY_STRING,
+          apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING,
                        incoming_new_val);
           *conflict_remains = FALSE;
           break;
         }
       case svn_wc_conflict_choose_base:
         {
-          apr_hash_set(working_props, propname, APR_HASH_KEY_STRING, base_val);
+          apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, base_val);
           *conflict_remains = FALSE;
           break;
         }
@@ -1018,7 +1018,7 @@ maybe_generate_propconflict(svn_boolean_
                                                     cdesc->merged_file,
                                                scratch_pool));
               merged_string = svn_stringbuf__morph_into_string(merged_stringbuf);
-              apr_hash_set(working_props, propname,
+              apr_hash_set(actual_props, propname,
                            APR_HASH_KEY_STRING, merged_string);
               *conflict_remains = FALSE;
             }
@@ -1033,7 +1033,7 @@ maybe_generate_propconflict(svn_boolean_
 }
 
 
-/* Add the property with name PROPNAME to the set of WORKING_PROPS on
+/* Add the property with name PROPNAME to the set of ACTUAL_PROPS on
  * PATH, setting *STATE or *CONFLICT_REMAINS according to merge outcomes.
  *
  * *STATE is an input and output parameter, its value is to be
@@ -1055,7 +1055,7 @@ apply_single_prop_add(svn_wc_notify_stat
                       const svn_wc_conflict_version_t *left_version,
                       const svn_wc_conflict_version_t *right_version,
                       svn_boolean_t is_dir,
-                      apr_hash_t *working_props,
+                      apr_hash_t *actual_props,
                       const char *propname,
                       const svn_string_t *base_val,
                       const svn_string_t *new_val,
@@ -1067,13 +1067,13 @@ apply_single_prop_add(svn_wc_notify_stat
 
 {
   svn_string_t *working_val
-    = apr_hash_get(working_props, propname, APR_HASH_KEY_STRING);
+    = apr_hash_get(actual_props, propname, APR_HASH_KEY_STRING);
 
   *conflict_remains = FALSE;
 
   if (working_val)
     {
-      /* the property already exists in working_props... */
+      /* the property already exists in actual_props... */
 
       if (svn_string_compare(working_val, new_val))
         /* The value we want is already there, so it's a merge. */
@@ -1107,7 +1107,7 @@ apply_single_prop_add(svn_wc_notify_stat
               else
                 {
                   merged_prop = TRUE;
-                  apr_hash_set(working_props, propname,
+                  apr_hash_set(actual_props, propname,
                                APR_HASH_KEY_STRING, merged_val);
                   set_prop_merge_state(state, svn_wc_notify_state_merged);
                 }
@@ -1119,7 +1119,7 @@ apply_single_prop_add(svn_wc_notify_stat
                                                   db, local_abspath,
                                                   left_version, right_version,
                                                   is_dir,
-                                                  propname, working_props,
+                                                  propname, actual_props,
                                                   NULL, new_val,
                                                   base_val, working_val,
                                                   conflict_func,
@@ -1134,21 +1134,21 @@ apply_single_prop_add(svn_wc_notify_stat
                                           db, local_abspath,
                                           left_version, right_version,
                                           is_dir, propname,
-                                          working_props, NULL, new_val,
+                                          actual_props, NULL, new_val,
                                           base_val, NULL,
                                           conflict_func, conflict_baton,
                                           dry_run, scratch_pool));
     }
-  else  /* property doesn't yet exist in working_props...  */
+  else  /* property doesn't yet exist in actual_props...  */
     /* so just set it */
-    apr_hash_set(working_props, propname, APR_HASH_KEY_STRING, new_val);
+    apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, new_val);
 
   return SVN_NO_ERROR;
 }
 
 
 /* Delete the property with name PROPNAME from the set of
- * WORKING_PROPS on PATH, setting *STATE or *CONFLICT_REMAINS according to
+ * ACTUAL_PROPS on PATH, setting *STATE or *CONFLICT_REMAINS according to
  * merge outcomes.
  *
  * *STATE is an input and output parameter, its value is to be
@@ -1171,7 +1171,7 @@ apply_single_prop_delete(svn_wc_notify_s
                          const svn_wc_conflict_version_t *left_version,
                          const svn_wc_conflict_version_t *right_version,
                          svn_boolean_t is_dir,
-                         apr_hash_t *working_props,
+                         apr_hash_t *actual_props,
                          const char *propname,
                          const svn_string_t *base_val,
                          const svn_string_t *old_val,
@@ -1182,7 +1182,7 @@ apply_single_prop_delete(svn_wc_notify_s
                          apr_pool_t *scratch_pool)
 {
   svn_string_t *working_val
-    = apr_hash_get(working_props, propname, APR_HASH_KEY_STRING);
+    = apr_hash_get(actual_props, propname, APR_HASH_KEY_STRING);
 
   *conflict_remains = FALSE;
 
@@ -1196,14 +1196,14 @@ apply_single_prop_delete(svn_wc_notify_s
                                               db, local_abspath,
                                               left_version, right_version,
                                               is_dir, propname,
-                                              working_props, old_val, NULL,
+                                              actual_props, old_val, NULL,
                                               base_val, working_val,
                                               conflict_func, conflict_baton,
                                               dry_run, scratch_pool));
         }
       else
         {
-          apr_hash_set(working_props, propname, APR_HASH_KEY_STRING, NULL);
+          apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, NULL);
           if (old_val)
             /* This is a merge, merging a delete into non-existent
                property or a local addition of same prop value. */
@@ -1217,14 +1217,14 @@ apply_single_prop_delete(svn_wc_notify_s
          {
            if (svn_string_compare(working_val, old_val))
              /* they have the same values, so it's an update */
-             apr_hash_set(working_props, propname, APR_HASH_KEY_STRING, NULL);
+             apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, NULL);
            else
              {
                SVN_ERR(maybe_generate_propconflict(conflict_remains,
                                                    db, local_abspath,
                                                    left_version, right_version,
                                                    is_dir,
-                                                   propname, working_props,
+                                                   propname, actual_props,
                                                    old_val, NULL,
                                                    base_val, working_val,
                                                    conflict_func,
@@ -1244,7 +1244,7 @@ apply_single_prop_delete(svn_wc_notify_s
                                           db, local_abspath,
                                           left_version, right_version,
                                           is_dir, propname,
-                                          working_props, old_val, NULL,
+                                          actual_props, old_val, NULL,
                                           base_val, working_val,
                                           conflict_func, conflict_baton,
                                           dry_run, scratch_pool));
@@ -1269,7 +1269,7 @@ apply_single_mergeinfo_prop_change(svn_w
                                    const svn_wc_conflict_version_t *left_version,
                                    const svn_wc_conflict_version_t *right_version,
                                    svn_boolean_t is_dir,
-                                   apr_hash_t *working_props,
+                                   apr_hash_t *actual_props,
                                    const char *propname,
                                    const svn_string_t *base_val,
                                    const svn_string_t *old_val,
@@ -1281,7 +1281,7 @@ apply_single_mergeinfo_prop_change(svn_w
                                    apr_pool_t *scratch_pool)
 {
   svn_string_t *working_val
-    = apr_hash_get(working_props, propname, APR_HASH_KEY_STRING);
+    = apr_hash_get(actual_props, propname, APR_HASH_KEY_STRING);
 
   if ((working_val && ! base_val)
       || (! working_val && base_val)
@@ -1305,7 +1305,7 @@ apply_single_mergeinfo_prop_change(svn_w
                                                          new_val,
                                                          result_pool,
                                                          scratch_pool));
-                  apr_hash_set(working_props, propname,
+                  apr_hash_set(actual_props, propname,
                                APR_HASH_KEY_STRING, new_val);
                   set_prop_merge_state(state, svn_wc_notify_state_merged);
             }
@@ -1317,7 +1317,7 @@ apply_single_mergeinfo_prop_change(svn_w
           SVN_ERR(maybe_generate_propconflict(conflict_remains,
                                               db, local_abspath,
                                               left_version, right_version,
-                                              is_dir, propname, working_props,
+                                              is_dir, propname, actual_props,
                                               old_val, new_val,
                                               base_val, working_val,
                                               conflict_func, conflict_baton,
@@ -1339,14 +1339,14 @@ apply_single_mergeinfo_prop_change(svn_w
                                        old_val, new_val, scratch_pool));
           SVN_ERR(svn_mergeinfo_to_string(&mergeinfo_string,
                                           added_mergeinfo, result_pool));
-          apr_hash_set(working_props, propname, APR_HASH_KEY_STRING,
+          apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING,
                        mergeinfo_string);
     }
 
   else /* means working && base && svn_string_compare(working, base) */
     {
       if (svn_string_compare(old_val, base_val))
-        apr_hash_set(working_props, propname, APR_HASH_KEY_STRING, new_val);
+        apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, new_val);
 
       else
         {
@@ -1358,7 +1358,7 @@ apply_single_mergeinfo_prop_change(svn_w
                                                      working_val,
                                                      new_val, result_pool,
                                                      scratch_pool));
-              apr_hash_set(working_props, propname,
+              apr_hash_set(actual_props, propname,
                            APR_HASH_KEY_STRING, new_val);
               set_prop_merge_state(state, svn_wc_notify_state_merged);
         }
@@ -1381,7 +1381,7 @@ apply_single_generic_prop_change(svn_wc_
                                  const svn_wc_conflict_version_t *left_version,
                                  const svn_wc_conflict_version_t *right_version,
                                  svn_boolean_t is_dir,
-                                 apr_hash_t *working_props,
+                                 apr_hash_t *actual_props,
                                  const char *propname,
                                  const svn_string_t *base_val,
                                  const svn_string_t *old_val,
@@ -1393,7 +1393,7 @@ apply_single_generic_prop_change(svn_wc_
                                  apr_pool_t *scratch_pool)
 {
   svn_string_t *working_val
-    = apr_hash_get(working_props, propname, APR_HASH_KEY_STRING);
+    = apr_hash_get(actual_props, propname, APR_HASH_KEY_STRING);
 
   SVN_ERR_ASSERT(old_val != NULL);
 
@@ -1411,7 +1411,7 @@ apply_single_generic_prop_change(svn_wc_
       && svn_string_compare(working_val, old_val))
     {
       /* A trivial update: change it to new_val. */
-      apr_hash_set(working_props, propname, APR_HASH_KEY_STRING, new_val);
+      apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, new_val);
     }
   else
     {
@@ -1419,7 +1419,7 @@ apply_single_generic_prop_change(svn_wc_
       SVN_ERR(maybe_generate_propconflict(conflict_remains,
                                           db, local_abspath,
                                           left_version, right_version,
-                                          is_dir, propname, working_props,
+                                          is_dir, propname, actual_props,
                                           old_val, new_val,
                                           base_val, working_val,
                                           conflict_func, conflict_baton,
@@ -1429,7 +1429,7 @@ apply_single_generic_prop_change(svn_wc_
   return SVN_NO_ERROR;
 }
 
-/* Change the property with name PROPNAME in the set of WORKING_PROPS
+/* Change the property with name PROPNAME in the set of ACTUAL_PROPS
  * on PATH, setting *STATE or *CONFLICT_REMAINS according to the merge outcome.
  *
  * *STATE is an input and output parameter, its value is to be
@@ -1454,7 +1454,7 @@ apply_single_prop_change(svn_wc_notify_s
                          const svn_wc_conflict_version_t *left_version,
                          const svn_wc_conflict_version_t *right_version,
                          svn_boolean_t is_dir,
-                         apr_hash_t *working_props,
+                         apr_hash_t *actual_props,
                          const char *propname,
                          const svn_string_t *base_val,
                          const svn_string_t *old_val,
@@ -1490,7 +1490,7 @@ apply_single_prop_change(svn_wc_notify_s
                                                             left_version,
                                                             right_version,
                                                             is_dir,
-                                                            working_props,
+                                                            actual_props,
                                                             propname,
                                                             base_val,
                                                             old_val,
@@ -1522,7 +1522,7 @@ apply_single_prop_change(svn_wc_notify_s
                                                db, local_abspath,
                                                left_version, right_version,
                                                is_dir,
-                                               working_props,
+                                               actual_props,
                                                propname, base_val, old_val,
                                                new_val,
                                                conflict_func, conflict_baton,
@@ -1988,7 +1988,7 @@ svn_wc_prop_get2(const svn_string_t **va
                  apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool)
 {
-  enum svn_prop_kind kind = svn_property_kind(NULL, name);
+  enum svn_prop_kind kind = svn_property_kind2(name);
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
@@ -2014,7 +2014,7 @@ svn_wc__internal_propget(const svn_strin
                          apr_pool_t *scratch_pool)
 {
   apr_hash_t *prophash = NULL;
-  enum svn_prop_kind kind = svn_property_kind(NULL, name);
+  enum svn_prop_kind kind = svn_property_kind2(name);
   svn_boolean_t hidden;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -2429,7 +2429,7 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
                  void *notify_baton,
                  apr_pool_t *scratch_pool)
 {
-  enum svn_prop_kind prop_kind = svn_property_kind(NULL, name);
+  enum svn_prop_kind prop_kind = svn_property_kind2(name);
   svn_kind_t kind;
   const char *dir_abspath;
 
@@ -2609,7 +2609,7 @@ svn_wc_canonicalize_svn_prop(const svn_s
 svn_boolean_t
 svn_wc_is_normal_prop(const char *name)
 {
-  enum svn_prop_kind kind = svn_property_kind(NULL, name);
+  enum svn_prop_kind kind = svn_property_kind2(name);
   return (kind == svn_prop_regular_kind);
 }
 
@@ -2617,7 +2617,7 @@ svn_wc_is_normal_prop(const char *name)
 svn_boolean_t
 svn_wc_is_wc_prop(const char *name)
 {
-  enum svn_prop_kind kind = svn_property_kind(NULL, name);
+  enum svn_prop_kind kind = svn_property_kind2(name);
   return (kind == svn_prop_wc_kind);
 }
 
@@ -2625,7 +2625,7 @@ svn_wc_is_wc_prop(const char *name)
 svn_boolean_t
 svn_wc_is_entry_prop(const char *name)
 {
-  enum svn_prop_kind kind = svn_property_kind(NULL, name);
+  enum svn_prop_kind kind = svn_property_kind2(name);
   return (kind == svn_prop_entry_kind);
 }
 

Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/status.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_wc/status.c Fri Mar 30 13:55:26 2012
@@ -526,9 +526,17 @@ assemble_status(svn_wc_status3_t **statu
           if (!info->have_base)
             copied = TRUE;
           else
-            SVN_ERR(svn_wc__internal_node_get_schedule(NULL, &copied,
-                                                       db, local_abspath,
-                                                       scratch_pool));
+            {
+              const char *work_del_abspath;
+
+              /* Find out details of our deletion.  */
+              SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL,
+                                               &work_del_abspath, NULL,
+                                               db, local_abspath,
+                                               scratch_pool, scratch_pool));
+              if (work_del_abspath)
+                copied = TRUE; /* Working deletion */
+            }
         }
       else if (!dirent || dirent->kind != svn_node_dir)
         {
@@ -544,11 +552,17 @@ assemble_status(svn_wc_status3_t **statu
     {
       if (info->status == svn_wc__db_status_deleted)
         {
+          const char *work_del_abspath;
+
           node_status = svn_wc_status_deleted;
 
-          SVN_ERR(svn_wc__internal_node_get_schedule(NULL, &copied,
-                                                     db, local_abspath,
-                                                     scratch_pool));
+          /* Find out details of our deletion.  */
+          SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL,
+                                           &work_del_abspath, NULL,
+                                           db, local_abspath,
+                                           scratch_pool, scratch_pool));
+          if (work_del_abspath)
+            copied = TRUE; /* Working deletion */
         }
       else if (!dirent || dirent->kind != svn_node_file)
         {

Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/update_editor.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_wc/update_editor.c Fri Mar 30 13:55:26 2012
@@ -2541,7 +2541,7 @@ change_dir_prop(void *dir_baton,
   propchange->name = apr_pstrdup(db->pool, name);
   propchange->value = value ? svn_string_dup(value, db->pool) : NULL;
 
-  if (!db->edited && svn_property_kind(NULL, name) == svn_prop_regular_kind)
+  if (!db->edited && svn_property_kind2(name) == svn_prop_regular_kind)
     SVN_ERR(mark_directory_edited(db, pool));
 
   return SVN_NO_ERROR;
@@ -3724,7 +3724,7 @@ change_file_prop(void *file_baton,
   propchange->name = apr_pstrdup(fb->pool, name);
   propchange->value = value ? svn_string_dup(value, fb->pool) : NULL;
 
-  if (!fb->edited && svn_property_kind(NULL, name) == svn_prop_regular_kind)
+  if (!fb->edited && svn_property_kind2(name) == svn_prop_regular_kind)
     SVN_ERR(mark_file_edited(fb, scratch_pool));
 
   return SVN_NO_ERROR;
@@ -4470,8 +4470,8 @@ close_file(void *file_baton,
                                   NULL /* left_version */,
                                   NULL /* right_version */,
                                   NULL /* server_baseprops (not merging) */,
-                                  current_base_props /* base_props */,
-                                  fake_actual_props /* working_props */,
+                                  current_base_props /* pristine_props */,
+                                  fake_actual_props /* actual_props */,
                                   regular_prop_changes, /* propchanges */
                                   TRUE /* base_merge */,
                                   FALSE /* dry_run */,

Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/wc-metadata.sql
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/wc-metadata.sql?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_wc/wc-metadata.sql Fri Mar 30 13:55:26 2012
@@ -389,12 +389,13 @@ CREATE TABLE NODES (
   moved_here  INTEGER,
 
   /* If the underlying node was moved away (rather than just deleted), this
-     specifies the local_relpath of where the BASE node was moved to.
+     specifies the local_relpath of where the node was moved to.
      This is set only on the root of a move, and is NULL for all children.
 
-     Note that moved_to never refers to *this* node. It always refers
-     to the "underlying" node in the BASE tree. A non-NULL moved_to column
-     is only valid in rows where op_depth == 0. */
+     The op-depth of the moved-to node is not recorded. A moved_to path
+     always points at a node within the highest op-depth layer at the
+     destination. This invariant must be maintained by operations which
+     change existing move information. */
   moved_to  TEXT,
 
 

Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/wc-queries.sql?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_wc/wc-queries.sql Fri Mar 30 13:55:26 2012
@@ -51,8 +51,7 @@ ORDER BY op_depth DESC
 -- STMT_SELECT_BASE_NODE
 SELECT repos_id, repos_path, presence, kind, revision, checksum,
   translated_size, changed_revision, changed_date, changed_author, depth,
-  symlink_target, last_mod_time, properties, file_external IS NOT NULL,
-  moved_to
+  symlink_target, last_mod_time, properties, file_external IS NOT NULL
 FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
 
@@ -60,7 +59,6 @@ WHERE wc_id = ?1 AND local_relpath = ?2 
 SELECT nodes.repos_id, nodes.repos_path, presence, kind, revision,
   checksum, translated_size, changed_revision, changed_date, changed_author,
   depth, symlink_target, last_mod_time, properties, file_external IS NOT NULL,
-  moved_to,
   /* All the columns until now must match those returned by
      STMT_SELECT_BASE_NODE. The implementation of svn_wc__db_base_get_info()
      assumes that these columns are followed by the lock information) */
@@ -283,13 +281,18 @@ WHERE wc_id = ?1 AND local_relpath = ?2 
 SELECT dav_cache FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
 
+/* ### FIXME.  modes_move.moved_to IS NOT NULL works when there is
+ only one move but we need something else when there are several. */
 -- STMT_SELECT_DELETION_INFO
-SELECT nodes_base.presence, nodes_work.presence, nodes_base.moved_to,
+SELECT nodes_base.presence, nodes_work.presence, nodes_move.moved_to,
        nodes_work.op_depth
 FROM nodes AS nodes_work
+LEFT OUTER JOIN nodes nodes_move ON nodes_move.wc_id = nodes_work.wc_id
+  AND nodes_move.local_relpath = nodes_work.local_relpath
+  AND nodes_move.moved_to IS NOT NULL
 LEFT OUTER JOIN nodes nodes_base ON nodes_base.wc_id = nodes_work.wc_id
-  AND nodes_base.local_relpath = nodes_work.local_relpath
-  AND nodes_base.op_depth = 0
+ AND nodes_base.local_relpath = nodes_work.local_relpath
+ AND nodes_base.op_depth = 0
 WHERE nodes_work.wc_id = ?1 AND nodes_work.local_relpath = ?2
   AND nodes_work.op_depth = (SELECT MAX(op_depth) FROM nodes
                              WHERE wc_id = ?1 AND local_relpath = ?2
@@ -884,28 +887,32 @@ INSERT OR REPLACE INTO nodes (
     wc_id, local_relpath, op_depth, parent_relpath, repos_id,
     repos_path, revision, presence, depth, moved_here, kind, changed_revision,
     changed_date, changed_author, checksum, properties, translated_size,
-    last_mod_time, symlink_target )
-SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
-    repos_id, repos_path, revision, ?6 /*presence*/, depth, ?7/*moved_here*/,
-    kind, changed_revision, changed_date, changed_author, checksum, properties,
-    translated_size, last_mod_time, symlink_target
-FROM nodes
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
+    last_mod_time, symlink_target, moved_to )
+SELECT src.wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
+    src.repos_id, src.repos_path, src.revision, ?6 /*presence*/, src.depth,
+    ?7/*moved_here*/, src.kind, src.changed_revision, src.changed_date,
+    src.changed_author, src.checksum, src.properties, src.translated_size,
+    src.last_mod_time, src.symlink_target, dst.moved_to
+FROM nodes AS src
+LEFT OUTER JOIN nodes_current dst ON dst.wc_id = src.wc_id
+  AND dst.local_relpath = ?3 AND dst.op_depth = ?4
+WHERE src.wc_id = ?1 AND src.local_relpath = ?2 AND src.op_depth = 0
 
 -- STMT_INSERT_WORKING_NODE_COPY_FROM_WORKING
 INSERT OR REPLACE INTO nodes (
-    wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
-    revision, presence, depth, moved_here, kind, changed_revision, changed_date,
-    changed_author, checksum, properties, translated_size, last_mod_time,
-    symlink_target )
-SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
-    repos_id, repos_path, revision, ?6 /*presence*/, depth, ?7 /*moved_here*/,
-    kind, changed_revision, changed_date, changed_author, checksum, properties,
-    translated_size, last_mod_time, symlink_target
-FROM nodes
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0
-ORDER BY op_depth DESC
-LIMIT 1
+    wc_id, local_relpath, op_depth, parent_relpath, repos_id,
+    repos_path, revision, presence, depth, moved_here, kind, changed_revision,
+    changed_date, changed_author, checksum, properties, translated_size,
+    last_mod_time, symlink_target, moved_to )
+SELECT src.wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
+    src.repos_id, src.repos_path, src.revision, ?6 /*presence*/, src.depth,
+    ?7 /*moved_here*/, src.kind, src.changed_revision, src.changed_date,
+    src.changed_author, src.checksum, src.properties, src.translated_size,
+    src.last_mod_time, src.symlink_target, dst.moved_to
+FROM nodes_current AS src
+LEFT OUTER JOIN nodes_current dst ON dst.wc_id = src.wc_id
+  AND dst.local_relpath = ?3  AND dst.op_depth = ?4
+WHERE src.wc_id = ?1 AND src.local_relpath = ?2 AND src.op_depth > 0
 
 -- STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH
 INSERT OR REPLACE INTO nodes (
@@ -1373,34 +1380,48 @@ WHERE wc_id = ?1
   AND presence='normal'
   AND file_external IS NULL
 
+/* ### FIXME: op-depth?  What about multiple moves? */
 -- STMT_SELECT_MOVED_FROM_RELPATH
-SELECT local_relpath FROM nodes
-WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth = 0
+SELECT local_relpath, op_depth FROM nodes
+WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0
 
 -- STMT_UPDATE_MOVED_TO_RELPATH
-UPDATE nodes SET moved_to = ?3
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
+UPDATE nodes SET moved_to = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3
 
+/* ### FIXME: op-depth?  What about multiple moves? */
 -- STMT_CLEAR_MOVED_TO_RELPATH
 UPDATE nodes SET moved_to = NULL
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
-
--- STMT_CLEAR_MOVED_TO_RELPATH_RECURSIVE
-UPDATE nodes SET moved_to = NULL
-WHERE wc_id = ?1
-  AND (?2 = ''
-       OR local_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
-  AND op_depth = 0
+WHERE wc_id = ?1 AND local_relpath = ?2
 
 /* This statement returns pairs of move-roots below the path ?2 in WC_ID ?1.
  * Each row returns a moved-here path (always a child of ?2) in the first
  * column, and its matching moved-away (deleted) path in the second column. */
 -- STMT_SELECT_MOVED_HERE_CHILDREN
 SELECT moved_to, local_relpath FROM nodes
-WHERE wc_id = ?1 AND op_depth = 0
+WHERE wc_id = ?1 AND op_depth > 0
   AND IS_STRICT_DESCENDANT_OF(moved_to, ?2)
 
+/* This statement returns pairs of paths that define a move where the
+   destination of the move is within the subtree rooted at path ?2 in
+   WC_ID ?1. */
+-- STMT_SELECT_MOVED_PAIR
+SELECT local_relpath, moved_to, op_depth FROM nodes_current
+WHERE wc_id = ?1
+  AND (IS_STRICT_DESCENDANT_OF(moved_to, ?2)
+       OR (IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+           AND moved_to IS NOT NULL))
+
+/* This statement returns pairs of move-roots below the path ?2 in WC_ID ?1,
+ * where the source of the move is within the subtree rooted at path ?2, and
+ * the destination of the move is outside the subtree rooted at path ?2. */
+-- STMT_SELECT_MOVED_PAIR2
+SELECT local_relpath, moved_to FROM nodes_current
+WHERE wc_id = ?1
+  AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+  AND moved_to IS NOT NULL
+  AND NOT IS_STRICT_DESCENDANT_OF(moved_to, ?2)
+
 /* ------------------------------------------------------------------------- */
 
 /* Queries for verification. */

Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/wc_db.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_wc/wc_db.c Fri Mar 30 13:55:26 2012
@@ -368,6 +368,7 @@ scan_addition(svn_wc__db_status_t *statu
               svn_revnum_t *original_revision,
               const char **moved_from_relpath,
               const char **moved_from_op_root_relpath,
+              apr_int64_t *moved_from_op_depth,
               svn_wc__db_wcroot_t *wcroot,
               const char *local_relpath,
               apr_pool_t *result_pool,
@@ -781,7 +782,6 @@ insert_base_node(void *baton,
   svn_sqlite__stmt_t *stmt;
   svn_filesize_t recorded_size = SVN_INVALID_FILESIZE;
   apr_int64_t recorded_mod_time;
-  const char *moved_to_relpath = NULL;
   svn_boolean_t have_row;
 
   /* The directory at the WCROOT has a NULL parent_relpath. Otherwise,
@@ -813,15 +813,13 @@ insert_base_node(void *baton,
           recorded_size = get_recorded_size(stmt, 6);
           recorded_mod_time = svn_sqlite__column_int64(stmt, 12);
         }
-      /* Always preserve moved-to info. */
-      moved_to_relpath = svn_sqlite__column_text(stmt, 15, scratch_pool);
     }
   SVN_ERR(svn_sqlite__reset(stmt));
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_INSERT_NODE));
   SVN_ERR(svn_sqlite__bindf(stmt, "isisisr"
                             "tstr"               /* 8 - 11 */
-                            "isnnnnnsss",          /* 12 - 21 */
+                            "isnnnnns",          /* 12 - 19 */
                             wcroot->wc_id,       /* 1 */
                             local_relpath,       /* 2 */
                             (apr_int64_t)0, /* op_depth is 0 for base */
@@ -837,9 +835,7 @@ insert_base_node(void *baton,
                             pibb->changed_date,   /* 12 */
                             pibb->changed_author, /* 13 */
                             (pibb->kind == svn_kind_symlink) ?
-                                pibb->target : NULL, /* 19 */
-                            NULL /* 20 */,
-                            moved_to_relpath /* 21 */));
+                                pibb->target : NULL)); /* 19 */
   if (pibb->kind == svn_kind_file)
     {
       if (!pibb->checksum
@@ -971,38 +967,72 @@ insert_incomplete_children(svn_sqlite__d
 {
   svn_sqlite__stmt_t *stmt;
   int i;
+  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+  apr_hash_t *moved_to_relpaths = apr_hash_make(scratch_pool);
 
   SVN_ERR_ASSERT(repos_path != NULL || op_depth > 0);
   SVN_ERR_ASSERT((repos_id != INVALID_REPOS_ID)
                  == (repos_path != NULL));
 
+  /* If we're inserting WORKING nodes, we might be replacing existing
+   * nodes which were moved-away. We need to retain the moved-to relpath of
+   * such nodes in order not to lose move information during replace. */
+  if (op_depth > 0)
+    {
+      for (i = children->nelts; i--; )
+        {
+          const char *name = APR_ARRAY_IDX(children, i, const char *);
+          svn_boolean_t have_row;
+
+          svn_pool_clear(iterpool);
+
+          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+                                            STMT_SELECT_WORKING_NODE));
+          SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id,
+                                    svn_relpath_join(local_relpath, name,
+                                                     iterpool)));
+          SVN_ERR(svn_sqlite__step(&have_row, stmt));
+          if (have_row && !svn_sqlite__column_is_null(stmt, 14))
+            apr_hash_set(moved_to_relpaths, name, APR_HASH_KEY_STRING,
+              svn_sqlite__column_text(stmt, 14, scratch_pool));
+
+          SVN_ERR(svn_sqlite__reset(stmt));
+        }
+    }
+
   SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_NODE));
 
   for (i = children->nelts; i--; )
     {
       const char *name = APR_ARRAY_IDX(children, i, const char *);
 
-      SVN_ERR(svn_sqlite__bindf(stmt, "isisnnrsns",
+      svn_pool_clear(iterpool);
+
+      SVN_ERR(svn_sqlite__bindf(stmt, "isisnnrsnsnnnnnnnnnnsn",
                                 wc_id,
                                 svn_relpath_join(local_relpath, name,
-                                                 scratch_pool),
+                                                 iterpool),
                                 op_depth,
                                 local_relpath,
                                 revision,
                                 "incomplete", /* 8, presence */
-                                "unknown"));  /* 10, kind */
-
+                                "unknown",    /* 10, kind */
+                                /* 21, moved_to */
+                                apr_hash_get(moved_to_relpaths, name,
+                                             APR_HASH_KEY_STRING)));
       if (repos_id != INVALID_REPOS_ID)
         {
           SVN_ERR(svn_sqlite__bind_int64(stmt, 5, repos_id));
           SVN_ERR(svn_sqlite__bind_text(stmt, 6,
                                         svn_relpath_join(repos_path, name,
-                                                         scratch_pool)));
+                                                         iterpool)));
         }
 
       SVN_ERR(svn_sqlite__insert(NULL, stmt));
     }
 
+  svn_pool_destroy(iterpool);
+
   return SVN_NO_ERROR;
 }
 
@@ -2039,7 +2069,7 @@ base_get_info(svn_wc__db_status_t *statu
       SVN_ERR_ASSERT(!repos_relpath || *repos_relpath);
       if (lock)
         {
-          *lock = lock_from_columns(stmt, 16, 17, 18, 19, result_pool);
+          *lock = lock_from_columns(stmt, 15, 16, 17, 18, result_pool);
         }
       if (changed_rev)
         {
@@ -3421,7 +3451,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
       SVN_ERR(scan_addition(NULL, &op_root_relpath,
                             NULL, NULL, /* repos_* */
                             copyfrom_relpath, copyfrom_id, copyfrom_rev,
-                            NULL, NULL, wcroot, local_relpath,
+                            NULL, NULL, NULL, wcroot, local_relpath,
                             scratch_pool, scratch_pool));
       if (*copyfrom_relpath)
         {
@@ -3450,7 +3480,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
           SVN_ERR(scan_addition(NULL, &op_root_relpath,
                                 NULL, NULL, /* repos_* */
                                 copyfrom_relpath, copyfrom_id, copyfrom_rev,
-                                NULL, NULL, wcroot, parent_del_relpath,
+                                NULL, NULL, NULL, wcroot, parent_del_relpath,
                                 scratch_pool, scratch_pool));
           *copyfrom_relpath
             = svn_relpath_join(*copyfrom_relpath,
@@ -3626,13 +3656,14 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
         SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb,
                           STMT_INSERT_WORKING_NODE_COPY_FROM_BASE));
 
-      SVN_ERR(svn_sqlite__bindf(stmt, "issisti",
+      SVN_ERR(svn_sqlite__bindf(stmt, "issist",
                     src_wcroot->wc_id, src_relpath,
                     dst_relpath,
                     dst_op_depth,
                     dst_parent_relpath,
-                    presence_map, dst_presence,
-                    (apr_int64_t)(is_move ? 1 : 0)));
+                    presence_map, dst_presence));
+      if (is_move)
+        SVN_ERR(svn_sqlite__bind_int64(stmt, 7, 1));
 
       SVN_ERR(svn_sqlite__step_done(stmt));
 
@@ -5373,14 +5404,9 @@ op_revert_txn(void *baton,
       SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
 
+      /* If this node was moved-here, clear moved-to at the move source. */
       if (moved_here)
         SVN_ERR(clear_moved_to(local_relpath, wcroot, scratch_pool));
-
-      /* Clear the moved-to path of the BASE node. */
-      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                        STMT_CLEAR_MOVED_TO_RELPATH));
-      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
-      SVN_ERR(svn_sqlite__step_done(stmt));
     }
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -5512,12 +5538,6 @@ op_revert_recursive_txn(void *baton,
       && moved_here)
     SVN_ERR(clear_moved_to(local_relpath, wcroot, scratch_pool));
 
-  /* Clear any moved-to paths of potentially 'moved-away' nodes. */
-  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                    STMT_CLEAR_MOVED_TO_RELPATH_RECURSIVE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
-  SVN_ERR(svn_sqlite__step_done(stmt));
-
   return SVN_NO_ERROR;
 }
 
@@ -6274,6 +6294,7 @@ info_below_working(svn_boolean_t *have_b
 static svn_error_t *
 delete_update_movedto(svn_wc__db_wcroot_t *wcroot,
                       const char *child_moved_from_relpath,
+                      apr_int64_t op_depth,
                       const char *new_moved_to_relpath,
                       apr_pool_t *scratch_pool)
 {
@@ -6282,9 +6303,10 @@ delete_update_movedto(svn_wc__db_wcroot_
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_UPDATE_MOVED_TO_RELPATH));
 
-  SVN_ERR(svn_sqlite__bindf(stmt, "iss",
+  SVN_ERR(svn_sqlite__bindf(stmt, "isis",
                             wcroot->wc_id,
                             child_moved_from_relpath,
+                            op_depth,
                             new_moved_to_relpath));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
@@ -6297,6 +6319,37 @@ struct op_delete_baton_t {
   const char *moved_to_relpath; /* NULL if delete is not part of a move */
 };
 
+/* This structure is used while rewriting move information for nodes.
+ * 
+ * The most simple case of rewriting move information happens when
+ * a moved-away subtree is moved again:  mv A B; mv B C
+ * The second move requires rewriting moved-to info at or within A.
+ *
+ * Another example is a move of a subtree which had nodes moved into it:
+ *   mv A B/F; mv B G
+ * This requires rewriting such that A/F is marked has having moved to G/F.
+ *
+ * Another case is where a node becomes a nested moved node.
+ * A nested move happens when a subtree child is moved before or after
+ * the subtree itself is moved. For example:
+ *   mv A/F A/G; mv A B
+ * In this case, the move A/F -> A/G is rewritten to B/F -> B/G.
+ * Note that the following sequence results in the same DB state:
+ *   mv A B; mv B/F B/G
+ * We do not care about the order the moves were performed in.
+ * For details, see http://wiki.apache.org/subversion/MultiLayerMoves
+ */
+struct moved_node_t {
+  /* The source of the move. */
+  const char *local_relpath;
+
+  /* The move destination. */
+  const char *moved_to_relpath;
+
+  /* The op-depth of the deleted node at the source of the move. */
+  apr_int64_t op_depth;
+};
+
 static svn_error_t *
 delete_node(void *baton,
             svn_wc__db_wcroot_t *wcroot,
@@ -6311,6 +6364,7 @@ delete_node(void *baton,
   apr_int64_t select_depth; /* Depth of what is to be deleted */
   svn_boolean_t refetch_depth = FALSE;
   svn_kind_t kind;
+  apr_array_header_t *moved_nodes = NULL;
 
   SVN_ERR(read_info(&status,
                     &kind, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -6345,116 +6399,129 @@ delete_node(void *baton,
 
   if (b->moved_to_relpath)
     {
-      const char *moved_from_relpath = NULL;
-
-      /* ### call scan_addition_txn() directly? */
+      const char *moved_from_op_root_relpath;
+      struct moved_node_t *moved_node
+        = apr_palloc(scratch_pool, sizeof(struct moved_node_t));
+
+      /* The node is being moved-away.
+       * Figure out if the node was moved-here before, or whether this
+       * is the first time the node is moved. */
       if (status == svn_wc__db_status_added)
-        SVN_ERR(scan_addition(&status, NULL, NULL, NULL,
-                              NULL, NULL, NULL,
-                              &moved_from_relpath, NULL,
+        SVN_ERR(scan_addition(&status, NULL, NULL, NULL, NULL, NULL, NULL,
+                              &moved_node->local_relpath,
+                              &moved_from_op_root_relpath,
+                              &moved_node->op_depth,
                               wcroot, local_relpath,
                               scratch_pool, scratch_pool));
 
-      if (status == svn_wc__db_status_moved_here)
+      if (status != svn_wc__db_status_moved_here ||
+          strcmp(moved_from_op_root_relpath, moved_node->local_relpath) != 0)
         {
-          /* The node has already been moved, possibly along with a parent,
-           * and is being moved again. Update the existing moved_to path
-           * in the BASE node. */
-          SVN_ERR(delete_update_movedto(wcroot, moved_from_relpath,
-                                        b->moved_to_relpath, scratch_pool));
-        }
+          /* The node is becoming a move-root for the first time,
+           * possibly because of a nested move operation. */
+          moved_node->local_relpath = local_relpath;
+          moved_node->op_depth = b->delete_depth;
+        }
+      moved_node->moved_to_relpath = b->moved_to_relpath;
+
+      /* ### Use array of struct rather than pointers? */
+      moved_nodes = apr_array_make(scratch_pool, 1,
+                                   sizeof(struct moved_node_t *));
+      APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *) = moved_node;
 
       /* If a subtree is being moved-away, we need to update moved-to
-       * information in BASE for all children that were moved into this
-       * subtree. */
+       * information for all children that were moved into, or within,
+       * this subtree. */
       if (kind == svn_kind_dir)
         {
-          apr_pool_t *iterpool;
-
           SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                            STMT_SELECT_MOVED_HERE_CHILDREN));
+                                            STMT_SELECT_MOVED_PAIR));
           SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
-
           SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
-          iterpool = svn_pool_create(scratch_pool);
           while (have_row)
             {
-              svn_wc__db_status_t child_status;
-              const char *child_moved_from_relpath = NULL;
-              const char *child_delete_op_root_relpath = NULL;
-              const char *moved_here_child_relpath =
-                svn_sqlite__column_text(stmt, 0, scratch_pool);
-              svn_error_t *err;
-
-              svn_pool_clear(iterpool);
-
-              /* The moved-here-children query returns info based on the
-               * delete-half of the move. Check if that the copied-half of
-               * the move matches this information. */
-              err = read_info(&child_status, NULL, NULL, NULL, NULL,
-                              NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                              NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                              NULL, NULL, NULL, NULL, NULL, NULL,
-                              wcroot, moved_here_child_relpath,
-                              iterpool, iterpool);
-              if (err)
-                return svn_error_compose_create(err, svn_sqlite__reset(stmt));
+              const char *move_relpath
+                = svn_sqlite__column_text(stmt, 0, NULL);
+              const char *move_subtree_relpath
+                = svn_relpath_skip_ancestor(local_relpath, move_relpath);
+              const char *child_moved_to
+                = svn_sqlite__column_text(stmt, 1, NULL);
+              const char *child_moved_to_subtree_relpath
+                = svn_relpath_skip_ancestor(local_relpath, child_moved_to);
+              apr_int64_t child_op_depth = svn_sqlite__column_int64(stmt, 2);
+
+              moved_node = apr_palloc(scratch_pool,
+                                      sizeof(struct moved_node_t));
+              if (move_subtree_relpath)
+                moved_node->local_relpath
+                  = svn_relpath_join(b->moved_to_relpath,
+                                     move_subtree_relpath, scratch_pool);
+              else
+                moved_node->local_relpath
+                  = apr_pstrdup(scratch_pool, move_relpath);
 
-              if (child_status == svn_wc__db_status_added)
-                {
-                  err = scan_addition(&child_status, NULL, NULL, NULL,
-                                      NULL, NULL, NULL,
-                                      &child_moved_from_relpath,
-                                      &child_delete_op_root_relpath,
-                                      wcroot, moved_here_child_relpath,
-                                      iterpool, iterpool);
-                  if (err)
-                    return svn_error_compose_create(err,
-                                                    svn_sqlite__reset(stmt));
-                }
-#ifdef SVN_DEBUG
-              /* This catches incorrectly recorded moves.
-               * It is possible to hit this during normal operation
-               * if a move was interrupted mid-way so only perform
-               * this check in debug mode. */
-              SVN_ERR_ASSERT(child_moved_from_relpath &&
-                             !strcmp(child_moved_from_relpath,
-                                     svn_sqlite__column_text(stmt, 1, NULL)));
-#endif
-              if (child_status == svn_wc__db_status_moved_here)
-                {
-                  const char *child_subtree_relpath;
-                  const char *new_moved_to_relpath;
+              if (child_moved_to_subtree_relpath)
+                moved_node->moved_to_relpath
+                  = svn_relpath_join(b->moved_to_relpath,
+                                     child_moved_to_subtree_relpath,
+                                     scratch_pool);
+              else
+                moved_node->moved_to_relpath
+                  = apr_pstrdup(scratch_pool, child_moved_to);
 
-                  /* Compute the new moved-to path for this child... */
-                  child_subtree_relpath =
-                    svn_relpath_skip_ancestor(local_relpath,
-                                              moved_here_child_relpath);
-                  SVN_ERR_ASSERT(child_subtree_relpath);
-
-                  new_moved_to_relpath =
-                    svn_relpath_join(b->moved_to_relpath,
-                                     child_subtree_relpath, iterpool);
-                  /* ... and update the BASE moved-to record. */
-                  err = delete_update_movedto(wcroot, child_moved_from_relpath,
-                                              new_moved_to_relpath,
-                                              scratch_pool);
+              if (child_op_depth > b->delete_depth
+                  && svn_relpath_skip_ancestor(local_relpath,
+                                               moved_node->local_relpath))
+                moved_node->op_depth = b->delete_depth;
+              else
+                moved_node->op_depth = child_op_depth;
 
-                  if (err)
-                    return svn_error_trace(svn_error_compose_create(
-                                                    err,
-                                                    svn_sqlite__reset(stmt)));
-                }
+              APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *)
+                = moved_node;
 
               SVN_ERR(svn_sqlite__step(&have_row, stmt));
             }
-          svn_pool_destroy(iterpool);
-
           SVN_ERR(svn_sqlite__reset(stmt));
         }
     }
 
+  /* Find children that were moved out of the subtree rooted at this node.
+   * We'll need to update their op-depth columns because their deletion
+   * is now implied by the deletion of their parent (i.e. this node). */
+  if (kind == svn_kind_dir && !b->moved_to_relpath)
+    {
+      apr_pool_t *iterpool;
+
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                        STMT_SELECT_MOVED_PAIR2));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
+
+      iterpool = svn_pool_create(scratch_pool);
+      while (have_row)
+        {
+          struct moved_node_t *moved_node
+            = apr_palloc(scratch_pool, sizeof(struct moved_node_t));
+
+          moved_node->local_relpath
+            = svn_sqlite__column_text(stmt, 0, scratch_pool);
+          moved_node->moved_to_relpath
+            = svn_sqlite__column_text(stmt, 1, scratch_pool);
+          moved_node->op_depth = b->delete_depth;
+
+          if (!moved_nodes)
+            moved_nodes = apr_array_make(scratch_pool, 1,
+                                         sizeof(struct moved_node_t *));
+          APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *) = moved_node;
+
+          SVN_ERR(svn_sqlite__step(&have_row, stmt));
+        }
+      svn_pool_destroy(iterpool);
+      SVN_ERR(svn_sqlite__reset(stmt));
+    }
+
   if (op_root)
     {
       svn_boolean_t below_base;
@@ -6487,7 +6554,7 @@ delete_node(void *baton,
 
           SVN_ERR(scan_addition(&status, NULL, NULL, NULL, NULL, NULL, NULL,
                                 &moved_from_relpath,
-                                &moved_from_op_root_relpath,
+                                &moved_from_op_root_relpath, NULL,
                                 wcroot, local_relpath,
                                 scratch_pool, scratch_pool));
           if (status == svn_wc__db_status_moved_here &&
@@ -6547,12 +6614,6 @@ delete_node(void *baton,
   if (add_work)
     {
       /* Delete the node at LOCAL_RELPATH, and possibly mark it as moved. */
-      if (b->moved_to_relpath)
-        {
-          /* Record moved-to relpath in BASE. */
-          SVN_ERR(delete_update_movedto(wcroot, local_relpath,
-                                        b->moved_to_relpath, scratch_pool));
-        }
 
       /* Delete the node and possible descendants. */
       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -6563,6 +6624,23 @@ delete_node(void *baton,
       SVN_ERR(svn_sqlite__step_done(stmt));
     }
 
+  if (moved_nodes)
+    {
+      int i;
+
+      for (i = 0; i < moved_nodes->nelts; ++i)
+        {
+          const struct moved_node_t *moved_node
+            = APR_ARRAY_IDX(moved_nodes, i, void *);
+
+          SVN_ERR(delete_update_movedto(wcroot,
+                                        moved_node->local_relpath,
+                                        moved_node->op_depth,
+                                        moved_node->moved_to_relpath,
+                                        scratch_pool));
+        }
+    }
+
   return SVN_NO_ERROR;
 }
 
@@ -7356,13 +7434,16 @@ read_children_info(void *baton,
               /* Assume working copy is all one repos_id so that a
                  single cached value is sufficient. */
               if (repos_id != last_repos_id)
-                return svn_error_createf(
+                {
+                  err= svn_error_createf(
                          SVN_ERR_WC_DB_ERROR, NULL,
                          _("The node '%s' comes from unexpected repository "
                            "'%s', expected '%s'; if this node is a file "
                            "external using the correct URL in the external "
                            "definition can fix the problem, see issue #4087"),
                          child_relpath, repos_root_url, last_repos_root_url);
+                  return svn_error_compose_create(err, svn_sqlite__reset(stmt));
+                }
               child->repos_root_url = repos_root_url;
               child->repos_uuid = repos_uuid;
             }
@@ -7419,29 +7500,29 @@ read_children_info(void *baton,
 
       if (op_depth == 0)
         {
-          const char *moved_to_relpath;
-
           child_item->info.have_base = TRUE;
 
           /* Get the lock info, available only at op_depth 0. */
           child_item->info.lock = lock_from_columns(stmt, 15, 16, 17, 18,
                                                     result_pool);
 
-          /* Moved-to is only stored at op_depth 0. */
-          moved_to_relpath = svn_sqlite__column_text(stmt, 21, NULL);
-          if (moved_to_relpath)
-            child_item->info.moved_to_abspath =
-              svn_dirent_join(wcroot->abspath, moved_to_relpath, result_pool);
-
           /* FILE_EXTERNAL flag only on op_depth 0. */
           child_item->info.file_external = svn_sqlite__column_boolean(stmt,
                                                                       22);
         }
       else
         {
+          const char *moved_to_relpath;
+
           child_item->nr_layers++;
           child_item->info.have_more_work = (child_item->nr_layers > 1);
 
+          /* Moved-to can only exist at op_depth > 0. */
+          moved_to_relpath = svn_sqlite__column_text(stmt, 21, NULL); 
+          if (moved_to_relpath)
+            child_item->info.moved_to_abspath =
+              svn_dirent_join(wcroot->abspath, moved_to_relpath, result_pool);
+
           /* Moved-here can only exist at op_depth > 0. */
           child_item->info.moved_here = svn_sqlite__column_boolean(stmt, 20);
         }
@@ -7848,7 +7929,8 @@ read_url_txn(void *baton,
       if (status == svn_wc__db_status_added)
         {
           SVN_ERR(scan_addition(NULL, NULL, &repos_relpath, &repos_id, NULL,
-                                NULL, NULL, NULL, NULL, wcroot, local_relpath,
+                                NULL, NULL, NULL, NULL, NULL,
+                                wcroot, local_relpath,
                                 scratch_pool, scratch_pool));
         }
       else if (status == svn_wc__db_status_deleted)
@@ -7881,7 +7963,7 @@ read_url_txn(void *baton,
                                                              scratch_pool);
 
               SVN_ERR(scan_addition(NULL, NULL, &repos_relpath, &repos_id,
-                                    NULL, NULL, NULL, NULL, NULL,
+                                    NULL, NULL, NULL, NULL, NULL, NULL,
                                     wcroot, work_relpath,
                                     scratch_pool, scratch_pool));
 
@@ -8630,7 +8712,7 @@ svn_wc__db_global_relocate(svn_wc__db_t 
       if (status == svn_wc__db_status_added)
         {
           SVN_ERR(scan_addition(NULL, NULL, NULL, &rb.old_repos_id,
-                                NULL, NULL, NULL, NULL, NULL,
+                                NULL, NULL, NULL, NULL, NULL, NULL,
                                 wcroot, local_dir_relpath,
                                 scratch_pool, scratch_pool));
         }
@@ -9564,6 +9646,7 @@ get_moved_from_info(svn_wc__db_status_t 
                     const char **moved_from_relpath,
                     const char **moved_from_op_root_relpath,
                     const char *moved_to_op_root_relpath,
+                    apr_int64_t *op_depth,
                     svn_wc__db_wcroot_t *wcroot,
                     const char *local_relpath,
                     apr_pool_t *result_pool,
@@ -9599,6 +9682,9 @@ get_moved_from_info(svn_wc__db_status_t 
   if (status)
     *status = svn_wc__db_status_moved_here;
 
+  if (op_depth)
+    *op_depth = svn_sqlite__column_int64(stmt, 1);
+
   if (moved_from_relpath || moved_from_op_root_relpath)
     {
       const char *db_delete_op_root_relpath;
@@ -9660,6 +9746,7 @@ struct scan_addition_baton_t
   svn_revnum_t *original_revision;
   const char **moved_from_relpath;
   const char **moved_from_op_root_relpath;
+  apr_int64_t *moved_from_op_depth;
   apr_pool_t *result_pool;
 };
 
@@ -9689,6 +9776,8 @@ scan_addition_txn(void *baton,
     *sab->moved_from_relpath = NULL;
   if (sab->moved_from_op_root_relpath)
     *sab->moved_from_op_root_relpath = NULL;
+  if (sab->moved_from_op_depth)
+    *sab->moved_from_op_depth = 0;
 
   {
     svn_sqlite__stmt_t *stmt;
@@ -9819,8 +9908,9 @@ scan_addition_txn(void *baton,
                   SVN_ERR(get_moved_from_info(sab->status,
                                               sab->moved_from_relpath,
                                               sab->moved_from_op_root_relpath,
-                                              op_root_relpath, wcroot,
-                                              local_relpath,
+                                              op_root_relpath,
+                                              sab->moved_from_op_depth,
+                                              wcroot, local_relpath,
                                               sab->result_pool,
                                               scratch_pool));
                 else if (sab->status)
@@ -9941,6 +10031,7 @@ scan_addition(svn_wc__db_status_t *statu
               svn_revnum_t *original_revision,
               const char **moved_from_relpath,
               const char **moved_from_op_root_relpath,
+              apr_int64_t *moved_from_op_depth,
               svn_wc__db_wcroot_t *wcroot,
               const char *local_relpath,
               apr_pool_t *result_pool,
@@ -9957,6 +10048,7 @@ scan_addition(svn_wc__db_status_t *statu
   sab.original_revision = original_revision;
   sab.moved_from_relpath = moved_from_relpath;
   sab.moved_from_op_root_relpath = moved_from_op_root_relpath;
+  sab.moved_from_op_depth = moved_from_op_depth;
   sab.result_pool = result_pool;
 
   return svn_error_trace(svn_wc__db_with_txn(wcroot, local_relpath,
@@ -10003,8 +10095,8 @@ svn_wc__db_scan_addition(svn_wc__db_stat
   SVN_ERR(scan_addition(status, &op_root_relpath, repos_relpath, repos_id_p,
                         original_repos_relpath, original_repos_id_p,
                         original_revision, &moved_from_relpath,
-                        &moved_from_op_root_relpath, wcroot, local_relpath,
-                        result_pool, scratch_pool));
+                        &moved_from_op_root_relpath, NULL,
+                        wcroot, local_relpath, result_pool, scratch_pool));
 
   if (op_root_abspath)
     *op_root_abspath = svn_dirent_join(wcroot->abspath, op_root_relpath,

Modified: subversion/branches/revprop-packing/subversion/mod_dav_svn/version.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/mod_dav_svn/version.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/mod_dav_svn/version.c (original)
+++ subversion/branches/revprop-packing/subversion/mod_dav_svn/version.c Fri Mar 30 13:55:26 2012
@@ -1382,6 +1382,15 @@ merge(dav_resource *target,
                                     SVN_DAV_ERROR_NAMESPACE,
                                     SVN_DAV_ERROR_TAG);
     }
+  if (! source->exists)
+    {
+      return dav_svn__new_error_tag(pool, HTTP_METHOD_NOT_ALLOWED,
+                                    SVN_ERR_INCORRECT_PARAMS,
+                                    "MERGE activity or transaction resource "
+                                    "does not exist.",
+                                    SVN_DAV_ERROR_NAMESPACE,
+                                    SVN_DAV_ERROR_TAG);
+    }
 
   /* Before attempting the final commit, we need to push any incoming
      lock-tokens into the filesystem's access_t.   Normally they come