subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pbu...@apache.org
Subject svn commit: r1160699 [2/3] - in /subversion/branches/issue-3975: ./ build/ notes/ subversion/bindings/swig/ruby/test/ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_ra_serf/ subversion/libsvn_ra_svn/ subvers...
Date Tue, 23 Aug 2011 14:03:14 GMT
Modified: subversion/branches/issue-3975/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/adm_ops.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/adm_ops.c Tue Aug 23 14:03:12 2011
@@ -1292,48 +1292,6 @@ remove_conflict_file(svn_boolean_t *noti
 }
 
 
-/* Remove the reverted copied file at LOCAL_ABSPATH from disk if it was
- * not modified after being copied. Use FILESIZE and PRISTINE_CHECKSUM to
- * detect modification.
- * If NEW_KIND is not NULL, return the resulting on-disk kind of the node
- * at LOCAL_ABSPATH in *NEW_KIND. */
-static svn_error_t *
-revert_restore_handle_copied_file(svn_node_kind_t *new_kind,
-                                  svn_wc__db_t *db,
-                                  const char *local_abspath,
-                                  svn_filesize_t filesize,
-                                  const svn_checksum_t *pristine_checksum,
-                                  apr_pool_t *scratch_pool)
-{
-  svn_stream_t *pristine_stream;
-  svn_filesize_t pristine_size;
-  svn_boolean_t has_text_mods;
-
-  if (new_kind)
-    *new_kind = svn_node_file;
-
-  SVN_ERR(svn_wc__db_pristine_read(&pristine_stream, &pristine_size,
-                                   db, local_abspath, pristine_checksum,
-                                   scratch_pool, scratch_pool));
-  SVN_ERR(svn_wc__compare_file_with_pristine(&has_text_mods, db,
-                                             local_abspath,
-                                             filesize,
-                                             pristine_stream,
-                                             pristine_size,
-                                             FALSE, FALSE, FALSE,
-                                             scratch_pool));
-
-  if (!has_text_mods)
-    {
-      SVN_ERR(svn_io_remove_file2(local_abspath, FALSE, scratch_pool));
-      if (new_kind)
-        *new_kind = svn_node_none;
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
 /* Sort copied children obtained from the revert list based on
  * their paths in descending order (longest paths first). */
 static int
@@ -1351,19 +1309,18 @@ compare_revert_list_copied_children(cons
 }
 
 
-/* Remove as many reverted copied children as possible from the directory at
- * LOCAL_ABSPATH. If REMOVE_SELF is TRUE, also remove LOCAL_ABSPATH itself
- * if possible (REMOVE_SELF should be set if LOCAL_ABSPATH is itself a
- * reverted copy).
+/* Remove all reverted copied children from the directory at LOCAL_ABSPATH.
+ * If REMOVE_SELF is TRUE, try to remove LOCAL_ABSPATH itself (REMOVE_SELF
+ * should be set if LOCAL_ABSPATH is itself a reverted copy).
  *
- * All reverted copied file children not modified after being copied are
- * removed from disk. Reverted copied directories left empty as a result
- * are also removed from disk.
+ * If REMOVED_SELF is not NULL, indicate in *REMOVED_SELF whether
+ * LOCAL_ABSPATH itself was removed.
  *
- * If NEW_KIND is not NULL, return the resulting on-disk kind of the node
- * at LOCAL_ABSPATH in *NEW_KIND. */
+ * All reverted copied file children are removed from disk. Reverted copied
+ * directories left empty as a result are also removed from disk.
+ */
 static svn_error_t *
-revert_restore_handle_copied_dirs(svn_node_kind_t *new_kind,
+revert_restore_handle_copied_dirs(svn_boolean_t *removed_self,
                                   svn_wc__db_t *db,
                                   const char *local_abspath,
                                   svn_boolean_t remove_self,
@@ -1374,12 +1331,12 @@ revert_restore_handle_copied_dirs(svn_no
   const apr_array_header_t *copied_children;
   svn_wc__db_revert_list_copied_child_info_t *child_info;
   int i;
-  apr_finfo_t finfo;
+  svn_node_kind_t on_disk;
   apr_pool_t *iterpool;
   svn_error_t *err;
 
-  if (new_kind)
-    *new_kind = svn_node_dir;
+  if (removed_self)
+    *removed_self = FALSE;
 
   SVN_ERR(svn_wc__db_revert_list_read_copied_children(&copied_children,
                                                       db, local_abspath,
@@ -1387,7 +1344,7 @@ revert_restore_handle_copied_dirs(svn_no
                                                       scratch_pool));
   iterpool = svn_pool_create(scratch_pool);
 
-  /* Remove all file children, if possible. */
+  /* Remove all copied file children. */
   for (i = 0; i < copied_children->nelts; i++)
     {
       child_info = APR_ARRAY_IDX(
@@ -1402,33 +1359,19 @@ revert_restore_handle_copied_dirs(svn_no
 
       svn_pool_clear(iterpool);
 
-      err = svn_io_stat(&finfo, child_info->abspath,
-                        APR_FINFO_TYPE | APR_FINFO_SIZE,
-                        iterpool);
-      if (err && (APR_STATUS_IS_ENOENT(err->apr_err)
-                  || SVN__APR_STATUS_IS_ENOTDIR(err->apr_err)))
-        {
-          svn_error_clear(err);
-          continue;
-        }
-      else
-        SVN_ERR(err);
-
-      if (finfo.filetype != APR_REG)
+      /* Make sure what we delete from disk is really a file. */
+      SVN_ERR(svn_io_check_path(child_info->abspath, &on_disk, iterpool));
+      if (on_disk != svn_node_file)
         continue;
 
-      SVN_ERR(revert_restore_handle_copied_file(NULL, db, child_info->abspath,
-                                                finfo.size,
-                                                child_info->pristine_checksum,
-                                                iterpool));
+      SVN_ERR(svn_io_remove_file2(child_info->abspath, TRUE, iterpool));
     }
 
-  /* Try to delete every child directory, ignoring errors.
-   * This is a bit crude but good enough for our purposes.
-   *
+  /* Delete every empty child directory.
    * We cannot delete children recursively since we want to keep any files
-   * that still exist on disk. So sort the children list such that longest
-   * paths come first and try to remove each child directory in order. */
+   * that still exist on disk (e.g. unversioned files within the copied tree).
+   * So sort the children list such that longest paths come first and try to
+   * remove each child directory in order. */
   qsort(copied_children->elts, copied_children->nelts,
         sizeof(svn_wc__db_revert_list_copied_child_info_t *),
         compare_revert_list_copied_children);
@@ -1446,24 +1389,31 @@ revert_restore_handle_copied_dirs(svn_no
 
       svn_pool_clear(iterpool);
 
-      svn_error_clear(svn_io_dir_remove_nonrecursive(child_info->abspath,
-                                                     iterpool));
+      err = svn_io_dir_remove_nonrecursive(child_info->abspath, iterpool);
+      if (err)
+        {
+          if (APR_STATUS_IS_ENOENT(err->apr_err) ||
+              SVN__APR_STATUS_IS_ENOTDIR(err->apr_err) ||
+              APR_STATUS_IS_ENOTEMPTY(err->apr_err))
+            svn_error_clear(err);
+          else
+            return svn_error_trace(err);
+        }
     }
 
   if (remove_self)
     {
-      apr_hash_t *remaining_children;
-
       /* Delete LOCAL_ABSPATH itself if no children are left. */
-      SVN_ERR(svn_io_get_dirents3(&remaining_children, local_abspath, TRUE,
-                                  iterpool, iterpool));
-      if (apr_hash_count(remaining_children) == 0)
-        {
-          SVN_ERR(svn_io_remove_dir2(local_abspath, FALSE, NULL, NULL,
-                                     iterpool));
-          if (new_kind)
-            *new_kind = svn_node_none;
+      err = svn_io_dir_remove_nonrecursive(local_abspath, iterpool);
+      if (err)
+       {
+          if (APR_STATUS_IS_ENOTEMPTY(err->apr_err))
+            svn_error_clear(err);
+          else
+            return svn_error_trace(err);
         }
+      else if (removed_self)
+        *removed_self = TRUE;
     }
 
   svn_pool_destroy(iterpool);
@@ -1504,7 +1454,6 @@ revert_restore(svn_wc__db_t *db,
 #endif
   svn_boolean_t copied_here;
   svn_wc__db_kind_t reverted_kind;
-  const svn_checksum_t *pristine_checksum;
 
   if (cancel_func)
     SVN_ERR(cancel_func(cancel_baton));
@@ -1513,7 +1462,6 @@ revert_restore(svn_wc__db_t *db,
                                       &conflict_old, &conflict_new,
                                       &conflict_working, &prop_reject,
                                       &copied_here, &reverted_kind,
-                                      &pristine_checksum,
                                       db, local_abspath,
                                       scratch_pool, scratch_pool));
 
@@ -1543,6 +1491,16 @@ revert_restore(svn_wc__db_t *db,
                                                   scratch_pool));
           return SVN_NO_ERROR;
         }
+      else
+        {
+          /* ### Initialise to values which prevent the code below from
+           * ### trying to restore anything to disk.
+           * ### 'status' should be status_unknown but that doesn't exist. */
+          status = svn_wc__db_status_normal;
+          kind = svn_wc__db_kind_unknown;
+          recorded_size = SVN_INVALID_FILESIZE;
+          recorded_mod_time = 0;
+        }
     }
   else if (err)
     return svn_error_trace(err);
@@ -1581,15 +1539,21 @@ revert_restore(svn_wc__db_t *db,
     {
       /* The revert target itself is the op-root of a copy. */
       if (reverted_kind == svn_wc__db_kind_file && on_disk == svn_node_file)
-        SVN_ERR(revert_restore_handle_copied_file(&on_disk, db, local_abspath,
-                                                  finfo.size,
-                                                  pristine_checksum,
-                                                  scratch_pool));
+        {
+          SVN_ERR(svn_io_remove_file2(local_abspath, TRUE, scratch_pool));
+          on_disk = svn_node_none;
+        }
       else if (reverted_kind == svn_wc__db_kind_dir && on_disk == svn_node_dir)
-        SVN_ERR(revert_restore_handle_copied_dirs(&on_disk, db, local_abspath,
-                                                  TRUE, 
-                                                  cancel_func, cancel_baton,
-                                                  scratch_pool));
+        {
+          svn_boolean_t removed;
+
+          SVN_ERR(revert_restore_handle_copied_dirs(&removed, db,
+                                                    local_abspath, TRUE, 
+                                                    cancel_func, cancel_baton,
+                                                    scratch_pool));
+          if (removed)
+            on_disk = svn_node_none;
+        }
     }
 
   /* If we expect a versioned item to be present then check that any
@@ -2536,9 +2500,11 @@ svn_wc__internal_changelist_match(svn_wc
       return FALSE;
     }
 
+  /* The empty changelist name is special-cased. */
   return (changelist
-            && apr_hash_get((apr_hash_t *)clhash, changelist,
-                            APR_HASH_KEY_STRING) != NULL);
+          ? apr_hash_get((apr_hash_t *)clhash, changelist, APR_HASH_KEY_STRING)
+          : apr_hash_get((apr_hash_t *)clhash, "", APR_HASH_KEY_STRING)
+         ) != NULL;
 }
 
 

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/diff_local.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/diff_local.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/diff_local.c (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/diff_local.c Tue Aug 23 14:03:12 2011
@@ -474,8 +474,29 @@ diff_status_callback(void *baton,
           SVN_ERR(file_diff(eb, local_abspath, path, scratch_pool));
         }
     }
-  else
+  else  /* it's a directory */
     {
+      const char *path = svn_dirent_skip_ancestor(eb->anchor_abspath,
+                                                  local_abspath);
+
+      /* Report the directory as deleted and/or opened or added. */
+      if (status->node_status == svn_wc_status_deleted
+          || status->node_status == svn_wc_status_replaced)
+        SVN_ERR(eb->callbacks->dir_deleted(NULL, NULL, path,
+                                           eb->callback_baton, scratch_pool));
+
+      if (status->node_status == svn_wc_status_added
+          || status->node_status == svn_wc_status_replaced)
+        SVN_ERR(eb->callbacks->dir_added(NULL, NULL, NULL, NULL,
+                                         path, status->revision,
+                                         path, status->revision /* ### ? */,
+                                         eb->callback_baton, scratch_pool));
+      else
+        SVN_ERR(eb->callbacks->dir_opened(NULL, NULL, NULL,
+                                          path, status->revision,
+                                          eb->callback_baton, scratch_pool));
+
+      /* Report the prop change. */
       /* ### This case should probably be extended for git-diff, but this
              is what the old diff code provided */
       if (status->node_status == svn_wc_status_deleted
@@ -484,9 +505,6 @@ diff_status_callback(void *baton,
         {
           apr_array_header_t *propchanges;
           apr_hash_t *baseprops;
-          const char *path = svn_dirent_skip_ancestor(eb->anchor_abspath,
-                                                      local_abspath);
-
 
           SVN_ERR(svn_wc__internal_propdiff(&propchanges, &baseprops,
                                             eb->db, local_abspath,
@@ -498,6 +516,15 @@ diff_status_callback(void *baton,
                                                    eb->callback_baton,
                                                    scratch_pool));
         }
+
+      /* Close the dir.
+       * ### This should be done after all children have been processed, not
+       *     yet.  The current Subversion-internal callers don't care. */
+      SVN_ERR(eb->callbacks->dir_closed(
+                        NULL, NULL, NULL, path,
+                        (status->node_status == svn_wc_status_added
+                         || status->node_status == svn_wc_status_replaced),
+                        eb->callback_baton, scratch_pool));
     }
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/questions.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/questions.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/questions.c (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/questions.c Tue Aug 23 14:03:12 2011
@@ -79,17 +79,38 @@
 */
 
 
-svn_error_t *
-svn_wc__compare_file_with_pristine(svn_boolean_t *modified_p,
-                                   svn_wc__db_t *db,
-                                   const char *versioned_file_abspath,
-                                   svn_filesize_t versioned_file_size,
-                                   svn_stream_t *pristine_stream,
-                                   svn_filesize_t pristine_size,
-                                   svn_boolean_t has_props,
-                                   svn_boolean_t props_mod,
-                                   svn_boolean_t exact_comparison,
-                                   apr_pool_t *scratch_pool)
+/* Set *MODIFIED_P to TRUE if (after translation) VERSIONED_FILE_ABSPATH
+ * (of VERSIONED_FILE_SIZE bytes) differs from PRISTINE_STREAM (of
+ * PRISTINE_SIZE bytes), else to FALSE if not.
+ *
+ * If EXACT_COMPARISON is FALSE, translate VERSIONED_FILE_ABSPATH's EOL
+ * style and keywords to repository-normal form according to its properties,
+ * and compare the result with PRISTINE_STREAM.  If EXACT_COMPARISON is
+ * TRUE, translate PRISTINE_STREAM's EOL style and keywords to working-copy
+ * form according to VERSIONED_FILE_ABSPATH's properties, and compare the
+ * result with VERSIONED_FILE_ABSPATH.
+ *
+ * HAS_PROPS should be TRUE if the file had properties when it was not
+ * modified, otherwise FALSE.
+ *
+ * PROPS_MOD should be TRUE if the file's properties have been changed,
+ * otherwise FALSE.
+ *
+ * PRISTINE_STREAM will be closed before a successful return.
+ *
+ * DB is a wc_db; use SCRATCH_POOL for temporary allocation.
+ */
+static svn_error_t *
+compare_and_verify(svn_boolean_t *modified_p,
+                   svn_wc__db_t *db,
+                   const char *versioned_file_abspath,
+                   svn_filesize_t versioned_file_size,
+                   svn_stream_t *pristine_stream,
+                   svn_filesize_t pristine_size,
+                   svn_boolean_t has_props,
+                   svn_boolean_t props_mod,
+                   svn_boolean_t exact_comparison,
+                   apr_pool_t *scratch_pool)
 {
   svn_boolean_t same;
   svn_subst_eol_style_t eol_style;
@@ -316,12 +337,12 @@ svn_wc__internal_file_modified_p(svn_boo
   /* Check all bytes, and verify checksum if requested. */
   {
     svn_error_t *err;
-    err = svn_wc__compare_file_with_pristine(modified_p, db,
-                                             local_abspath, dirent->filesize,
-                                             pristine_stream, pristine_size,
-                                             has_props, props_mod,
-                                             exact_comparison,
-                                             scratch_pool);
+    err = compare_and_verify(modified_p, db,
+                             local_abspath, dirent->filesize,
+                             pristine_stream, pristine_size,
+                             has_props, props_mod,
+                             exact_comparison,
+                             scratch_pool);
 
     /* At this point we already opened the pristine file, so we know that
        the access denied applies to the working copy path */

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/status.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/status.c Tue Aug 23 14:03:12 2011
@@ -666,9 +666,7 @@ assemble_status(svn_wc_status3_t **statu
             }
 
           /* Get moved-from info (only for potential op-roots of a move). */
-          if (node_status == svn_wc_status_added
-              && info->moved_here
-              && info->op_root)
+          if (info->moved_here && info->op_root)
             SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL, NULL, NULL,
                                              NULL, NULL, NULL, NULL,
                                              &moved_from_abspath,

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/tree_conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/tree_conflicts.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/tree_conflicts.c (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/tree_conflicts.c Tue Aug 23 14:03:12 2011
@@ -76,6 +76,8 @@ const svn_token_map_t svn_wc__conflict_r
   { "added",       svn_wc_conflict_reason_added },
   { "replaced",    svn_wc_conflict_reason_replaced },
   { "unversioned", svn_wc_conflict_reason_unversioned },
+  { "moved-here", svn_wc_conflict_reason_moved_here },
+  { "moved-away", svn_wc_conflict_reason_moved_away },
   { NULL }
 };
 

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/update_editor.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/update_editor.c Tue Aug 23 14:03:12 2011
@@ -1272,7 +1272,8 @@ create_tree_conflict(svn_wc_conflict_des
   /* Get the source-left information, i.e. the local state of the node
    * before any changes were made to the working copy, i.e. the state the
    * node would have if it was reverted. */
-  if (reason == svn_wc_conflict_reason_added)
+  if (reason == svn_wc_conflict_reason_added ||
+      reason == svn_wc_conflict_reason_moved_here)
     {
       svn_wc__db_status_t added_status;
 
@@ -1327,6 +1328,7 @@ create_tree_conflict(svn_wc_conflict_des
        * and that other case should also be handled. */
       SVN_ERR_ASSERT(reason == svn_wc_conflict_reason_edited
                      || reason == svn_wc_conflict_reason_deleted
+                     || reason == svn_wc_conflict_reason_moved_away
                      || reason == svn_wc_conflict_reason_replaced
                      || reason == svn_wc_conflict_reason_obstructed);
 
@@ -1364,7 +1366,8 @@ create_tree_conflict(svn_wc_conflict_des
       /* This is an 'update', so REPOS_RELPATH would be the same as for
        * source-left. However, we don't have a source-left for locally
        * added files. */
-      right_repos_relpath = (reason == svn_wc_conflict_reason_added ?
+      right_repos_relpath = ((reason == svn_wc_conflict_reason_added ||
+                              reason == svn_wc_conflict_reason_moved_here) ?
                              added_repos_relpath : left_repos_relpath);
       if (! right_repos_relpath)
         right_repos_relpath = their_relpath;
@@ -1496,7 +1499,18 @@ check_tree_conflict(svn_wc_conflict_desc
              * would not have been called in the first place. */
             SVN_ERR_ASSERT(action == svn_wc_conflict_action_add);
 
-            reason = svn_wc_conflict_reason_added;
+            /* Scan the addition in case our caller didn't. */
+            if (working_status == svn_wc__db_status_added)
+              SVN_ERR(svn_wc__db_scan_addition(&working_status, NULL, NULL,
+                                               NULL, NULL, NULL, NULL,
+                                               NULL, NULL, NULL, NULL,
+                                               eb->db, local_abspath,
+                                               scratch_pool, scratch_pool));
+
+            if (working_status == svn_wc__db_status_moved_here)
+              reason = svn_wc_conflict_reason_moved_here;
+            else
+              reason = svn_wc_conflict_reason_added;
           }
         else
           {
@@ -1507,8 +1521,20 @@ check_tree_conflict(svn_wc_conflict_desc
 
 
       case svn_wc__db_status_deleted:
-        /* The node is locally deleted. */
-        reason = svn_wc_conflict_reason_deleted;
+        {
+          const char *moved_to_abspath;
+
+          /* The node is locally deleted. Check if it was moved away.
+           * ### should scan_deletion return status_moved_away, like
+           * ### scan_addition returns status_moved_here? */
+          SVN_ERR(svn_wc__db_scan_deletion(NULL, &moved_to_abspath, NULL,
+                                           NULL, eb->db, local_abspath,
+                                           scratch_pool, scratch_pool));
+          if (moved_to_abspath)
+            reason = svn_wc_conflict_reason_moved_away;
+          else
+            reason = svn_wc_conflict_reason_deleted;
+        }
         break;
 
       case svn_wc__db_status_incomplete:
@@ -1573,6 +1599,7 @@ check_tree_conflict(svn_wc_conflict_desc
    * would not have been called in the first place.*/
   if (reason == svn_wc_conflict_reason_edited
       || reason == svn_wc_conflict_reason_deleted
+      || reason == svn_wc_conflict_reason_moved_away
       || reason == svn_wc_conflict_reason_replaced)
     /* When the node existed before (it was locally deleted, replaced or
      * edited), then 'update' cannot add it "again". So it can only send
@@ -1580,7 +1607,8 @@ check_tree_conflict(svn_wc_conflict_desc
     SVN_ERR_ASSERT(action == svn_wc_conflict_action_edit
                    || action == svn_wc_conflict_action_delete
                    || action == svn_wc_conflict_action_replace);
-  else if (reason == svn_wc_conflict_reason_added)
+  else if (reason == svn_wc_conflict_reason_added ||
+           reason == svn_wc_conflict_reason_moved_here)
     /* When the node did not exist before (it was locally added), then 'update'
      * cannot want to modify it in any way. It can only send _action_add. */
     SVN_ERR_ASSERT(action == svn_wc_conflict_action_add);
@@ -1835,6 +1863,7 @@ delete_entry(const char *path,
              keeping a not-present marker */
         }
       else if (tree_conflict->reason == svn_wc_conflict_reason_deleted
+               || tree_conflict->reason == svn_wc_conflict_reason_moved_away
                || tree_conflict->reason == svn_wc_conflict_reason_replaced)
         {
           /* The item does not exist locally because it was already shadowed.
@@ -2355,6 +2384,7 @@ open_directory(const char *path,
       /* Other modifications wouldn't be a tree conflict */
       SVN_ERR_ASSERT(
                 tree_conflict->reason == svn_wc_conflict_reason_deleted ||
+                tree_conflict->reason == svn_wc_conflict_reason_moved_away ||
                 tree_conflict->reason == svn_wc_conflict_reason_replaced);
 
       /* Continue updating BASE */
@@ -3349,6 +3379,7 @@ open_file(const char *path,
       /* Other modifications wouldn't be a tree conflict */
       SVN_ERR_ASSERT(
                 tree_conflict->reason == svn_wc_conflict_reason_deleted ||
+                tree_conflict->reason == svn_wc_conflict_reason_moved_away||
                 tree_conflict->reason == svn_wc_conflict_reason_replaced);
 
       /* Continue updating BASE */

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/upgrade.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/upgrade.c Tue Aug 23 14:03:12 2011
@@ -1914,12 +1914,12 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
                              scratch_pool));
   SVN_ERR(svn_wc__ensure_directory(root_adm_abspath, scratch_pool));
 
-  /* Create an empty sqlite database for this directory. */
+  /* Create an empty sqlite database for this directory and store it in DB. */
   SVN_ERR(svn_wc__db_upgrade_begin(&data.sdb,
                                    &data.repos_id, &data.wc_id,
-                                   data.root_abspath,
+                                   db, data.root_abspath,
                                    this_dir->repos, this_dir->uuid,
-                                   scratch_pool, scratch_pool));
+                                   scratch_pool));
 
   /* Migrate the entries over to the new database.
    ### We need to think about atomicity here.
@@ -1964,7 +1964,6 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
   SVN_ERR(svn_wc__db_wq_add(db, data.root_abspath, work_items, scratch_pool));
 
   SVN_ERR(svn_wc__db_wclock_release(db, data.root_abspath, scratch_pool));
-  SVN_ERR(svn_sqlite__close(data.sdb));
   SVN_ERR(svn_wc__db_close(db));
 
   /* Renaming the db file is what makes the pre-wcng into a wcng */

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/wc-metadata.sql
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/wc-metadata.sql?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/wc-metadata.sql Tue Aug 23 14:03:12 2011
@@ -384,7 +384,8 @@ CREATE TABLE NODES (
      perhaps add a column called "moved_from". */
 
   /* Boolean value, specifying if this node was moved here (rather than just
-     copied). The source of the move is specified in copyfrom_*.  */
+     copied). The source of the move is implied by a different node with
+     a moved_to column pointing at this node. */
   moved_here  INTEGER,
 
   /* If the underlying node was moved away (rather than just deleted), this
@@ -392,8 +393,8 @@ CREATE TABLE NODES (
      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, whether that is BASE or a child node
-     implied from a parent's move/copy.  */
+     to the "underlying" node in the BASE tree. A non-NULL moved_to column
+     is only valid in rows where op_depth == 0. */
   moved_to  TEXT,
 
 

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/wc-queries.sql?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/wc-queries.sql Tue Aug 23 14:03:12 2011
@@ -37,8 +37,11 @@ ORDER BY op_depth DESC
 -- STMT_SELECT_NODE_INFO_WITH_LOCK
 SELECT op_depth, 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, lock_token, lock_owner,
-  lock_comment, lock_date, moved_here
+  depth, symlink_target, last_mod_time, properties, moved_here,
+  /* All the columns until now must match those returned by
+     STMT_SELECT_NODE_INFO. The implementation of svn_wc__db_read_info()
+     assumes that these columns are followed by the lock information) */
+  lock_token, lock_owner, lock_comment, lock_date
 FROM nodes
 LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id
   AND nodes.repos_path = lock.repos_relpath
@@ -48,7 +51,8 @@ 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
+  symlink_target, last_mod_time, properties, file_external IS NOT NULL,
+  moved_to
 FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
 
@@ -56,6 +60,10 @@ 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) */
   lock_token, lock_owner, lock_comment, lock_date
 FROM nodes
 LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id
@@ -158,9 +166,9 @@ INSERT OR REPLACE INTO nodes (
   wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
   revision, presence, depth, kind, changed_revision, changed_date,
   changed_author, checksum, properties, translated_size, last_mod_time,
-  dav_cache, symlink_target, file_external)
+  dav_cache, symlink_target, file_external, moved_to)
 VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14,
-        ?15, ?16, ?17, ?18, ?19, ?20)
+        ?15, ?16, ?17, ?18, ?19, ?20, ?21)
 
 -- STMT_SELECT_OP_DEPTH_CHILDREN
 SELECT local_relpath FROM nodes
@@ -178,7 +186,7 @@ WHERE wc_id = ?1 AND parent_relpath = ?2
 DELETE FROM nodes
 WHERE wc_id = ?1
   AND (local_relpath = ?2
-       OR ((local_relpath > ?2 || '/') AND (local_relpath < ?2 || '0')))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND (op_depth < ?3
        OR (op_depth = ?3 AND presence = 'base-deleted'))
 
@@ -186,7 +194,7 @@ WHERE wc_id = ?1
 SELECT local_relpath FROM nodes
 WHERE wc_id = ?1 AND op_depth = ?3
   AND (parent_relpath = ?2
-       OR ((parent_relpath > ?2 || '/') AND (parent_relpath < ?2 || '0')))
+       OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
   AND presence == 'not-present'
 
 -- STMT_COMMIT_DESCENDANT_TO_BASE
@@ -263,7 +271,7 @@ LEFT JOIN lock ON nodes.repos_id = lock.
 WHERE wc_id = ?1 AND op_depth = 0
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
 
 -- STMT_INSERT_WCROOT
 INSERT INTO wcroot (local_abspath)
@@ -298,7 +306,7 @@ UPDATE nodes SET dav_cache = NULL
 WHERE dav_cache IS NOT NULL AND wc_id = ?1 AND op_depth = 0
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
 
 -- STMT_RECURSIVE_UPDATE_NODE_REPO
 UPDATE nodes SET repos_id = ?4, dav_cache = NULL
@@ -306,7 +314,7 @@ WHERE wc_id = ?1
   AND repos_id = ?3
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
 
 -- STMT_UPDATE_LOCK_REPOS_ID
 UPDATE lock SET repos_id = ?2
@@ -476,7 +484,7 @@ FROM nodes_current
 WHERE wc_id = ?1
        AND (?2 = ''
             OR local_relpath = ?2 
-            OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+            OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
 
 -- STMT_INSERT_TARGET_WITH_CHANGELIST
 INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
@@ -509,7 +517,7 @@ SELECT N.wc_id, N.local_relpath, N.paren
  WHERE N.wc_id = ?1
        AND (?2 = ''
             OR N.local_relpath = ?2 
-            OR (N.local_relpath > ?2 || '/' AND N.local_relpath < ?2 || '0'))
+            OR IS_STRICT_DESCENDANT_OF(N.local_relpath, ?2))
        AND A.changelist = ?3
 
 -- STMT_SELECT_TARGETS
@@ -578,7 +586,7 @@ DELETE FROM nodes
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth >= ?3
 
 -- STMT_DELETE_ACTUAL_NODE
@@ -590,7 +598,7 @@ DELETE FROM actual_node
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
 
 -- STMT_DELETE_ACTUAL_NODE_WITHOUT_CONFLICT
 DELETE FROM actual_node
@@ -611,7 +619,7 @@ DELETE FROM actual_node
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND (changelist IS NULL
        OR NOT EXISTS (SELECT 1 FROM nodes_current c
                       WHERE c.wc_id = ?1 
@@ -647,7 +655,7 @@ SET properties = NULL,
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
 
 -- STMT_UPDATE_NODE_BASE_DEPTH
 UPDATE nodes SET depth = ?3
@@ -779,7 +787,7 @@ DELETE FROM wc_lock
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_dir_relpath = ?2
-       OR (local_dir_relpath > ?2 || '/' AND local_dir_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_dir_relpath, ?2))
   AND NOT EXISTS (SELECT 1 FROM nodes
                    WHERE nodes.wc_id = ?1
                      AND nodes.local_relpath = wc_lock.local_dir_relpath)
@@ -812,18 +820,8 @@ SELECT wc_id, local_relpath, ?4 /*op_dep
        kind
 FROM nodes
 WHERE wc_id = ?1
-  AND (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0')
-  AND op_depth = ?3
-  AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'absent')
-
--- STMT_INSERT_DELETE_NODE
-INSERT INTO nodes (
-    wc_id, local_relpath, op_depth, parent_relpath, presence, kind)
-SELECT wc_id, local_relpath, ?4 /*op_depth*/, parent_relpath, 'base-deleted',
-       kind
-FROM nodes
-WHERE wc_id = ?1
-  AND local_relpath = ?2
+  AND (local_relpath = ?2
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth = ?3
   AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'absent')
 
@@ -852,7 +850,7 @@ WHERE wc_id = ?1 AND local_relpath = ?2 
 UPDATE nodes SET op_depth = ?3 + 1
 WHERE wc_id = ?1
   AND (?2 = ''
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
  AND op_depth = ?3
 
 -- STMT_DOES_NODE_EXIST
@@ -864,7 +862,7 @@ SELECT local_relpath FROM nodes
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth = 0 AND presence = 'absent'
 LIMIT 1
 
@@ -874,7 +872,7 @@ SELECT local_relpath FROM nodes
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth = 0
   AND presence = 'absent'
 
@@ -965,7 +963,7 @@ FROM externals
 WHERE wc_id = ?1 
   AND (?2 = ''
        OR def_local_relpath = ?2
-       OR (def_local_relpath > ?2 || '/' AND def_local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(def_local_relpath, ?2))
 
 -- STMT_UPDATE_EXTERNAL_FILEINFO
 UPDATE externals SET recorded_size = ?3, recorded_mod_time = ?4
@@ -984,7 +982,7 @@ FROM nodes n
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND kind = 'dir' AND presence='normal'
   AND op_depth=(SELECT MAX(op_depth) FROM nodes o
                 WHERE o.wc_id = ?1 AND o.local_relpath = n.local_relpath)
@@ -1115,7 +1113,6 @@ CREATE TEMPORARY TABLE revert_list (
    op_depth INTEGER,
    repos_id INTEGER,
    kind TEXT,
-   checksum TEXT,
    PRIMARY KEY (local_relpath, actual)
    );
 DROP TRIGGER IF EXISTS   trigger_revert_list_nodes;
@@ -1123,9 +1120,8 @@ CREATE TEMPORARY TRIGGER trigger_revert_
 BEFORE DELETE ON nodes
 BEGIN
    INSERT OR REPLACE INTO revert_list(local_relpath, actual, op_depth,
-                                      repos_id, kind, checksum)
-   SELECT OLD.local_relpath, 0, OLD.op_depth, OLD.repos_id, OLD.kind,
-          OLD.checksum;
+                                      repos_id, kind)
+   SELECT OLD.local_relpath, 0, OLD.op_depth, OLD.repos_id, OLD.kind;
 END;
 DROP TRIGGER IF EXISTS   trigger_revert_list_actual_delete;
 CREATE TEMPORARY TRIGGER trigger_revert_list_actual_delete
@@ -1163,13 +1159,13 @@ DROP TRIGGER IF EXISTS trigger_revert_li
 
 -- STMT_SELECT_REVERT_LIST
 SELECT conflict_old, conflict_new, conflict_working, prop_reject, notify,
-       actual, op_depth, repos_id, kind, checksum
+       actual, op_depth, repos_id, kind
 FROM revert_list
 WHERE local_relpath = ?1
 ORDER BY actual DESC
 
 -- STMT_SELECT_REVERT_LIST_COPIED_CHILDREN
-SELECT local_relpath, kind, checksum
+SELECT local_relpath, kind
 FROM revert_list
 WHERE local_relpath LIKE ?1 ESCAPE '#'
   AND op_depth >= ?2
@@ -1207,7 +1203,7 @@ INSERT INTO delete_list(local_relpath)
 SELECT local_relpath FROM nodes n
 WHERE wc_id = ?1
   AND (local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth >= ?3
   AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'absent')
   AND op_depth = (SELECT MAX(op_depth) FROM nodes s
@@ -1232,7 +1228,7 @@ SELECT MIN(revision), MAX(revision),
   WHERE wc_id = ?1
     AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
     AND presence IN ('normal', 'incomplete')
     AND file_external IS NULL
     AND op_depth = 0
@@ -1242,7 +1238,7 @@ SELECT 1 FROM nodes
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth = 0
   AND (presence IN ('absent', 'excluded')
         OR depth NOT IN ('infinity', 'unknown'))
@@ -1254,7 +1250,7 @@ SELECT 1 FROM nodes
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth > 0
 LIMIT 1
 
@@ -1263,7 +1259,7 @@ SELECT 1 FROM actual_node
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND properties IS NOT NULL
 LIMIT 1
 
@@ -1286,7 +1282,7 @@ SELECT o.repos_path || '/' || SUBSTR(s.l
 FROM nodes AS o
 LEFT JOIN nodes AS s
 ON o.wc_id = s.wc_id
-   AND s.local_relpath > ?2 || '/' AND s.local_relpath < ?2 || '0'
+   AND IS_STRICT_DESCENDANT_OF(s.local_relpath, ?2)
    AND s.op_depth = 0
    AND s.repos_id = o.repos_id
    AND s.file_external IS NULL
@@ -1300,7 +1296,7 @@ SELECT SUBSTR(s.local_relpath, LENGTH(?2
 FROM nodes AS o
 LEFT JOIN nodes AS s
 ON o.wc_id = s.wc_id
-   AND s.local_relpath > ?2 || '/' AND s.local_relpath < ?2 || '0'
+   AND IS_STRICT_DESCENDANT_OF(s.local_relpath, ?2)
    AND s.op_depth = 0
    AND s.repos_id = o.repos_id
    AND s.file_external IS NULL
@@ -1341,7 +1337,7 @@ SELECT local_relpath, translated_size, l
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth = 0
   AND kind='file'
   AND presence='normal'
@@ -1364,13 +1360,16 @@ UPDATE nodes SET moved_to = NULL
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth = 0
 
+/* 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
-  AND (moved_to > ?2 || '/' AND moved_to < ?2 || '0')
+  AND IS_STRICT_DESCENDANT_OF(moved_to, ?2)
 
 /* ------------------------------------------------------------------------- */
 

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/wc.h?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/wc.h Tue Aug 23 14:03:12 2011
@@ -725,39 +725,6 @@ svn_wc__perform_file_merge(svn_skel_t **
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool);
 
-/* Set *MODIFIED_P to TRUE if (after translation) VERSIONED_FILE_ABSPATH
- * (of VERSIONED_FILE_SIZE bytes) differs from PRISTINE_STREAM (of
- * PRISTINE_SIZE bytes), else to FALSE if not.
- *
- * If EXACT_COMPARISON is FALSE, translate VERSIONED_FILE_ABSPATH's EOL
- * style and keywords to repository-normal form according to its properties,
- * and compare the result with PRISTINE_STREAM.  If EXACT_COMPARISON is
- * TRUE, translate PRISTINE_STREAM's EOL style and keywords to working-copy
- * form according to VERSIONED_FILE_ABSPATH's properties, and compare the
- * result with VERSIONED_FILE_ABSPATH.
- *
- * HAS_PROPS should be TRUE if the file had properties when it was not
- * modified, otherwise FALSE.
- *
- * PROPS_MOD should be TRUE if the file's properties have been changed,
- * otherwise FALSE.
- *
- * PRISTINE_STREAM will be closed before a successful return.
- *
- * DB is a wc_db; use SCRATCH_POOL for temporary allocation.
- */
-svn_error_t *
-svn_wc__compare_file_with_pristine(svn_boolean_t *modified_p,
-                                   svn_wc__db_t *db,
-                                   const char *versioned_file_abspath,
-                                   svn_filesize_t versioned_file_size,
-                                   svn_stream_t *pristine_stream,
-                                   svn_filesize_t pristine_size,
-                                   svn_boolean_t has_props,
-                                   svn_boolean_t props_mod,
-                                   svn_boolean_t exact_comparison,
-                                   apr_pool_t *scratch_pool);
-
 
 #ifdef __cplusplus
 }

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/wc_db.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/wc_db.c Tue Aug 23 14:03:12 2011
@@ -781,6 +781,8 @@ 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,
      bind the appropriate parent_relpath. */
@@ -798,24 +800,28 @@ insert_base_node(void *baton,
   /* ### we can't handle this right now  */
   SVN_ERR_ASSERT(pibb->conflict == NULL);
 
-  if (pibb->keep_recorded_info)
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_SELECT_BASE_NODE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  if (have_row)
     {
-      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                        STMT_SELECT_BASE_NODE));
-
-      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
-      SVN_ERR(svn_sqlite__step_row(stmt));
-
-      recorded_size = get_recorded_size(stmt, 6);
-      recorded_mod_time = svn_sqlite__column_int64(stmt, 12);
-
-      SVN_ERR(svn_sqlite__reset(stmt));
+      /* A BASE node already exists. */
+      if (pibb->keep_recorded_info)
+        {
+          /* Preserve size and modification time if caller asked us to. */
+          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 */
-                            "isnnnnns",          /* 12 - 19 */
+                            "isnnnnnsss",          /* 12 - 21 */
                             wcroot->wc_id,       /* 1 */
                             local_relpath,       /* 2 */
                             (apr_int64_t)0, /* op_depth is 0 for base */
@@ -831,8 +837,9 @@ insert_base_node(void *baton,
                             pibb->changed_date,   /* 12 */
                             pibb->changed_author, /* 13 */
                             (pibb->kind == svn_wc__db_kind_symlink) ?
-                                pibb->target : NULL)); /* 19 */
-
+                                pibb->target : NULL, /* 19 */
+                            NULL /* 20 */,
+                            moved_to_relpath /* 21 */));
   if (pibb->kind == svn_wc__db_kind_file)
     {
       SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, pibb->checksum,
@@ -2022,7 +2029,7 @@ base_get_info(svn_wc__db_status_t *statu
       SVN_ERR_ASSERT(!repos_relpath || *repos_relpath);
       if (lock)
         {
-          *lock = lock_from_columns(stmt, 15, 16, 17, 18, result_pool);
+          *lock = lock_from_columns(stmt, 16, 17, 18, 19, result_pool);
         }
       if (changed_rev)
         {
@@ -5296,7 +5303,6 @@ op_revert_txn(void *baton,
                                         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__reset(stmt));
     }
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -5325,6 +5331,8 @@ op_revert_recursive_txn(void *baton,
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
   apr_int64_t op_depth;
+  apr_int64_t select_op_depth;
+  svn_boolean_t moved_here;
   int affected_rows;
   apr_pool_t *iterpool;
 
@@ -5356,6 +5364,7 @@ op_revert_recursive_txn(void *baton,
     }
 
   op_depth = svn_sqlite__column_int64(stmt, 0);
+  moved_here = svn_sqlite__column_boolean(stmt, 15);
   SVN_ERR(svn_sqlite__reset(stmt));
 
   if (op_depth > 0 && op_depth != relpath_depth(local_relpath))
@@ -5366,13 +5375,13 @@ op_revert_recursive_txn(void *baton,
                                                     local_relpath,
                                                     scratch_pool));
 
-  if (!op_depth)
-    op_depth = 1; /* Don't delete BASE nodes */
+  /* Don't delete BASE nodes */
+  select_op_depth = op_depth ? op_depth : 1;
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_DELETE_NODES_RECURSIVE));
   SVN_ERR(svn_sqlite__bindf(stmt, "isi", wcroot->wc_id,
-                            local_relpath, op_depth));
+                            local_relpath, select_op_depth));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -5404,21 +5413,32 @@ op_revert_recursive_txn(void *baton,
   while (have_row)
     {
       const char *moved_here_child_relpath;
+      svn_error_t *err;
 
       svn_pool_clear(iterpool);
 
       moved_here_child_relpath = svn_sqlite__column_text(stmt, 0, iterpool);
-      SVN_ERR(clear_moved_to(moved_here_child_relpath, wcroot, iterpool));
+      err = clear_moved_to(moved_here_child_relpath, wcroot, iterpool);
+      if (err)
+        return svn_error_trace(svn_error_compose_create(
+                                        err,
+                                        svn_sqlite__reset(stmt)));
+
       SVN_ERR(svn_sqlite__step(&have_row, stmt));
     }
+  SVN_ERR(svn_sqlite__reset(stmt));
   svn_pool_destroy(iterpool);
 
-  /* Clear any moved-to paths of the BASE nodes. */
+  /* Clear potential moved-to pointing at the target node itself. */
+  if (op_depth > 0 && op_depth == relpath_depth(local_relpath)
+      && 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));
-  SVN_ERR(svn_sqlite__reset(stmt));
 
   return SVN_NO_ERROR;
 }
@@ -5473,7 +5493,6 @@ struct revert_list_read_baton {
   const char **prop_reject;
   svn_boolean_t *copied_here;
   svn_wc__db_kind_t *kind;
-  const svn_checksum_t **pristine_checksum;
   apr_pool_t *result_pool;
 };
 
@@ -5491,7 +5510,6 @@ revert_list_read(void *baton,
   *(b->conflict_new) = *(b->conflict_old) = *(b->conflict_working) = NULL;
   *(b->prop_reject) = NULL;
   *(b->copied_here) = FALSE;
-  *(b->pristine_checksum) = NULL;
   *(b->kind) = svn_wc__db_kind_unknown;
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -5500,9 +5518,10 @@ revert_list_read(void *baton,
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   if (have_row)
     {
-      svn_boolean_t another_row;
+      svn_boolean_t is_actual = (svn_sqlite__column_int64(stmt, 5) != 0);
+      svn_boolean_t another_row = FALSE;
 
-      if (svn_sqlite__column_int64(stmt, 5))
+      if (is_actual)
         {
           if (!svn_sqlite__column_is_null(stmt, 4))
             *(b->reverted) = TRUE;
@@ -5532,18 +5551,9 @@ revert_list_read(void *baton,
                                 b->result_pool);
 
           SVN_ERR(svn_sqlite__step(&another_row, stmt));
-          if (another_row)
-            {
-              *(b->reverted) = TRUE;
-              *(b->kind) = svn_sqlite__column_token(stmt, 8,
-                                                    kind_map);
-              if (!svn_sqlite__column_is_null(stmt, 9))
-                SVN_ERR(svn_sqlite__column_checksum(b->pristine_checksum,
-                                                    stmt, 9,
-                                                    b->result_pool));
-            }
         }
-      else
+
+      if (!is_actual || another_row)
         {
           *(b->reverted) = TRUE;
           if (!svn_sqlite__column_is_null(stmt, 7))
@@ -5552,9 +5562,6 @@ revert_list_read(void *baton,
               *(b->copied_here) = (op_depth == relpath_depth(local_relpath));
             }
           *(b->kind) = svn_sqlite__column_token(stmt, 8, kind_map);
-          if (!svn_sqlite__column_is_null(stmt, 9))
-            SVN_ERR(svn_sqlite__column_checksum(b->pristine_checksum,
-                                                stmt, 9, b->result_pool));
         }
 
     }
@@ -5579,7 +5586,6 @@ svn_wc__db_revert_list_read(svn_boolean_
                             const char **prop_reject,
                             svn_boolean_t *copied_here,
                             svn_wc__db_kind_t *kind,
-                            const svn_checksum_t **pristine_checksum,
                             svn_wc__db_t *db,
                             const char *local_abspath,
                             apr_pool_t *result_pool,
@@ -5589,8 +5595,7 @@ svn_wc__db_revert_list_read(svn_boolean_
   const char *local_relpath;
   struct revert_list_read_baton b = {reverted, conflict_old, conflict_new,
                                      conflict_working, prop_reject,
-                                     copied_here, kind, pristine_checksum,
-                                     result_pool};
+                                     copied_here, kind, result_pool};
 
   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
                               db, local_abspath, scratch_pool, scratch_pool));
@@ -5639,16 +5644,11 @@ revert_list_read_copied_children(void *b
       child_info->abspath = svn_dirent_join(wcroot->abspath, child_relpath,
                                             b->result_pool);
       child_info->kind = svn_sqlite__column_token(stmt, 1, kind_map);
-      if (svn_sqlite__column_is_null(stmt, 2))
-        child_info->pristine_checksum = NULL;
-      else
-        SVN_ERR(svn_sqlite__column_checksum(&child_info->pristine_checksum,
-                                             stmt, 2, b->result_pool));
-       APR_ARRAY_PUSH(
-         children,
-         svn_wc__db_revert_list_copied_child_info_t *) = child_info;
+      APR_ARRAY_PUSH(
+        children,
+        svn_wc__db_revert_list_copied_child_info_t *) = child_info;
 
-       SVN_ERR(svn_sqlite__step(&have_row, stmt));
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
     }
    SVN_ERR(svn_sqlite__reset(stmt));
 
@@ -6196,6 +6196,27 @@ info_below_working(svn_boolean_t *have_b
   return SVN_NO_ERROR;
 }
 
+/* Helper function for op_delete_txn */
+static svn_error_t *
+delete_update_movedto(svn_wc__db_wcroot_t *wcroot,
+                      const char *child_moved_from_relpath,
+                      const char *new_moved_to_relpath,
+                      apr_pool_t *scratch_pool)
+{
+  svn_sqlite__stmt_t *stmt;
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_UPDATE_MOVED_TO_RELPATH));
+
+  SVN_ERR(svn_sqlite__bindf(stmt, "iss",
+                            wcroot->wc_id,
+                            child_moved_from_relpath,
+                            new_moved_to_relpath));
+  SVN_ERR(svn_sqlite__step_done(stmt));
+
+  return SVN_NO_ERROR;
+}
+
 
 struct op_delete_baton_t {
   apr_int64_t delete_depth;  /* op-depth for root of delete */
@@ -6272,7 +6293,6 @@ op_delete_txn(void *baton,
           SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id,
                                     moved_from_relpath, b->moved_to_relpath));
           SVN_ERR(svn_sqlite__step_done(stmt));
-          SVN_ERR(svn_sqlite__reset(stmt));
         }
 
       /* If a subtree is being moved-away, we need to update moved-to
@@ -6337,7 +6357,6 @@ op_delete_txn(void *baton,
                 {
                   const char *child_subtree_relpath;
                   const char *new_moved_to_relpath;
-                  svn_sqlite__stmt_t *moved_to_stmt;
 
                   /* Compute the new moved-to path for this child... */
                   child_subtree_relpath =
@@ -6349,15 +6368,14 @@ op_delete_txn(void *baton,
                     svn_relpath_join(b->moved_to_relpath,
                                      child_subtree_relpath, iterpool);
                   /* ... and update the BASE moved-to record. */
-                  SVN_ERR(svn_sqlite__get_statement(
-                            &moved_to_stmt, wcroot->sdb,
-                            STMT_UPDATE_MOVED_TO_RELPATH));
-                  SVN_ERR(svn_sqlite__bindf(moved_to_stmt, "iss",
-                                            wcroot->wc_id,
-                                            child_moved_from_relpath,
-                                            new_moved_to_relpath));
-                  SVN_ERR(svn_sqlite__step(&have_row, moved_to_stmt));
-                  SVN_ERR(svn_sqlite__reset(moved_to_stmt));
+                  err = delete_update_movedto(wcroot, child_moved_from_relpath,
+                                              new_moved_to_relpath,
+                                              scratch_pool);
+
+                  if (err)
+                    return svn_error_trace(svn_error_compose_create(
+                                                    err,
+                                                    svn_sqlite__reset(stmt)));
                 }
 
               SVN_ERR(svn_sqlite__step(&have_row, stmt));
@@ -6433,13 +6451,6 @@ op_delete_txn(void *baton,
   if (add_work)
     {
       /* Delete the node at LOCAL_RELPATH, and possibly mark it as moved. */
-      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                 STMT_INSERT_DELETE_NODE));
-      SVN_ERR(svn_sqlite__bindf(stmt, "isii",
-                                wcroot->wc_id, local_relpath,
-                                select_depth, b->delete_depth));
-      SVN_ERR(svn_sqlite__step_done(stmt));
-
       if (b->moved_to_relpath)
         {
           /* Record moved-to relpath in BASE. */
@@ -6451,7 +6462,7 @@ op_delete_txn(void *baton,
           SVN_ERR(svn_sqlite__step_done(stmt));
         }
 
-      /* Delete children, if any. */
+      /* Delete the node and possible descendants. */
       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                  STMT_INSERT_DELETE_FROM_NODE_RECURSIVE));
       SVN_ERR(svn_sqlite__bindf(stmt, "isii",
@@ -6796,7 +6807,7 @@ read_info(svn_wc__db_status_t *status,
           if (op_depth != 0)
             *lock = NULL;
           else
-            *lock = lock_from_columns(stmt_info, 15, 16, 17, 18, result_pool);
+            *lock = lock_from_columns(stmt_info, 16, 17, 18, 19, result_pool);
         }
 
       if (have_work)
@@ -10140,16 +10151,30 @@ svn_error_t *
 svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb,
                          apr_int64_t *repos_id,
                          apr_int64_t *wc_id,
+                         svn_wc__db_t *wc_db,
                          const char *dir_abspath,
                          const char *repos_root_url,
                          const char *repos_uuid,
-                         apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool)
 {
-  return svn_error_trace(create_db(sdb, repos_id, wc_id, dir_abspath,
-                                   repos_root_url, repos_uuid,
-                                   SDB_FILE,
-                                   result_pool, scratch_pool));
+  svn_wc__db_wcroot_t *wcroot;
+  SVN_ERR(create_db(sdb, repos_id, wc_id, dir_abspath,
+                    repos_root_url, repos_uuid,
+                    SDB_FILE,
+                    wc_db->state_pool, scratch_pool));
+
+  SVN_ERR(svn_wc__db_pdh_create_wcroot(&wcroot,
+                                       apr_pstrdup(wc_db->state_pool,
+                                                   dir_abspath),
+                                       *sdb, *wc_id, FORMAT_FROM_SDB,
+                                       FALSE /* auto-upgrade */,
+                                       FALSE /* enforce_empty_wq */,
+                                       wc_db->state_pool, scratch_pool));
+
+  /* The WCROOT is complete. Stash it into DB.  */
+  apr_hash_set(wc_db->dir_data, wcroot->abspath, APR_HASH_KEY_STRING, wcroot);
+
+  return SVN_NO_ERROR;
 }
 
 

Modified: subversion/branches/issue-3975/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/libsvn_wc/wc_db.h?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/issue-3975/subversion/libsvn_wc/wc_db.h Tue Aug 23 14:03:12 2011
@@ -1510,9 +1510,6 @@ svn_wc__db_op_revert(svn_wc__db_t *db,
  * Set *COPIED_HERE if the reverted node was copied here and is the
  * operation root of the copy.
  * Set *KIND to the node kind of the reverted node.
- * If the node was a file, set *PRISTINE_CHECKSUM to the checksum
- * of the pristine associated with the node. If the file had no
- * pristine set *PRISTINE_CHECKSUM to NULL.
  *
  * Removes the row for LOCAL_ABSPATH from the revert list.
  */
@@ -1524,7 +1521,6 @@ svn_wc__db_revert_list_read(svn_boolean_
                             const char **prop_reject,
                             svn_boolean_t *copied_here,
                             svn_wc__db_kind_t *kind,
-                            const svn_checksum_t **pristine_checksum,
                             svn_wc__db_t *db,
                             const char *local_abspath,
                             apr_pool_t *result_pool,
@@ -1535,11 +1531,10 @@ svn_wc__db_revert_list_read(svn_boolean_
 typedef struct svn_wc__db_revert_list_copied_child_info_t {
   const char *abspath;
   svn_wc__db_kind_t kind;
-  const svn_checksum_t *pristine_checksum;
 } svn_wc__db_revert_list_copied_child_info_t ;
 
-/* Return in *CHILDREN a list of reverted copied children within the
- * reverted tree rooted at LOCAL_ABSPATH.
+/* Return in *CHILDREN a list of reverted copied nodes at or within
+ * LOCAL_ABSPATH (which is a reverted file or a reverted directory).
  * Allocate *COPIED_CHILDREN and its elements in RESULT_POOL.
  * The elements are of type svn_wc__db_revert_list_copied_child_info_t. */
 svn_error_t *
@@ -2610,14 +2605,20 @@ svn_wc__db_scan_deletion(const char **ba
    @{
 */
 
+/* Create a new wc.db file for LOCAL_DIR_ABSPATH, which is going to be a
+   working copy for the repository REPOS_ROOT_URL with uuid REPOS_UUID.
+   Return the raw sqlite handle, repository id and working copy id
+   and store the database in WC_DB.
+
+   Perform temporary allocations in SCRATCH_POOL. */
 svn_error_t *
 svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb,
                          apr_int64_t *repos_id,
                          apr_int64_t *wc_id,
+                         svn_wc__db_t *wc_db,
                          const char *local_dir_abspath,
                          const char *repos_root_url,
                          const char *repos_uuid,
-                         apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool);
 
 

Modified: subversion/branches/issue-3975/subversion/mod_dav_svn/liveprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/mod_dav_svn/liveprops.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/mod_dav_svn/liveprops.c (original)
+++ subversion/branches/issue-3975/subversion/mod_dav_svn/liveprops.c Tue Aug 23 14:03:12 2011
@@ -483,6 +483,8 @@ insert_prop_internal(const dav_resource 
                    there's no point even checking.  No matter what the
                    error is, we can't claim to have a mime type for
                    this resource. */
+                ap_log_rerror(APLOG_MARK, APLOG_WARNING, serr->apr_err, 
+                              resource->info->r, "%s", serr->message);
                 svn_error_clear(serr);
                 return DAV_PROP_INSERT_NOTDEF;
               }

Modified: subversion/branches/issue-3975/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/mod_dav_svn/mod_dav_svn.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/branches/issue-3975/subversion/mod_dav_svn/mod_dav_svn.c Tue Aug 23 14:03:12 2011
@@ -1000,7 +1000,7 @@ static const command_rec cmds[] =
   /* per server */
   AP_INIT_TAKE1("SVNInMemoryCacheSize", SVNInMemoryCacheSize_cmd, NULL,
                 RSRC_CONF,
-                "specifies the maximum size im kB per process of Subversion's "
+                "specifies the maximum size in kB per process of Subversion's "
                 "in-memory object cache (default value is 16384; 0 deactivates "
                 "the cache)."),
   /* per server */

Modified: subversion/branches/issue-3975/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/svn/main.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/svn/main.c (original)
+++ subversion/branches/issue-3975/subversion/svn/main.c Tue Aug 23 14:03:12 2011
@@ -1006,6 +1006,13 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "  for deletion. If the patch creates a new file, that file is scheduled\n"
      "  for addition. Use 'svn revert' to undo deletions and additions you\n"
      "  do not agree with.\n"
+     "\n"
+     "  Hint: If the patch file was created with Subversion, it will contain\n"
+     "        the number of a revision N the patch will cleanly apply to\n"
+     "        (look for lines like \"--- foo/bar.txt        (revision N)\").\n"
+     "        To avoid rejects, first update to the revision N using \n"
+     "        'svn update -r N', apply the patch, and then update back to the\n"
+     "        HEAD revision. This way, conflicts can be resolved interactively.\n"
      ),
     {'q', opt_dry_run, opt_strip, opt_reverse_diff,
      opt_ignore_whitespace} },
@@ -1936,12 +1943,6 @@ main(int argc, const char *argv[])
         break;
       case opt_changelist:
         opt_state.changelist = apr_pstrdup(pool, opt_arg);
-        if (opt_state.changelist[0] == '\0')
-          {
-            err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                   _("Changelist names must not be empty"));
-            return svn_cmdline_handle_exit_error(err, pool, "svn: ");
-          }
         apr_hash_set(changelists, opt_state.changelist,
                      APR_HASH_KEY_STRING, (void *)1);
         break;

Modified: subversion/branches/issue-3975/subversion/svn/tree-conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/svn/tree-conflicts.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/svn/tree-conflicts.c (original)
+++ subversion/branches/issue-3975/subversion/svn/tree-conflicts.c Tue Aug 23 14:03:12 2011
@@ -62,6 +62,8 @@ static const svn_token_map_t map_conflic
   { N_("add"),          svn_wc_conflict_reason_added },
   { N_("replace"),      svn_wc_conflict_reason_replaced },
   { N_("unversioned"),  svn_wc_conflict_reason_unversioned },
+  { N_("moved away"),   svn_wc_conflict_reason_moved_away },
+  { N_("moved here"),   svn_wc_conflict_reason_moved_here },
   { NULL,               0 }
 };
 
@@ -75,6 +77,8 @@ static const svn_token_map_t map_conflic
   { "add",              svn_wc_conflict_reason_added },
   { "replace",          svn_wc_conflict_reason_replaced },
   { "unversioned",      svn_wc_conflict_reason_unversioned },
+  { "moved-away",       svn_wc_conflict_reason_moved_away },
+  { "moved-here",       svn_wc_conflict_reason_moved_here },
   { NULL,               0 }
 };
 

Modified: subversion/branches/issue-3975/subversion/svndumpfilter/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/svndumpfilter/main.c?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/svndumpfilter/main.c (original)
+++ subversion/branches/issue-3975/subversion/svndumpfilter/main.c Tue Aug 23 14:03:12 2011
@@ -1105,26 +1105,26 @@ do_filter(apr_getopt_t *os,
           SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
                                       do_exclude
                                       ? opt_state->drop_empty_revs
-                                      ? _("Excluding (and dropping empty "
-                                          "revisions for) prefixes:\n")
-                                      : _("Excluding prefixes:\n")
+                                        ? _("Excluding (and dropping empty "
+                                            "revisions for) prefix patterns:\n")
+                                        : _("Excluding prefix patterns:\n")
                                       : opt_state->drop_empty_revs
-                                      ? _("Including (and dropping empty "
-                                          "revisions for) prefixes:\n")
-                                      : _("Including prefixes:\n")));
+                                        ? _("Including (and dropping empty "
+                                            "revisions for) prefix patterns:\n")
+                                        : _("Including prefix patterns:\n")));
         }
       else
         {
           SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
                                       do_exclude
                                       ? opt_state->drop_empty_revs
-                                      ? _("Excluding (and dropping empty "
-                                          "revisions for) prefix patterns:\n")
-                                      : _("Excluding prefix patterns:\n")
+                                        ? _("Excluding (and dropping empty "
+                                            "revisions for) prefixes:\n")
+                                        : _("Excluding prefixes:\n")
                                       : opt_state->drop_empty_revs
-                                      ? _("Including (and dropping empty "
-                                          "revisions for) prefix patterns:\n")
-                                      : _("Including prefix patterns:\n")));
+                                        ? _("Including (and dropping empty "
+                                            "revisions for) prefixes:\n")
+                                        : _("Including prefixes:\n")));
         }
 
       for (i = 0; i < opt_state->prefixes->nelts; i++)

Modified: subversion/branches/issue-3975/subversion/tests/cmdline/changelist_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/changelist_tests.py?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/changelist_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/changelist_tests.py Tue Aug 23 14:03:12 2011
@@ -1190,6 +1190,57 @@ def readd_after_revert(sbox):
   svntest.actions.run_and_verify_svn(None, None, [],
                                      'add', dummy)
 
+def empty_pseudo_changelist(sbox):
+  "the empty pseudo-changelist"
+
+  # Boilerplate.
+  sbox.build(read_only = True)
+  wc_dir = sbox.wc_dir
+
+  # Helper functions.
+
+  def found_nodes(*args):
+    # Extract the Greek-tree-relative paths.
+    return set(map(lambda info: info['Path'][len(wc_dir)+1:],
+                    svntest.actions.run_and_parse_info(*args)))
+
+  def find_nodes(nodeset, *args):
+    assert isinstance(nodeset, set)
+    foundset = found_nodes(*args)
+    nodeset = set(map(lambda path: path.replace('/', os.path.sep), nodeset))
+    if nodeset != foundset:
+      raise svntest.Failure("Expected nodeset %s but found %s"
+                            % (nodeset, foundset))
+
+  # Convenience variables.
+  E_path = sbox.ospath('A/B/E')
+  alpha_path = sbox.ospath('A/B/E/alpha')
+  beta_path = sbox.ospath('A/B/E/beta')
+  iota_path = sbox.ospath('iota')
+
+  # Can't add an item to the empty changelist.
+  expected_err = 'svn: E125014: .*'
+  svntest.actions.run_and_verify_svn(None, [], expected_err,
+                                     'changelist', '', iota_path)
+
+  # Modify alpha and beta
+  svntest.main.file_append(alpha_path, "More stuff in alpha\n")
+  svntest.main.file_append(beta_path, "More stuff in beta\n")
+
+  # Add beta to 'testlist'.
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'changelist', 'testlist', beta_path)
+
+  # Convenience variables.
+  changelist = {
+    'testlist' : set(['A/B/E/beta']),
+    '' : set(['A/B/E', 'A/B/E/alpha']),
+  }
+
+  # Some basic validations.
+  find_nodes(changelist['testlist'] | changelist[''], '-R', E_path)
+  find_nodes(changelist['testlist'], '--cl', 'testlist', '-R', E_path)
+  find_nodes(changelist[''], '--cl', '', '-R', E_path)
 
 ########################################################################
 # Run the tests
@@ -1213,6 +1264,7 @@ test_list = [ None,
               add_remove_non_existent_target,
               add_remove_unversioned_target,
               readd_after_revert,
+              empty_pseudo_changelist,
              ]
 
 if __name__ == '__main__':

Modified: subversion/branches/issue-3975/subversion/tests/cmdline/copy_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/copy_tests.py?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/copy_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/copy_tests.py Tue Aug 23 14:03:12 2011
@@ -955,7 +955,6 @@ def repos_to_wc(sbox):
   svntest.actions.run_and_verify_svn(None, None, [], 'revert', '-R', wc_dir)
 
   svntest.main.safe_rmtree(os.path.join(wc_dir, 'E'))
-  os.unlink(os.path.join(wc_dir, 'pi'))
 
   expected_output = svntest.actions.get_virginal_state(wc_dir, 1)
   svntest.actions.run_and_verify_status(wc_dir, expected_output)

Modified: subversion/branches/issue-3975/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/diff_tests.py?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/diff_tests.py Tue Aug 23 14:03:12 2011
@@ -3184,6 +3184,16 @@ def diff_summarize_xml(sbox):
                         wc_rev=2)
   expected_status.remove("A/B/lambda")
 
+  # 3) Test working copy summarize
+  paths = ['A/mu', 'iota', 'A/D/G/tau', 'newfile', 'A/B/lambda',
+           'newdir',]
+  items = ['modified', 'none', 'modified', 'added', 'deleted', 'added',]
+  kinds = ['file','file','file','file','file', 'dir',]
+  props = ['none', 'modified', 'modified', 'none', 'none', 'none',]
+
+  svntest.actions.run_and_verify_diff_summarize_xml(
+    [], wc_dir, paths, items, props, kinds, wc_dir)
+
   svntest.actions.run_and_verify_commit(wc_dir, expected_output,
                                         expected_status, None, wc_dir)
 
@@ -3197,38 +3207,21 @@ def diff_summarize_xml(sbox):
     ".*No such revision 5555555",
     None, wc_dir, None, None, None, '-r0:5555555', wc_dir)
 
-  # 3) Test working copy summarize
-  svntest.actions.run_and_verify_diff_summarize_xml(
-    ".*Summarizing diff can only compare repository to repository",
-    None, wc_dir, None, None, wc_dir)
-
   # 4) Test --summarize --xml on -c2
-  paths = ['iota',]
-  items = ['none',]
-  kinds = ['file',]
-  props = ['modified',]
+  paths_iota = ['iota',]
+  items_iota = ['none',]
+  kinds_iota = ['file',]
+  props_iota = ['modified',]
 
   svntest.actions.run_and_verify_diff_summarize_xml(
-    [], wc_dir, paths, items, props, kinds, '-c2',
+    [], wc_dir, paths_iota, items_iota, props_iota, kinds_iota, '-c2',
     os.path.join(wc_dir, 'iota'))
 
   # 5) Test --summarize --xml on -r1:2
-  paths = ['A/mu', 'iota', 'A/D/G/tau', 'newfile', 'A/B/lambda',
-           'newdir',]
-  items = ['modified', 'none', 'modified', 'added', 'deleted', 'added',]
-  kinds = ['file','file','file','file','file', 'dir',]
-  props = ['none', 'modified', 'modified', 'none', 'none', 'none',]
-
   svntest.actions.run_and_verify_diff_summarize_xml(
     [], wc_dir, paths, items, props, kinds, '-r1:2', wc_dir)
 
   # 6) Same as test #5 but ran against a URL instead of a WC path
-  paths = ['A/mu', 'iota', 'A/D/G/tau', 'newfile', 'A/B/lambda',
-           'newdir',]
-  items = ['modified', 'none', 'modified', 'added', 'deleted', 'added',]
-  kinds = ['file','file','file','file','file', 'dir',]
-  props = ['none', 'modified', 'modified', 'none', 'none', 'none',]
-
   svntest.actions.run_and_verify_diff_summarize_xml(
     [], sbox.repo_url, paths, items, props, kinds, '-r1:2', sbox.repo_url)
 

Modified: subversion/branches/issue-3975/subversion/tests/cmdline/input_validation_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/input_validation_tests.py?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/input_validation_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/input_validation_tests.py Tue Aug 23 14:03:12 2011
@@ -120,9 +120,6 @@ def invalid_diff_targets(sbox):
   for (target1, target2) in [("iota", "^/"), ("file://", "iota")]:
     run_and_verify_svn_in_wc(sbox, "svn: E205000: Cannot mix repository and working "
                              "copy targets", 'diff', target1, target2)
-  run_and_verify_svn_in_wc(sbox, "svn: E200007: Summarizing diff can only compare "
-                           "repository to repository",
-                           'diff', '--summarize', "iota", "A")
 
 def invalid_export_targets(sbox):
   "invalid targets for 'export'"

Modified: subversion/branches/issue-3975/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/patch_tests.py?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/patch_tests.py Tue Aug 23 14:03:12 2011
@@ -3615,6 +3615,61 @@ def patch_moved_away(sbox):
                                        1, # check-props
                                        1) # dry-run
 
+@XFail()
+@Issue(3991)
+def patch_lacking_trailing_eol(sbox):
+  "patch file lacking trailing eol"
+
+  sbox.build(read_only = True)
+  wc_dir = sbox.wc_dir
+
+  patch_file_path = make_patch_path(sbox)
+  iota_path = os.path.join(wc_dir, 'iota')
+  mu_path = os.path.join(wc_dir, 'A', 'mu')
+
+  # Prepare
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+
+  # Apply patch
+  unidiff_patch = [
+    "Index: iota\n",
+    "===================================================================\n",
+    "--- iota\t(revision 1)\n",
+    "+++ iota\t(working copy)\n",
+    # TODO: -1 +1
+    "@@ -1 +1,2 @@\n",
+    " This is the file 'iota'.\n",
+    "+Some more bytes", # No trailing \n on this line!
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  gamma_contents = "It is the file 'gamma'.\n"
+  iota_contents = "This is the file 'iota'.\n"
+  new_contents = "new\n"
+
+  expected_output = [
+    'U         %s\n' % os.path.join(wc_dir, 'iota'),
+    'svn: W[0-9]+: .*', # warning about appending a newline to iota's last line
+  ]
+
+  # Expect a newline to be appended
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('iota', contents=iota_contents+"Some more bytes\n")
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('iota', status='M ')
+
+  expected_skip = wc.State('', { })
+
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output,
+                                       expected_disk,
+                                       expected_status,
+                                       expected_skip,
+                                       None, # expected err
+                                       1, # check-props
+                                       1) # dry-run
 
 ########################################################################
 #Run the tests
@@ -3652,6 +3707,7 @@ test_list = [ None,
               patch_set_prop_no_eol,
               patch_add_symlink,
               patch_moved_away,
+              patch_lacking_trailing_eol,
             ]
 
 if __name__ == '__main__':

Modified: subversion/branches/issue-3975/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/revert_tests.py?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/revert_tests.py Tue Aug 23 14:03:12 2011
@@ -368,37 +368,52 @@ def revert_replaced_file_without_props(s
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 #----------------------------------------------------------------------
-# Regression test for issue #876:
-# svn revert of an svn move'd file does not revert the file
-@XFail()
+# Note that issue #876 has been rejected. This now basically tests that
+# reverting the delete side of a move does *not* also revert the copy side.
 @Issue(876)
 def revert_moved_file(sbox):
-    "revert a moved file"
+  "revert a moved file"
+
+  # svntest.factory.make(sbox, """svn mv iota iota_moved
+  #                               svn st
+  #                               svn revert iota
+  #                               svn st
+  #                               """)
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  iota = os.path.join(wc_dir, 'iota')
+  iota_moved = os.path.join(wc_dir, 'iota_moved')
+
+  # svn mv iota iota_moved
+  expected_stdout = svntest.verify.UnorderedOutput([
+    'A         ' + iota_moved + '\n',
+    'D         ' + iota + '\n',
+  ])
+
+  actions.run_and_verify_svn2('OUTPUT', expected_stdout, [], 0, 'mv', iota,
+    iota_moved)
+
+  # svn st
+  expected_status = actions.get_virginal_state(wc_dir, 1)
+  expected_status.add({
+    'iota_moved'        : Item(status='A ', copied='+', wc_rev='-'),
+  })
+  expected_status.tweak('iota', status='D ')
+
+  actions.run_and_verify_unquiet_status(wc_dir, expected_status)
+
+  # svn revert iota
+  expected_stdout = ["Reverted '" + iota + "'\n"]
+
+  actions.run_and_verify_svn2('OUTPUT', expected_stdout, [], 0, 'revert',
+    iota)
 
-    sbox.build(read_only = True)
-    wc_dir = sbox.wc_dir
-    iota_path = os.path.join(wc_dir, 'iota')
-    iota_path_moved = os.path.join(wc_dir, 'iota_moved')
-
-    svntest.actions.run_and_verify_svn(None, None, [], 'mv', iota_path,
-                                        iota_path_moved)
-    expected_output = svntest.actions.get_virginal_state(wc_dir, 1)
-    expected_output.tweak('iota', status='D ')
-    expected_output.add({
-      'iota_moved' : Item(status='A ', copied='+', wc_rev='-'),
-    })
-    svntest.actions.run_and_verify_status(wc_dir, expected_output)
-
-    # now revert the file iota
-    svntest.actions.run_and_verify_svn(None,
-      ["Reverted '" + iota_path + "'\n"], [], 'revert', iota_path)
-
-    # at this point, svn status on iota_path_moved should return nothing
-    # since it should disappear on reverting the move, and since svn status
-    # on a non-existent file returns nothing.
+  # svn st
+  expected_status.tweak('iota', status='  ')
 
-    svntest.actions.run_and_verify_svn(None, [], [],
-                                      'status', '-v', iota_path_moved)
+  actions.run_and_verify_unquiet_status(wc_dir, expected_status)
 
 
 #----------------------------------------------------------------------
@@ -971,8 +986,7 @@ def revert_tree_conflicts_in_updated_fil
   expected_status.remove('A/D/G/tau')
 
   expected_disk = svntest.main.greek_state.copy()
-  expected_disk.tweak('A/D/G/rho',
-                      contents="This is the file 'rho'.\nLocal edit.\n")
+  expected_disk.remove('A/D/G/rho')
   expected_disk.tweak('A/D/G/pi',
                       contents="This is the file 'pi'.\nIncoming edit.\n")
   expected_disk.remove('A/D/G/tau')

Modified: subversion/branches/issue-3975/subversion/tests/cmdline/svndumpfilter_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/svndumpfilter_tests.py?rev=1160699&r1=1160698&r2=1160699&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/svndumpfilter_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/svndumpfilter_tests.py Tue Aug 23 14:03:12 2011
@@ -439,7 +439,7 @@ def filter_mergeinfo_revs_outside_of_dum
   # Check that all the blather above really happens.  First does
   # svndumpfilter report what we expect to stderr?
   expected_err = [
-      "Excluding (and dropping empty revisions for) prefix patterns:\n",
+      "Excluding (and dropping empty revisions for) prefixes:\n",
       "   '/branches/B2'\n",
       "\n",
       "Revision 6 committed as 6.\n",



Mime
View raw message