You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/10/11 21:52:46 UTC

svn commit: r1182053 [16/30] - in /subversion/branches/svn_mutex: ./ build/ build/ac-macros/ build/generator/ build/generator/swig/ build/generator/templates/ contrib/client-side/ contrib/hook-scripts/enforcer/ contrib/server-side/ notes/ notes/merge-t...

Modified: subversion/branches/svn_mutex/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn_mutex/subversion/libsvn_wc/adm_ops.c?rev=1182053&r1=1182052&r2=1182053&view=diff
==============================================================================
--- subversion/branches/svn_mutex/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/branches/svn_mutex/subversion/libsvn_wc/adm_ops.c Tue Oct 11 19:52:34 2011
@@ -29,6 +29,7 @@
 
 
 #include <string.h>
+#include <stdlib.h>
 
 #include <apr_pools.h>
 #include <apr_tables.h>
@@ -122,7 +123,7 @@ process_committed_leaf(svn_wc__db_t *db,
                        apr_pool_t *scratch_pool)
 {
   svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   const svn_checksum_t *copied_checksum;
   svn_revnum_t new_changed_rev = new_revnum;
   svn_boolean_t have_base;
@@ -144,7 +145,7 @@ process_committed_leaf(svn_wc__db_t *db,
   {
     const char *adm_abspath;
 
-    if (kind == svn_wc__db_kind_dir)
+    if (kind == svn_kind_dir)
       adm_abspath = local_abspath;
     else
       adm_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
@@ -175,7 +176,7 @@ process_committed_leaf(svn_wc__db_t *db,
   SVN_ERR_ASSERT(status == svn_wc__db_status_normal
                  || status == svn_wc__db_status_added);
 
-  if (kind != svn_wc__db_kind_dir)
+  if (kind != svn_kind_dir)
     {
       /* If we sent a delta (meaning: post-copy modification),
          then this file will appear in the queue and so we should have
@@ -248,7 +249,7 @@ svn_wc__process_committed_internal(svn_w
                                    const svn_wc_committed_queue_t *queue,
                                    apr_pool_t *scratch_pool)
 {
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
 
   /* NOTE: be wary of making crazy semantic changes in this function, since
      svn_wc_process_committed4() calls this.  */
@@ -264,7 +265,7 @@ svn_wc__process_committed_internal(svn_w
      have been deleted */
   SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath, TRUE, scratch_pool));
 
-  if (recurse && kind == svn_wc__db_kind_dir)
+  if (recurse && kind == svn_kind_dir)
     {
       const apr_array_header_t *children;
       apr_pool_t *iterpool = svn_pool_create(scratch_pool);
@@ -300,7 +301,7 @@ svn_wc__process_committed_internal(svn_w
             continue;
 
           sha1_checksum = NULL;
-          if (kind != svn_wc__db_kind_dir && queue != NULL)
+          if (kind != svn_kind_dir && queue != NULL)
             {
               const committed_queue_item_t *cqi;
 
@@ -595,21 +596,22 @@ erase_unversioned_from_wc(const char *pa
 
 
 svn_error_t *
-svn_wc_delete4(svn_wc_context_t *wc_ctx,
-               const char *local_abspath,
-               svn_boolean_t keep_local,
-               svn_boolean_t delete_unversioned_target,
-               svn_cancel_func_t cancel_func,
-               void *cancel_baton,
-               svn_wc_notify_func2_t notify_func,
-               void *notify_baton,
-               apr_pool_t *scratch_pool)
+svn_wc__delete_internal(svn_wc_context_t *wc_ctx,
+                        const char *local_abspath,
+                        svn_boolean_t keep_local,
+                        svn_boolean_t delete_unversioned_target,
+                        const char *moved_to_abspath,
+                        svn_cancel_func_t cancel_func,
+                        void *cancel_baton,
+                        svn_wc_notify_func2_t notify_func,
+                        void *notify_baton,
+                        apr_pool_t *scratch_pool)
 {
   apr_pool_t *pool = scratch_pool;
   svn_wc__db_t *db = wc_ctx->db;
   svn_error_t *err;
   svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   svn_boolean_t conflicted;
   const apr_array_header_t *conflicts;
 
@@ -648,7 +650,7 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
     }
 
   if (status == svn_wc__db_status_normal
-      && kind == svn_wc__db_kind_dir)
+      && kind == svn_kind_dir)
     {
       svn_boolean_t is_wcroot;
       SVN_ERR(svn_wc__db_is_wcroot(&is_wcroot, db, local_abspath, pool));
@@ -670,7 +672,7 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
     SVN_ERR(svn_wc__db_read_conflicts(&conflicts, db, local_abspath,
                                       scratch_pool, scratch_pool));
 
-  SVN_ERR(svn_wc__db_op_delete(db, local_abspath,
+  SVN_ERR(svn_wc__db_op_delete(db, local_abspath, moved_to_abspath,
                                notify_func, notify_baton,
                                cancel_func, cancel_baton,
                                pool));
@@ -726,6 +728,26 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_wc_delete4(svn_wc_context_t *wc_ctx,
+               const char *local_abspath,
+               svn_boolean_t keep_local,
+               svn_boolean_t delete_unversioned_target,
+               svn_cancel_func_t cancel_func,
+               void *cancel_baton,
+               svn_wc_notify_func2_t notify_func,
+               void *notify_baton,
+               apr_pool_t *scratch_pool)
+{
+  return svn_error_trace(svn_wc__delete_internal(wc_ctx, local_abspath,
+                                                 keep_local,
+                                                 delete_unversioned_target,
+                                                 NULL,
+                                                 cancel_func, cancel_baton,
+                                                 notify_func, notify_baton,
+                                                 scratch_pool));
+}
+
 
 /* Schedule the single node at LOCAL_ABSPATH, of kind KIND, for addition in
  * its parent directory in the WC.  It will have no properties. */
@@ -766,7 +788,7 @@ check_can_add_to_parent(const char **rep
 {
   const char *parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
   svn_wc__db_status_t parent_status;
-  svn_wc__db_kind_t parent_kind;
+  svn_kind_t parent_kind;
   svn_error_t *err;
 
   SVN_ERR(svn_wc__write_check(db, parent_abspath, scratch_pool));
@@ -799,7 +821,7 @@ check_can_add_to_parent(const char **rep
                           svn_dirent_local_style(local_abspath,
                                                  scratch_pool));
     }
-  else if (parent_kind != svn_wc__db_kind_dir)
+  else if (parent_kind != svn_kind_dir)
     return svn_error_createf(SVN_ERR_NODE_UNEXPECTED_KIND, NULL,
                              _("Can't schedule an addition of '%s'"
                                " below a not-directory node"),
@@ -813,7 +835,7 @@ check_can_add_to_parent(const char **rep
       if (parent_status == svn_wc__db_status_added)
         SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL,
                                          repos_root_url, repos_uuid, NULL,
-                                         NULL, NULL, NULL,
+                                         NULL, NULL, NULL, NULL, NULL,
                                          db, parent_abspath,
                                          result_pool, scratch_pool));
       else
@@ -1270,6 +1292,136 @@ remove_conflict_file(svn_boolean_t *noti
 }
 
 
+/* Sort copied children obtained from the revert list based on
+ * their paths in descending order (longest paths first). */
+static int
+compare_revert_list_copied_children(const void *a, const void *b)
+{
+  const svn_wc__db_revert_list_copied_child_info_t *ca = a;
+  const svn_wc__db_revert_list_copied_child_info_t *cb = b;
+  int i;
+
+  i = svn_path_compare_paths(ca->abspath, cb->abspath);
+
+  /* Reverse the result of svn_path_compare_paths() to achieve
+   * descending order. */
+  return -i;
+}
+
+
+/* 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).
+ *
+ * If REMOVED_SELF is not NULL, indicate in *REMOVED_SELF whether
+ * LOCAL_ABSPATH itself was removed.
+ *
+ * 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_boolean_t *removed_self,
+                                  svn_wc__db_t *db,
+                                  const char *local_abspath,
+                                  svn_boolean_t remove_self,
+                                  svn_cancel_func_t cancel_func,
+                                  void *cancel_baton,
+                                  apr_pool_t *scratch_pool)
+{
+  const apr_array_header_t *copied_children;
+  svn_wc__db_revert_list_copied_child_info_t *child_info;
+  int i;
+  svn_node_kind_t on_disk;
+  apr_pool_t *iterpool;
+  svn_error_t *err;
+
+  if (removed_self)
+    *removed_self = FALSE;
+
+  SVN_ERR(svn_wc__db_revert_list_read_copied_children(&copied_children,
+                                                      db, local_abspath,
+                                                      scratch_pool,
+                                                      scratch_pool));
+  iterpool = svn_pool_create(scratch_pool);
+
+  /* Remove all copied file children. */
+  for (i = 0; i < copied_children->nelts; i++)
+    {
+      child_info = APR_ARRAY_IDX(
+                     copied_children, i,
+                     svn_wc__db_revert_list_copied_child_info_t *);
+
+      if (cancel_func)
+        SVN_ERR(cancel_func(cancel_baton));
+
+      if (child_info->kind != svn_kind_file)
+        continue;
+
+      svn_pool_clear(iterpool);
+
+      /* 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(svn_io_remove_file2(child_info->abspath, TRUE, iterpool));
+    }
+
+  /* Delete every empty child directory.
+   * We cannot delete children recursively since we want to keep any files
+   * 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);
+  for (i = 0; i < copied_children->nelts; i++)
+    {
+      child_info = APR_ARRAY_IDX(
+                     copied_children, i,
+                     svn_wc__db_revert_list_copied_child_info_t *);
+
+      if (cancel_func)
+        SVN_ERR(cancel_func(cancel_baton));
+
+      if (child_info->kind != svn_kind_dir)
+        continue;
+
+      svn_pool_clear(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)
+    {
+      /* Delete LOCAL_ABSPATH itself if no children are left. */
+      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);
+
+  return SVN_NO_ERROR;
+}
+
+
 /* Make the working tree under LOCAL_ABSPATH to depth DEPTH match the
    versioned tree.  This function is called after svn_wc__db_op_revert
    has done the database revert and created the revert list.  Notifies
@@ -1287,7 +1439,7 @@ revert_restore(svn_wc__db_t *db,
 {
   svn_error_t *err;
   svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   svn_node_kind_t on_disk;
   svn_boolean_t notify_required;
   const char *conflict_old;
@@ -1300,6 +1452,8 @@ revert_restore(svn_wc__db_t *db,
 #ifdef HAVE_SYMLINK
   svn_boolean_t special;
 #endif
+  svn_boolean_t copied_here;
+  svn_kind_t reverted_kind;
 
   if (cancel_func)
     SVN_ERR(cancel_func(cancel_baton));
@@ -1307,6 +1461,7 @@ revert_restore(svn_wc__db_t *db,
   SVN_ERR(svn_wc__db_revert_list_read(&notify_required,
                                       &conflict_old, &conflict_new,
                                       &conflict_working, &prop_reject,
+                                      &copied_here, &reverted_kind,
                                       db, local_abspath,
                                       scratch_pool, scratch_pool));
 
@@ -1321,17 +1476,31 @@ revert_restore(svn_wc__db_t *db,
     {
       svn_error_clear(err);
 
-      if (notify_func && notify_required)
-        notify_func(notify_baton,
-                    svn_wc_create_notify(local_abspath, svn_wc_notify_revert,
-                                         scratch_pool),
-                    scratch_pool);
-
-      if (notify_func)
-        SVN_ERR(svn_wc__db_revert_list_notify(notify_func, notify_baton,
-                                              db, local_abspath,
-                                              scratch_pool));
-      return SVN_NO_ERROR;
+      if (!copied_here)
+        {
+          if (notify_func && notify_required)
+            notify_func(notify_baton,
+                        svn_wc_create_notify(local_abspath,
+                                             svn_wc_notify_revert,
+                                             scratch_pool),
+                        scratch_pool);
+
+          if (notify_func)
+            SVN_ERR(svn_wc__db_revert_list_notify(notify_func, notify_baton,
+                                                  db, local_abspath,
+                                                  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_kind_unknown;
+          recorded_size = SVN_INVALID_FILESIZE;
+          recorded_mod_time = 0;
+        }
     }
   else if (err)
     return svn_error_trace(err);
@@ -1366,6 +1535,27 @@ revert_restore(svn_wc__db_t *db,
 #endif
     }
 
+  if (copied_here)
+    {
+      /* The revert target itself is the op-root of a copy. */
+      if (reverted_kind == svn_kind_file && on_disk == svn_node_file)
+        {
+          SVN_ERR(svn_io_remove_file2(local_abspath, TRUE, scratch_pool));
+          on_disk = svn_node_none;
+        }
+      else if (reverted_kind == svn_kind_dir && on_disk == svn_node_dir)
+        {
+          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
      item on disk matches the versioned item, if it doesn't match then
      fix it or delete it.  */
@@ -1375,13 +1565,13 @@ revert_restore(svn_wc__db_t *db,
       && status != svn_wc__db_status_excluded
       && status != svn_wc__db_status_not_present)
     {
-      if (on_disk == svn_node_dir && kind != svn_wc__db_kind_dir)
+      if (on_disk == svn_node_dir && kind != svn_kind_dir)
         {
           SVN_ERR(svn_io_remove_dir2(local_abspath, FALSE,
                                      cancel_func, cancel_baton, scratch_pool));
           on_disk = svn_node_none;
         }
-      else if (on_disk == svn_node_file && kind != svn_wc__db_kind_file)
+      else if (on_disk == svn_node_file && kind != svn_kind_file)
         {
           SVN_ERR(svn_io_remove_file2(local_abspath, FALSE, scratch_pool));
           on_disk = svn_node_none;
@@ -1389,8 +1579,6 @@ revert_restore(svn_wc__db_t *db,
       else if (on_disk == svn_node_file)
         {
           svn_boolean_t modified;
-          svn_boolean_t executable;
-          svn_boolean_t read_only;
           apr_hash_t *props;
 #ifdef HAVE_SYMLINK
           svn_string_t *special_prop;
@@ -1438,11 +1626,6 @@ revert_restore(svn_wc__db_t *db,
                                                          db, local_abspath,
                                                          TRUE, scratch_pool));
 
-              SVN_ERR(svn_io__is_finfo_executable(&executable, &finfo,
-                                                  scratch_pool));
-              SVN_ERR(svn_io__is_finfo_read_only(&read_only, &finfo,
-                                                 scratch_pool));
-
               if (modified)
                 {
                   SVN_ERR(svn_io_remove_file2(local_abspath, FALSE,
@@ -1451,10 +1634,12 @@ revert_restore(svn_wc__db_t *db,
                 }
               else
                 {
+                  svn_boolean_t read_only;
                   svn_string_t *needs_lock_prop;
-#if !defined(WIN32) && !defined(__OS2__)
-                  svn_string_t *executable_prop;
-#endif
+
+                  SVN_ERR(svn_io__is_finfo_read_only(&read_only, &finfo,
+                                                     scratch_pool));
+
                   needs_lock_prop = apr_hash_get(props, SVN_PROP_NEEDS_LOCK,
                                                  APR_HASH_KEY_STRING);
                   if (needs_lock_prop && !read_only)
@@ -1471,19 +1656,31 @@ revert_restore(svn_wc__db_t *db,
                     }
 
 #if !defined(WIN32) && !defined(__OS2__)
-                  executable_prop = apr_hash_get(props, SVN_PROP_EXECUTABLE,
-                                                 APR_HASH_KEY_STRING);
-                  if (executable_prop && !executable)
-                    {
-                      SVN_ERR(svn_io_set_file_executable(local_abspath, TRUE,
-                                                         FALSE, scratch_pool));
-                      notify_required = TRUE;
-                    }
-                  else if (!executable_prop && executable)
+#ifdef HAVE_SYMLINK
+                  if (!special)
+#endif
                     {
-                      SVN_ERR(svn_io_set_file_executable(local_abspath, FALSE,
-                                                         FALSE, scratch_pool));
-                      notify_required = TRUE;
+                      svn_boolean_t executable;
+                      svn_string_t *executable_prop;
+
+                      SVN_ERR(svn_io__is_finfo_executable(&executable, &finfo,
+                                                          scratch_pool));
+                      executable_prop = apr_hash_get(props, SVN_PROP_EXECUTABLE,
+                                                     APR_HASH_KEY_STRING);
+                      if (executable_prop && !executable)
+                        {
+                          SVN_ERR(svn_io_set_file_executable(local_abspath,
+                                                             TRUE, FALSE,
+                                                             scratch_pool));
+                          notify_required = TRUE;
+                        }
+                      else if (!executable_prop && executable)
+                        {
+                          SVN_ERR(svn_io_set_file_executable(local_abspath,
+                                                             FALSE, FALSE,
+                                                             scratch_pool));
+                          notify_required = TRUE;
+                        }
                     }
 #endif
                 }
@@ -1499,10 +1696,10 @@ revert_restore(svn_wc__db_t *db,
       && status != svn_wc__db_status_excluded
       && status != svn_wc__db_status_not_present)
     {
-      if (kind == svn_wc__db_kind_dir)
+      if (kind == svn_kind_dir)
         SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
 
-      if (kind == svn_wc__db_kind_file)
+      if (kind == svn_kind_file)
         {
           svn_skel_t *work_item;
 
@@ -1533,12 +1730,16 @@ revert_restore(svn_wc__db_t *db,
                                      scratch_pool),
                 scratch_pool);
 
-  if (depth == svn_depth_infinity && kind == svn_wc__db_kind_dir)
+  if (depth == svn_depth_infinity && kind == svn_kind_dir)
     {
       apr_pool_t *iterpool = svn_pool_create(scratch_pool);
       const apr_array_header_t *children;
       int i;
 
+      SVN_ERR(revert_restore_handle_copied_dirs(NULL, db, local_abspath, FALSE,
+                                                cancel_func, cancel_baton,
+                                                iterpool));
+
       SVN_ERR(svn_wc__db_read_children_of_working_node(&children, db,
                                                        local_abspath,
                                                        scratch_pool,
@@ -1574,15 +1775,15 @@ revert_restore(svn_wc__db_t *db,
 /* Revert tree LOCAL_ABSPATH to depth DEPTH and notify for all
    reverts. */
 static svn_error_t *
-new_revert_internal(svn_wc__db_t *db,
-                    const char *local_abspath,
-                    svn_depth_t depth,
-                    svn_boolean_t use_commit_times,
-                    svn_cancel_func_t cancel_func,
-                    void *cancel_baton,
-                    svn_wc_notify_func2_t notify_func,
-                    void *notify_baton,
-                    apr_pool_t *scratch_pool)
+revert_internal(svn_wc__db_t *db,
+                const char *local_abspath,
+                svn_depth_t depth,
+                svn_boolean_t use_commit_times,
+                svn_cancel_func_t cancel_func,
+                void *cancel_baton,
+                svn_wc_notify_func2_t notify_func,
+                void *notify_baton,
+                apr_pool_t *scratch_pool)
 {
   svn_error_t *err;
 
@@ -1624,16 +1825,16 @@ new_revert_internal(svn_wc__db_t *db,
 /* Revert files in LOCAL_ABSPATH to depth DEPTH that match
    CHANGELIST_HASH and notify for all reverts. */
 static svn_error_t *
-new_revert_changelist(svn_wc__db_t *db,
-                      const char *local_abspath,
-                      svn_depth_t depth,
-                      svn_boolean_t use_commit_times,
-                      apr_hash_t *changelist_hash,
-                      svn_cancel_func_t cancel_func,
-                      void *cancel_baton,
-                      svn_wc_notify_func2_t notify_func,
-                      void *notify_baton,
-                      apr_pool_t *scratch_pool)
+revert_changelist(svn_wc__db_t *db,
+                  const char *local_abspath,
+                  svn_depth_t depth,
+                  svn_boolean_t use_commit_times,
+                  apr_hash_t *changelist_hash,
+                  svn_cancel_func_t cancel_func,
+                  void *cancel_baton,
+                  svn_wc_notify_func2_t notify_func,
+                  void *notify_baton,
+                  apr_pool_t *scratch_pool)
 {
   apr_pool_t *iterpool;
   const apr_array_header_t *children;
@@ -1645,11 +1846,11 @@ new_revert_changelist(svn_wc__db_t *db,
   /* Revert this node (depth=empty) if it matches one of the changelists.  */
   if (svn_wc__internal_changelist_match(db, local_abspath, changelist_hash,
                                         scratch_pool))
-    SVN_ERR(new_revert_internal(db, local_abspath,
-                                svn_depth_empty, use_commit_times,
-                                cancel_func, cancel_baton,
-                                notify_func, notify_baton,
-                                scratch_pool));
+    SVN_ERR(revert_internal(db, local_abspath,
+                            svn_depth_empty, use_commit_times,
+                            cancel_func, cancel_baton,
+                            notify_func, notify_baton,
+                            scratch_pool));
 
   if (depth == svn_depth_empty)
     return SVN_NO_ERROR;
@@ -1679,11 +1880,11 @@ new_revert_changelist(svn_wc__db_t *db,
                                                     const char *),
                                       iterpool);
 
-      SVN_ERR(new_revert_changelist(db, child_abspath, depth,
-                                    use_commit_times, changelist_hash,
-                                    cancel_func, cancel_baton,
-                                    notify_func, notify_baton,
-                                    iterpool));
+      SVN_ERR(revert_changelist(db, child_abspath, depth,
+                                use_commit_times, changelist_hash,
+                                cancel_func, cancel_baton,
+                                notify_func, notify_baton,
+                                iterpool));
     }
 
   svn_pool_destroy(iterpool);
@@ -1701,15 +1902,15 @@ new_revert_changelist(svn_wc__db_t *db,
    ### the non-recursive revert on the dir will fail.  Not sure how a
    ### partially recursive revert should handle actual-only nodes. */
 static svn_error_t *
-new_revert_partial(svn_wc__db_t *db,
-                   const char *local_abspath,
-                   svn_depth_t depth,
-                   svn_boolean_t use_commit_times,
-                   svn_cancel_func_t cancel_func,
-                   void *cancel_baton,
-                   svn_wc_notify_func2_t notify_func,
-                   void *notify_baton,
-                   apr_pool_t *scratch_pool)
+revert_partial(svn_wc__db_t *db,
+               const char *local_abspath,
+               svn_depth_t depth,
+               svn_boolean_t use_commit_times,
+               svn_cancel_func_t cancel_func,
+               void *cancel_baton,
+               svn_wc_notify_func2_t notify_func,
+               void *notify_baton,
+               apr_pool_t *scratch_pool)
 {
   apr_pool_t *iterpool;
   const apr_array_header_t *children;
@@ -1724,9 +1925,9 @@ new_revert_partial(svn_wc__db_t *db,
 
   /* Revert the root node itself (depth=empty), then move on to the
      children.  */
-  SVN_ERR(new_revert_internal(db, local_abspath, svn_depth_empty,
-                              use_commit_times, cancel_func, cancel_baton,
-                              notify_func, notify_baton, iterpool));
+  SVN_ERR(revert_internal(db, local_abspath, svn_depth_empty,
+                          use_commit_times, cancel_func, cancel_baton,
+                          notify_func, notify_baton, iterpool));
 
   SVN_ERR(svn_wc__db_read_children_of_working_node(&children, db,
                                                    local_abspath,
@@ -1745,20 +1946,20 @@ new_revert_partial(svn_wc__db_t *db,
       /* For svn_depth_files: don't revert non-files.  */
       if (depth == svn_depth_files)
         {
-          svn_wc__db_kind_t kind;
+          svn_kind_t kind;
 
           SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath, TRUE,
                                        iterpool));
-          if (kind != svn_wc__db_kind_file)
+          if (kind != svn_kind_file)
             continue;
         }
 
       /* Revert just this node (depth=empty).  */
-      SVN_ERR(new_revert_internal(db, child_abspath,
-                                  svn_depth_empty, use_commit_times,
-                                  cancel_func, cancel_baton,
-                                  notify_func, notify_baton,
-                                  iterpool));
+      SVN_ERR(revert_internal(db, child_abspath,
+                              svn_depth_empty, use_commit_times,
+                              cancel_func, cancel_baton,
+                              notify_func, notify_baton,
+                              iterpool));
     }
 
   svn_pool_destroy(iterpool);
@@ -1785,20 +1986,20 @@ svn_wc_revert4(svn_wc_context_t *wc_ctx,
 
       SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelist_filter,
                                          scratch_pool));
-      return svn_error_trace(new_revert_changelist(wc_ctx->db, local_abspath,
-                                                   depth, use_commit_times,
-                                                   changelist_hash,
-                                                   cancel_func, cancel_baton,
-                                                   notify_func, notify_baton,
-                                                   scratch_pool));
-    }
-
-  if (depth == svn_depth_empty || depth == svn_depth_infinity)
-    return svn_error_trace(new_revert_internal(wc_ctx->db, local_abspath,
+      return svn_error_trace(revert_changelist(wc_ctx->db, local_abspath,
                                                depth, use_commit_times,
+                                               changelist_hash,
                                                cancel_func, cancel_baton,
                                                notify_func, notify_baton,
                                                scratch_pool));
+    }
+
+  if (depth == svn_depth_empty || depth == svn_depth_infinity)
+    return svn_error_trace(revert_internal(wc_ctx->db, local_abspath,
+                                           depth, use_commit_times,
+                                           cancel_func, cancel_baton,
+                                           notify_func, notify_baton,
+                                           scratch_pool));
 
   /* The user may expect svn_depth_files/svn_depth_immediates to work
      on copied dirs with one level of children.  It doesn't, the user
@@ -1807,11 +2008,11 @@ svn_wc_revert4(svn_wc_context_t *wc_ctx,
      revert too much we could invoke the recursive call above. */
 
   if (depth == svn_depth_files || depth == svn_depth_immediates)
-    return svn_error_trace(new_revert_partial(wc_ctx->db, local_abspath,
-                                              depth, use_commit_times,
-                                              cancel_func, cancel_baton,
-                                              notify_func, notify_baton,
-                                              scratch_pool));
+    return svn_error_trace(revert_partial(wc_ctx->db, local_abspath,
+                                          depth, use_commit_times,
+                                          cancel_func, cancel_baton,
+                                          notify_func, notify_baton,
+                                          scratch_pool));
 
   /* Bogus depth. Tell the caller.  */
   return svn_error_create(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL, NULL);
@@ -1891,7 +2092,7 @@ svn_wc__internal_remove_from_revision_co
   svn_error_t *err;
   svn_boolean_t left_something = FALSE;
   svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
 
   /* ### This whole function should be rewritten to run inside a transaction,
      ### to allow a stable cancel behavior.
@@ -1915,7 +2116,7 @@ svn_wc__internal_remove_from_revision_co
                                NULL, NULL, NULL, NULL,
                                db, local_abspath, scratch_pool, scratch_pool));
 
-  if (kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_symlink)
+  if (kind == svn_kind_file || kind == svn_kind_symlink)
     {
       svn_boolean_t text_modified_p = FALSE;
 
@@ -1939,7 +2140,7 @@ svn_wc__internal_remove_from_revision_co
       /* Remove NAME from DB */
       SVN_ERR(svn_wc__db_op_remove_node(db, local_abspath,
                                         SVN_INVALID_REVNUM,
-                                        svn_wc__db_kind_unknown,
+                                        svn_kind_unknown,
                                         scratch_pool));
 
       /* If we were asked to destroy the working file, do so unless
@@ -1971,7 +2172,7 @@ svn_wc__internal_remove_from_revision_co
           const char *node_name = APR_ARRAY_IDX(children, i, const char*);
           const char *node_abspath;
           svn_wc__db_status_t node_status;
-          svn_wc__db_kind_t node_kind;
+          svn_kind_t node_kind;
 
           svn_pool_clear(iterpool);
 
@@ -1986,7 +2187,7 @@ svn_wc__internal_remove_from_revision_co
                                        iterpool, iterpool));
 
           if (node_status == svn_wc__db_status_normal
-              && node_kind == svn_wc__db_kind_dir)
+              && node_kind == svn_kind_dir)
             {
               svn_boolean_t is_root;
 
@@ -2005,7 +2206,7 @@ svn_wc__internal_remove_from_revision_co
                  versioned nodes */
               SVN_ERR(svn_wc__db_op_remove_node(db, node_abspath,
                                                 SVN_INVALID_REVNUM,
-                                                svn_wc__db_kind_unknown,
+                                                svn_kind_unknown,
                                                 iterpool));
 
               continue;
@@ -2049,7 +2250,7 @@ svn_wc__internal_remove_from_revision_co
           {
             SVN_ERR(svn_wc__db_op_remove_node(db, local_abspath,
                                               SVN_INVALID_REVNUM,
-                                              svn_wc__db_kind_unknown,
+                                              svn_kind_unknown,
                                               iterpool));
           }
         else
@@ -2299,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/svn_mutex/subversion/libsvn_wc/ambient_depth_filter_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn_mutex/subversion/libsvn_wc/ambient_depth_filter_editor.c?rev=1182053&r1=1182052&r2=1182053&view=diff
==============================================================================
--- subversion/branches/svn_mutex/subversion/libsvn_wc/ambient_depth_filter_editor.c (original)
+++ subversion/branches/svn_mutex/subversion/libsvn_wc/ambient_depth_filter_editor.c Tue Oct 11 19:52:34 2011
@@ -117,7 +117,7 @@ struct dir_baton
    obtaining information for the ambient depth editor */
 static svn_error_t *
 ambient_read_info(svn_wc__db_status_t *status,
-                  svn_wc__db_kind_t *kind,
+                  svn_kind_t *kind,
                   svn_depth_t *depth,
                   svn_wc__db_t *db,
                   const char *local_abspath,
@@ -136,7 +136,7 @@ ambient_read_info(svn_wc__db_status_t *s
     {
       svn_error_clear(err);
 
-      *kind = svn_wc__db_kind_unknown;
+      *kind = svn_kind_unknown;
       if (status)
         *status = svn_wc__db_status_normal;
       if (depth)
@@ -186,7 +186,7 @@ make_dir_baton(struct dir_baton **d_p,
     {
       svn_boolean_t exclude;
       svn_wc__db_status_t status;
-      svn_wc__db_kind_t kind;
+      svn_kind_t kind;
       svn_boolean_t exists = TRUE;
 
       if (!added)
@@ -197,10 +197,10 @@ make_dir_baton(struct dir_baton **d_p,
       else
         {
           status = svn_wc__db_status_not_present;
-          kind = svn_wc__db_kind_unknown;
+          kind = svn_kind_unknown;
         }
 
-      exists = (kind != svn_wc__db_kind_unknown);
+      exists = (kind != svn_kind_unknown);
 
       if (pb->ambient_depth == svn_depth_empty
           || pb->ambient_depth == svn_depth_files)
@@ -246,7 +246,7 @@ make_file_baton(struct file_baton **f_p,
   struct file_baton *f = apr_pcalloc(pool, sizeof(*f));
   struct edit_baton *eb = pb->edit_baton;
   svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   const char *abspath;
 
   SVN_ERR_ASSERT(path);
@@ -268,7 +268,7 @@ make_file_baton(struct file_baton **f_p,
   else
     {
       status = svn_wc__db_status_not_present;
-      kind = svn_wc__db_kind_unknown;
+      kind = svn_kind_unknown;
     }
 
   if (pb->ambient_depth == svn_depth_empty)
@@ -281,7 +281,7 @@ make_file_baton(struct file_baton **f_p,
       if (status == svn_wc__db_status_not_present
           || status == svn_wc__db_status_server_excluded
           || status == svn_wc__db_status_excluded
-          || kind == svn_wc__db_kind_unknown)
+          || kind == svn_kind_unknown)
         {
           f->ambiently_excluded = TRUE;
           *f_p = f;
@@ -308,7 +308,7 @@ make_file_baton(struct file_baton **f_p,
 
 /*** Editor Functions ***/
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 set_target_revision(void *edit_baton,
                     svn_revnum_t target_revision,
@@ -321,7 +321,7 @@ set_target_revision(void *edit_baton,
                                                 target_revision, pool);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 open_root(void *edit_baton,
           svn_revnum_t base_revision,
@@ -340,7 +340,7 @@ open_root(void *edit_baton,
   if (! *eb->target)
     {
       /* For an update with a NULL target, this is equivalent to open_dir(): */
-      svn_wc__db_kind_t kind;
+      svn_kind_t kind;
       svn_wc__db_status_t status;
       svn_depth_t depth;
 
@@ -349,7 +349,7 @@ open_root(void *edit_baton,
                                 eb->db, eb->anchor_abspath,
                                 pool));
 
-      if (kind != svn_wc__db_kind_unknown
+      if (kind != svn_kind_unknown
           && status != svn_wc__db_status_not_present
           && status != svn_wc__db_status_excluded
           && status != svn_wc__db_status_server_excluded)
@@ -362,7 +362,7 @@ open_root(void *edit_baton,
                                        pool, &b->wrapped_baton);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 delete_entry(const char *path,
              svn_revnum_t base_revision,
@@ -380,7 +380,7 @@ delete_entry(const char *path,
       /* If the entry we want to delete doesn't exist, that's OK.
          It's probably an old server that doesn't understand
          depths. */
-      svn_wc__db_kind_t kind;
+      svn_kind_t kind;
       svn_wc__db_status_t status;
       const char *abspath;
 
@@ -389,7 +389,7 @@ delete_entry(const char *path,
       SVN_ERR(ambient_read_info(&status, &kind, NULL,
                                 eb->db, abspath, pool));
 
-      if (kind == svn_wc__db_kind_unknown
+      if (kind == svn_kind_unknown
           || status == svn_wc__db_status_not_present
           || status == svn_wc__db_status_excluded
           || status == svn_wc__db_status_server_excluded)
@@ -400,7 +400,7 @@ delete_entry(const char *path,
                                           pb->wrapped_baton, pool);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 add_directory(const char *path,
               void *parent_baton,
@@ -446,7 +446,7 @@ add_directory(const char *path,
                                            pool, &b->wrapped_baton);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 open_directory(const char *path,
                void *parent_baton,
@@ -458,7 +458,7 @@ open_directory(const char *path,
   struct edit_baton *eb = pb->edit_baton;
   struct dir_baton *b;
   const char *local_abspath;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   svn_wc__db_status_t status;
   svn_depth_t depth;
 
@@ -480,7 +480,7 @@ open_directory(const char *path,
   SVN_ERR(ambient_read_info(&status, &kind, &depth,
                             eb->db, local_abspath, pool));
 
-  if (kind != svn_wc__db_kind_unknown
+  if (kind != svn_kind_unknown
       && status != svn_wc__db_status_not_present
       && status != svn_wc__db_status_excluded
       && status != svn_wc__db_status_server_excluded)
@@ -491,7 +491,7 @@ open_directory(const char *path,
   return SVN_NO_ERROR;
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 add_file(const char *path,
          void *parent_baton,
@@ -515,7 +515,7 @@ add_file(const char *path,
                                       pool, &b->wrapped_baton);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 open_file(const char *path,
           void *parent_baton,
@@ -537,7 +537,7 @@ open_file(const char *path,
                                        &b->wrapped_baton);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 apply_textdelta(void *file_baton,
                 const char *base_checksum,
@@ -561,7 +561,7 @@ apply_textdelta(void *file_baton,
                                              handler, handler_baton);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 close_file(void *file_baton,
            const char *text_checksum,
@@ -577,7 +577,7 @@ close_file(void *file_baton,
                                         text_checksum, pool);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 absent_file(const char *path,
             void *parent_baton,
@@ -592,7 +592,7 @@ absent_file(const char *path,
   return eb->wrapped_editor->absent_file(path, pb->wrapped_baton, pool);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 close_directory(void *dir_baton,
                 apr_pool_t *pool)
@@ -606,7 +606,7 @@ close_directory(void *dir_baton,
   return eb->wrapped_editor->close_directory(db->wrapped_baton, pool);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 absent_directory(const char *path,
                  void *parent_baton,
@@ -622,7 +622,7 @@ absent_directory(const char *path,
   return eb->wrapped_editor->absent_directory(path, pb->wrapped_baton, pool);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 change_file_prop(void *file_baton,
                  const char *name,
@@ -639,7 +639,7 @@ change_file_prop(void *file_baton,
                                               name, value, pool);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 change_dir_prop(void *dir_baton,
                 const char *name,
@@ -656,7 +656,7 @@ change_dir_prop(void *dir_baton,
                                              name, value, pool);
 }
 
-/* */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 close_edit(void *edit_baton,
            apr_pool_t *pool)

Modified: subversion/branches/svn_mutex/subversion/libsvn_wc/cleanup.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn_mutex/subversion/libsvn_wc/cleanup.c?rev=1182053&r1=1182052&r2=1182053&view=diff
==============================================================================
--- subversion/branches/svn_mutex/subversion/libsvn_wc/cleanup.c (original)
+++ subversion/branches/svn_mutex/subversion/libsvn_wc/cleanup.c Tue Oct 11 19:52:34 2011
@@ -76,7 +76,7 @@ repair_timestamps(svn_wc__db_t *db,
                   void *cancel_baton,
                   apr_pool_t *scratch_pool)
 {
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   svn_wc__db_status_t status;
 
   if (cancel_func)
@@ -95,15 +95,15 @@ repair_timestamps(svn_wc__db_t *db,
       || status == svn_wc__db_status_not_present)
     return SVN_NO_ERROR;
 
-  if (kind == svn_wc__db_kind_file
-      || kind == svn_wc__db_kind_symlink)
+  if (kind == svn_kind_file
+      || kind == svn_kind_symlink)
     {
       svn_boolean_t modified;
       SVN_ERR(svn_wc__internal_file_modified_p(&modified,
                                                db, local_abspath, FALSE,
                                                scratch_pool));
     }
-  else if (kind == svn_wc__db_kind_dir)
+  else if (kind == svn_kind_dir)
     {
       apr_pool_t *iterpool = svn_pool_create(scratch_pool);
       const apr_array_header_t *children;

Modified: subversion/branches/svn_mutex/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn_mutex/subversion/libsvn_wc/conflicts.c?rev=1182053&r1=1182052&r2=1182053&view=diff
==============================================================================
--- subversion/branches/svn_mutex/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/branches/svn_mutex/subversion/libsvn_wc/conflicts.c Tue Oct 11 19:52:34 2011
@@ -180,7 +180,7 @@ resolve_conflict_on_node(svn_wc__db_t *d
   const char *conflict_new = NULL;
   const char *conflict_working = NULL;
   const char *prop_reject_file = NULL;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   int i;
   const apr_array_header_t *conflicts;
   const char *conflict_dir_abspath;
@@ -208,14 +208,13 @@ resolve_conflict_on_node(svn_wc__db_t *d
         prop_reject_file = desc->their_abspath;
     }
 
-  if (kind == svn_wc__db_kind_dir)
+  if (kind == svn_kind_dir)
     conflict_dir_abspath = local_abspath;
   else
     conflict_dir_abspath = svn_dirent_dirname(local_abspath, pool);
 
   if (resolve_text)
     {
-      svn_stream_t *tmp_stream = NULL;
       const char *auto_resolve_src;
 
       /* Handle automatic conflict resolution before the temporary files are
@@ -240,6 +239,7 @@ resolve_conflict_on_node(svn_wc__db_t *d
             if (conflict_old && conflict_working && conflict_new)
               {
                 const char *temp_dir;
+                svn_stream_t *tmp_stream = NULL;
                 svn_diff_t *diff;
                 svn_diff_conflict_display_style_t style =
                   conflict_choice == svn_wc_conflict_choose_theirs_conflict
@@ -252,7 +252,7 @@ resolve_conflict_on_node(svn_wc__db_t *d
                 SVN_ERR(svn_stream_open_unique(&tmp_stream,
                                                &auto_resolve_src,
                                                temp_dir,
-                                               svn_io_file_del_on_close,
+                                               svn_io_file_del_on_pool_cleanup,
                                                pool, pool));
 
                 SVN_ERR(svn_diff_file_diff3_2(&diff,
@@ -269,6 +269,7 @@ resolve_conflict_on_node(svn_wc__db_t *d
                                                     NULL, NULL, NULL, NULL,
                                                     style,
                                                     pool));
+                SVN_ERR(svn_stream_close(tmp_stream));
               }
             else
               auto_resolve_src = NULL;
@@ -283,9 +284,6 @@ resolve_conflict_on_node(svn_wc__db_t *d
         SVN_ERR(svn_io_copy_file(
           svn_dirent_join(conflict_dir_abspath, auto_resolve_src, pool),
           local_abspath, TRUE, pool));
-
-      if (tmp_stream)
-        SVN_ERR(svn_stream_close(tmp_stream));
     }
 
   /* Records whether we found any of the conflict files.  */
@@ -505,7 +503,7 @@ recursive_resolve_conflict(svn_wc__db_t 
       const char *name = APR_ARRAY_IDX(children, i, const char *);
       const char *child_abspath;
       svn_wc__db_status_t status;
-      svn_wc__db_kind_t kind;
+      svn_kind_t kind;
       svn_boolean_t conflicted;
 
       svn_pool_clear(iterpool);
@@ -528,10 +526,10 @@ recursive_resolve_conflict(svn_wc__db_t 
         continue;
 
       apr_hash_set(visited, name, APR_HASH_KEY_STRING, name);
-      if (kind == svn_wc__db_kind_dir && depth < svn_depth_immediates)
+      if (kind == svn_kind_dir && depth < svn_depth_immediates)
         continue;
 
-      if (kind == svn_wc__db_kind_dir)
+      if (kind == svn_kind_dir)
         SVN_ERR(recursive_resolve_conflict(db,
                                            child_abspath,
                                            conflicted,
@@ -605,7 +603,7 @@ svn_wc_resolved_conflict5(svn_wc_context
                           void *notify_baton,
                           apr_pool_t *scratch_pool)
 {
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   svn_boolean_t conflicted;
   /* ### the underlying code does NOT support resolving individual
      ### properties. bail out if the caller tries it.  */
@@ -623,7 +621,7 @@ svn_wc_resolved_conflict5(svn_wc_context
 
   /* When the implementation still used the entry walker, depth
      unknown was translated to infinity. */
-  if (kind != svn_wc__db_kind_dir)
+  if (kind != svn_kind_dir)
     depth = svn_depth_empty;
   else if (depth == svn_depth_unknown)
     depth = svn_depth_infinity;

Modified: subversion/branches/svn_mutex/subversion/libsvn_wc/conflicts.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn_mutex/subversion/libsvn_wc/conflicts.h?rev=1182053&r1=1182052&r2=1182053&view=diff
==============================================================================
--- subversion/branches/svn_mutex/subversion/libsvn_wc/conflicts.h (original)
+++ subversion/branches/svn_mutex/subversion/libsvn_wc/conflicts.h Tue Oct 11 19:52:34 2011
@@ -222,12 +222,12 @@ svn_error_t *
 svn_wc__conflict_skel_add_tree_conflict(
   svn_skel_t *skel,
   svn_wc_conflict_reason_t local_change,
-  svn_wc__db_kind_t original_local_kind,
+  svn_kind_t original_local_kind,
   const svn_checksum_t *original_checksum,
-  svn_wc__db_kind_t mine_local_kind,
+  svn_kind_t mine_local_kind,
   const svn_checksum_t *mine_checksum,
   svn_wc_conflict_action_t incoming_change,
-  svn_wc__db_kind_t incoming_kind,
+  svn_kind_t incoming_kind,
   const svn_checksum_t *incoming_checksum,
   apr_pool_t *result_pool,
   apr_pool_t *scratch_pool);

Modified: subversion/branches/svn_mutex/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn_mutex/subversion/libsvn_wc/copy.c?rev=1182053&r1=1182052&r2=1182053&view=diff
==============================================================================
--- subversion/branches/svn_mutex/subversion/libsvn_wc/copy.c (original)
+++ subversion/branches/svn_mutex/subversion/libsvn_wc/copy.c Tue Oct 11 19:52:34 2011
@@ -169,42 +169,21 @@ copy_pristine_text_if_necessary(svn_wc__
   return SVN_NO_ERROR;
 }
 
-/* Copy the versioned node SRC_ABSPATH in DB to the path DST_ABSPATH in DB.
-
-   This is a specific variant of copy_versioned_file and copy_versioned_dir
-   specifically handling deleted nodes.
- */
-static svn_error_t *
-copy_deleted_node(svn_wc__db_t *db,
-                  const char *src_abspath,
-                  const char *dst_abspath,
-                  const char *dst_op_root_abspath,
-                  svn_cancel_func_t cancel_func,
-                  void *cancel_baton,
-                  svn_wc_notify_func2_t notify_func,
-                  void *notify_baton,
-                  apr_pool_t *scratch_pool)
-{
-  SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath, dst_op_root_abspath,
-                             NULL, scratch_pool));
-
-  /* Don't recurse on children while all we do is creating not-present
-     children */
-
-  return SVN_NO_ERROR;
-}
 
 /* Copy the versioned file SRC_ABSPATH in DB to the path DST_ABSPATH in DB.
    If METADATA_ONLY is true, copy only the versioned metadata,
    otherwise copy both the versioned metadata and the filesystem node (even
    if it is the wrong kind, and recursively if it is a dir).
 
+   If IS_MOVE is true, record move information in working copy meta
+   data in addition to copying the file.
+
    If the versioned file has a text conflict, and the .mine file exists in
    the filesystem, copy the .mine file to DST_ABSPATH.  Otherwise, copy the
    versioned file itself.
 
    This also works for versioned symlinks that are stored in the db as
-   svn_wc__db_kind_file with svn:special set. */
+   svn_kind_file with svn:special set. */
 static svn_error_t *
 copy_versioned_file(svn_wc__db_t *db,
                     const char *src_abspath,
@@ -214,6 +193,7 @@ copy_versioned_file(svn_wc__db_t *db,
                     const svn_checksum_t *checksum,
                     svn_boolean_t metadata_only,
                     svn_boolean_t conflicted,
+                    svn_boolean_t is_move,
                     svn_cancel_func_t cancel_func,
                     void *cancel_baton,
                     svn_wc_notify_func2_t notify_func,
@@ -332,8 +312,9 @@ copy_versioned_file(svn_wc__db_t *db,
 
   /* Copy the (single) node's metadata, and move the new filesystem node
      into place. */
-  SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath, dst_op_root_abspath,
-                             work_items, scratch_pool));
+  SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath,
+                             dst_op_root_abspath, is_move, work_items,
+                             scratch_pool));
   SVN_ERR(svn_wc__wq_run(db, dir_abspath,
                          cancel_func, cancel_baton, scratch_pool));
 
@@ -351,7 +332,9 @@ copy_versioned_file(svn_wc__db_t *db,
 /* Copy the versioned dir SRC_ABSPATH in DB to the path DST_ABSPATH in DB,
    recursively.  If METADATA_ONLY is true, copy only the versioned metadata,
    otherwise copy both the versioned metadata and the filesystem nodes (even
-   if they are the wrong kind, and including unversioned children). */
+   if they are the wrong kind, and including unversioned children).
+   If IS_MOVE is true, record move information in working copy meta
+   data in addition to copying the directory. */
 static svn_error_t *
 copy_versioned_dir(svn_wc__db_t *db,
                    const char *src_abspath,
@@ -359,6 +342,7 @@ copy_versioned_dir(svn_wc__db_t *db,
                    const char *dst_op_root_abspath,
                    const char *tmpdir_abspath,
                    svn_boolean_t metadata_only,
+                   svn_boolean_t is_move,
                    svn_cancel_func_t cancel_func,
                    void *cancel_baton,
                    svn_wc_notify_func2_t notify_func,
@@ -394,8 +378,9 @@ copy_versioned_dir(svn_wc__db_t *db,
 
   /* Copy the (single) node's metadata, and move the new filesystem node
      into place. */
-  SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath, dst_op_root_abspath,
-                             work_items, scratch_pool));
+  SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath,
+                             dst_op_root_abspath, is_move, work_items,
+                             scratch_pool));
   SVN_ERR(svn_wc__wq_run(db, dir_abspath,
                          cancel_func, cancel_baton, scratch_pool));
 
@@ -425,7 +410,7 @@ copy_versioned_dir(svn_wc__db_t *db,
     {
       const char *child_name, *child_src_abspath, *child_dst_abspath;
       svn_wc__db_status_t child_status;
-      svn_wc__db_kind_t child_kind;
+      svn_kind_t child_kind;
       svn_boolean_t op_root;
       svn_boolean_t conflicted;
       const svn_checksum_t *checksum;
@@ -456,19 +441,19 @@ copy_versioned_dir(svn_wc__db_t *db,
           || child_status == svn_wc__db_status_added)
         {
           /* We have more work to do than just changing the DB */
-          if (child_kind == svn_wc__db_kind_file)
+          if (child_kind == svn_kind_file)
             {
               svn_boolean_t skip = FALSE;
 
               /* We should skip this node if this child is a file external
-                 (issue #3589) */
+                 (issues #3589, #4000) */
               if (child_status == svn_wc__db_status_normal)
                 {
                   SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, NULL,
                                                    NULL, NULL, NULL, NULL,
                                                    NULL, NULL, NULL, NULL,
                                                    NULL, NULL, &skip,
-                                                   db, src_abspath,
+                                                   db, child_src_abspath,
                                                    scratch_pool,
                                                    scratch_pool));
                 }
@@ -480,15 +465,16 @@ copy_versioned_dir(svn_wc__db_t *db,
                                             dst_op_root_abspath,
                                             tmpdir_abspath, checksum,
                                             metadata_only, conflicted,
+                                            is_move,
                                             cancel_func, cancel_baton,
                                             NULL, NULL,
                                             iterpool));
             }
-          else if (child_kind == svn_wc__db_kind_dir)
+          else if (child_kind == svn_kind_dir)
             SVN_ERR(copy_versioned_dir(db,
                                        child_src_abspath, child_dst_abspath,
                                        dst_op_root_abspath, tmpdir_abspath,
-                                       metadata_only,
+                                       metadata_only, is_move,
                                        cancel_func, cancel_baton, NULL, NULL,
                                        iterpool));
           else
@@ -503,11 +489,12 @@ copy_versioned_dir(svn_wc__db_t *db,
         {
           /* This will be copied as some kind of deletion. Don't touch
              any actual files */
-          SVN_ERR(copy_deleted_node(db,
-                                    child_src_abspath, child_dst_abspath,
-                                    dst_op_root_abspath,
-                                    cancel_func, cancel_baton, NULL, NULL,
-                                    iterpool));
+          SVN_ERR(svn_wc__db_op_copy(db, child_src_abspath,
+                                     child_dst_abspath, dst_op_root_abspath,
+                                     is_move, NULL, iterpool));
+
+          /* Don't recurse on children while all we do is creating not-present
+             children */
         }
       else
         {
@@ -586,13 +573,15 @@ copy_versioned_dir(svn_wc__db_t *db,
 }
 
 
-/* Public Interface */
-
-svn_error_t *
-svn_wc_copy3(svn_wc_context_t *wc_ctx,
+/* The guts of svn_wc_copy3() and svn_wc_move().
+ * The additional parameter IS_MOVE indicates whether this is a copy or
+ * a move operation. */
+static svn_error_t *
+copy_or_move(svn_wc_context_t *wc_ctx,
              const char *src_abspath,
              const char *dst_abspath,
              svn_boolean_t metadata_only,
+             svn_boolean_t is_move,
              svn_cancel_func_t cancel_func,
              void *cancel_baton,
              svn_wc_notify_func2_t notify_func,
@@ -600,7 +589,7 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
              apr_pool_t *scratch_pool)
 {
   svn_wc__db_t *db = wc_ctx->db;
-  svn_wc__db_kind_t src_db_kind;
+  svn_kind_t src_db_kind;
   const char *dstdir_abspath;
   svn_boolean_t conflicted;
   const svn_checksum_t *checksum;
@@ -638,6 +627,25 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
     else
       SVN_ERR(err);
 
+    switch (src_status)
+      {
+        case svn_wc__db_status_deleted:
+          return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+                                   _("Deleted node '%s' can't be copied."),
+                                   svn_dirent_local_style(src_abspath,
+                                                          scratch_pool));
+
+        case svn_wc__db_status_excluded:
+        case svn_wc__db_status_server_excluded:
+        case svn_wc__db_status_not_present:
+          return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+                                   _("The node '%s' was not found."),
+                                   svn_dirent_local_style(src_abspath,
+                                                          scratch_pool));
+        default:
+          break;
+      }
+
     SVN_ERR(svn_wc__db_read_info(&dstdir_status, NULL, NULL, NULL,
                                  &dst_repos_root_url, &dst_repos_uuid, NULL,
                                  NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -653,7 +661,7 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
           SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL,
                                            &src_repos_root_url,
                                            &src_repos_uuid, NULL, NULL, NULL,
-                                           NULL,
+                                           NULL, NULL, NULL,
                                            db, src_abspath,
                                            scratch_pool, scratch_pool));
         else
@@ -670,7 +678,7 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
           SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL,
                                            &dst_repos_root_url,
                                            &dst_repos_uuid, NULL, NULL, NULL,
-                                           NULL,
+                                           NULL, NULL, NULL,
                                            db, dstdir_abspath,
                                            scratch_pool, scratch_pool));
         else
@@ -762,12 +770,12 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
                                          dst_abspath,
                                          scratch_pool, scratch_pool));
 
-  if (src_db_kind == svn_wc__db_kind_file
-      || src_db_kind == svn_wc__db_kind_symlink)
+  if (src_db_kind == svn_kind_file
+      || src_db_kind == svn_kind_symlink)
     {
       SVN_ERR(copy_versioned_file(db, src_abspath, dst_abspath, dst_abspath,
                                   tmpdir_abspath, checksum,
-                                  metadata_only, conflicted,
+                                  metadata_only, conflicted, is_move,
                                   cancel_func, cancel_baton,
                                   notify_func, notify_baton,
                                   scratch_pool));
@@ -776,7 +784,7 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
     {
       SVN_ERR(copy_versioned_dir(db, src_abspath, dst_abspath, dst_abspath,
                                  tmpdir_abspath,
-                                 metadata_only,
+                                 metadata_only, is_move,
                                  cancel_func, cancel_baton,
                                  notify_func, notify_baton,
                                  scratch_pool));
@@ -785,6 +793,28 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
   return SVN_NO_ERROR;
 }
 
+
+/* Public Interface */
+
+svn_error_t *
+svn_wc_copy3(svn_wc_context_t *wc_ctx,
+             const char *src_abspath,
+             const char *dst_abspath,
+             svn_boolean_t metadata_only,
+             svn_cancel_func_t cancel_func,
+             void *cancel_baton,
+             svn_wc_notify_func2_t notify_func,
+             void *notify_baton,
+             apr_pool_t *scratch_pool)
+{
+  return svn_error_trace(copy_or_move(wc_ctx, src_abspath, dst_abspath,
+                                      metadata_only, FALSE /* is_move */,
+                                      cancel_func, cancel_baton,
+                                      notify_func, notify_baton,
+                                      scratch_pool));
+}
+
+
 /* Remove the conflict markers of NODE_ABSPATH, that were left over after
    copying NODE_ABSPATH from SRC_ABSPATH.
 
@@ -918,7 +948,7 @@ remove_all_conflict_markers(svn_wc__db_t
                             svn_dirent_join(wc_dir_abspath, name, iterpool),
                             iterpool));
         }
-      if (info->kind == svn_wc__db_kind_dir)
+      if (info->kind == svn_kind_dir)
         {
           svn_pool_clear(iterpool);
           SVN_ERR(remove_all_conflict_markers(
@@ -945,8 +975,9 @@ svn_wc_move(svn_wc_context_t *wc_ctx,
             apr_pool_t *scratch_pool)
 {
   svn_wc__db_t *db = wc_ctx->db;
-  SVN_ERR(svn_wc_copy3(wc_ctx, src_abspath, dst_abspath,
+  SVN_ERR(copy_or_move(wc_ctx, src_abspath, dst_abspath,
                        TRUE /* metadata_only */,
+                       TRUE /* is_move */,
                        cancel_func, cancel_baton,
                        notify_func, notify_baton,
                        scratch_pool));
@@ -959,7 +990,7 @@ svn_wc_move(svn_wc_context_t *wc_ctx,
     SVN_ERR(svn_io_file_rename(src_abspath, dst_abspath, scratch_pool));
 
   {
-    svn_wc__db_kind_t kind;
+    svn_kind_t kind;
     svn_boolean_t conflicted;
 
     SVN_ERR(svn_wc__db_read_info(NULL, &kind, NULL, NULL, NULL, NULL, NULL,
@@ -970,7 +1001,7 @@ svn_wc_move(svn_wc_context_t *wc_ctx,
                                  db, src_abspath,
                                  scratch_pool, scratch_pool));
 
-    if (kind == svn_wc__db_kind_dir)
+    if (kind == svn_kind_dir)
       SVN_ERR(remove_all_conflict_markers(db, src_abspath, dst_abspath,
                                           scratch_pool));
 
@@ -979,10 +1010,11 @@ svn_wc_move(svn_wc_context_t *wc_ctx,
                                            scratch_pool));
   }
 
-  SVN_ERR(svn_wc_delete4(wc_ctx, src_abspath, TRUE, FALSE,
-                         cancel_func, cancel_baton,
-                         notify_func, notify_baton,
-                         scratch_pool));
+  SVN_ERR(svn_wc__delete_internal(wc_ctx, src_abspath, TRUE, FALSE,
+                                  dst_abspath,
+                                  cancel_func, cancel_baton,
+                                  notify_func, notify_baton,
+                                  scratch_pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/svn_mutex/subversion/libsvn_wc/crop.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn_mutex/subversion/libsvn_wc/crop.c?rev=1182053&r1=1182052&r2=1182053&view=diff
==============================================================================
--- subversion/branches/svn_mutex/subversion/libsvn_wc/crop.c (original)
+++ subversion/branches/svn_mutex/subversion/libsvn_wc/crop.c Tue Oct 11 19:52:34 2011
@@ -98,7 +98,7 @@ crop_children(svn_wc__db_t *db,
       const char *child_name = APR_ARRAY_IDX(children, i, const char *);
       const char *child_abspath;
       svn_wc__db_status_t child_status;
-      svn_wc__db_kind_t kind;
+      svn_kind_t kind;
       svn_depth_t child_depth;
 
       svn_pool_clear(iterpool);
@@ -117,18 +117,18 @@ crop_children(svn_wc__db_t *db,
           child_status == svn_wc__db_status_excluded ||
           child_status == svn_wc__db_status_not_present)
         {
-          svn_depth_t remove_below = (kind == svn_wc__db_kind_dir)
+          svn_depth_t remove_below = (kind == svn_kind_dir)
                                             ? svn_depth_immediates
                                             : svn_depth_files;
           if (new_depth < remove_below)
             SVN_ERR(svn_wc__db_op_remove_node(db, local_abspath,
                                               SVN_INVALID_REVNUM,
-                                              svn_wc__db_kind_unknown,
+                                              svn_kind_unknown,
                                               iterpool));
 
           continue;
         }
-      else if (kind == svn_wc__db_kind_file)
+      else if (kind == svn_kind_file)
         {
           /* We currently crop on a directory basis. So don't worry about
              svn_depth_exclude here. And even we permit excluding a single
@@ -148,7 +148,7 @@ crop_children(svn_wc__db_t *db,
             continue;
 
         }
-      else if (kind == svn_wc__db_kind_dir)
+      else if (kind == svn_kind_dir)
         {
           if (new_depth < svn_depth_immediates)
             {
@@ -209,7 +209,7 @@ svn_wc_exclude(svn_wc_context_t *wc_ctx,
 {
   svn_boolean_t is_root, is_switched;
   svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   svn_revnum_t revision;
   const char *repos_relpath, *repos_root, *repos_uuid;
 
@@ -283,16 +283,16 @@ svn_wc_exclude(svn_wc_context_t *wc_ctx,
                                     cancel_func, cancel_baton,
                                     scratch_pool));
 
-  SVN_ERR(svn_wc__db_base_add_absent_node(wc_ctx->db,
-                                          local_abspath,
-                                          repos_relpath,
-                                          repos_root,
-                                          repos_uuid,
-                                          revision,
-                                          kind,
-                                          svn_wc__db_status_excluded,
-                                          NULL, NULL,
-                                          scratch_pool));
+  SVN_ERR(svn_wc__db_base_add_excluded_node(wc_ctx->db,
+                                            local_abspath,
+                                            repos_relpath,
+                                            repos_root,
+                                            repos_uuid,
+                                            revision,
+                                            kind,
+                                            svn_wc__db_status_excluded,
+                                            NULL, NULL,
+                                            scratch_pool));
 
   if (notify_func)
     {
@@ -318,7 +318,7 @@ svn_wc_crop_tree2(svn_wc_context_t *wc_c
 {
   svn_wc__db_t *db = wc_ctx->db;
   svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   svn_depth_t dir_depth;
 
   /* Only makes sense when the depth is restrictive. */
@@ -335,7 +335,7 @@ svn_wc_crop_tree2(svn_wc_context_t *wc_c
                                db, local_abspath,
                                scratch_pool, scratch_pool));
 
-  if (kind != svn_wc__db_kind_dir)
+  if (kind != svn_kind_dir)
     return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
       _("Can only crop directories"));
 

Modified: subversion/branches/svn_mutex/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn_mutex/subversion/libsvn_wc/deprecated.c?rev=1182053&r1=1182052&r2=1182053&view=diff
==============================================================================
--- subversion/branches/svn_mutex/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/branches/svn_mutex/subversion/libsvn_wc/deprecated.c Tue Oct 11 19:52:34 2011
@@ -930,10 +930,10 @@ svn_wc_add3(const char *path,
   /* Make sure the caller gets the new access baton in the set. */
   if (svn_wc__adm_retrieve_internal2(wc_db, local_abspath, pool) == NULL)
     {
-      svn_wc__db_kind_t kind;
+      svn_kind_t kind;
 
       SVN_ERR(svn_wc__db_read_kind(&kind, wc_db, local_abspath, FALSE, pool));
-      if (kind == svn_wc__db_kind_dir)
+      if (kind == svn_kind_dir)
         {
           svn_wc_adm_access_t *adm_access;
 
@@ -2360,11 +2360,10 @@ svn_wc_prop_list(apr_hash_t **props,
     {
       *props = apr_hash_make(pool);
       svn_error_clear(err);
+      err = NULL;
     }
-  else if (err)
-    return svn_error_trace(err);
 
-  return svn_error_trace(svn_wc_context_destroy(wc_ctx));
+  return svn_error_compose_create(err, svn_wc_context_destroy(wc_ctx));
 }
 
 svn_error_t *
@@ -2386,11 +2385,13 @@ svn_wc_prop_get(const svn_string_t **val
   err = svn_wc_prop_get2(value, wc_ctx, local_abspath, name, pool, pool);
 
   if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
-    svn_error_clear(err);
-  else
-    SVN_ERR(err);
+    {
+      *value = NULL;
+      svn_error_clear(err);
+      err = NULL;
+    }
 
-  return svn_error_trace(svn_wc_context_destroy(wc_ctx));
+  return svn_error_compose_create(err, svn_wc_context_destroy(wc_ctx));
 }
 
 /* baton for conflict_func_1to2_wrapper */
@@ -2630,10 +2631,15 @@ svn_wc_get_status_editor4(const svn_delt
       swb->anchor_relpath = NULL;
     }
 
+  /* Before subversion 1.7 status always handled depth as sticky. 1.7 made
+     the output of svn status by default match the result of what would be
+     updated by a similar svn update. (Following the documentation) */
+
   SVN_ERR(svn_wc_get_status_editor5(editor, edit_baton, set_locks_baton,
                                     edit_revision, wc_ctx, anchor_abspath,
                                     target, depth, get_all,
                                     no_ignore,
+                                    (depth != svn_depth_unknown) /*as_sticky*/,
                                     FALSE /* server_performs_filtering */,
                                     ignore_patterns,
                                     status4_wrapper_func, swb,

Modified: subversion/branches/svn_mutex/subversion/libsvn_wc/diff_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn_mutex/subversion/libsvn_wc/diff_editor.c?rev=1182053&r1=1182052&r2=1182053&view=diff
==============================================================================
--- subversion/branches/svn_mutex/subversion/libsvn_wc/diff_editor.c (original)
+++ subversion/branches/svn_mutex/subversion/libsvn_wc/diff_editor.c Tue Oct 11 19:52:34 2011
@@ -481,12 +481,7 @@ get_empty_file(struct edit_baton *b,
 static const char *
 get_prop_mimetype(apr_hash_t *props)
 {
-  const svn_string_t *mimetype_val;
-
-  mimetype_val = apr_hash_get(props,
-                              SVN_PROP_MIME_TYPE,
-                              strlen(SVN_PROP_MIME_TYPE));
-  return (mimetype_val) ? mimetype_val->data : NULL;
+  return svn_prop_get_value(props, SVN_PROP_MIME_TYPE);
 }
 
 
@@ -574,7 +569,7 @@ file_diff(struct edit_baton *eb,
   if (status == svn_wc__db_status_added)
     SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL,
                                      &original_repos_relpath, NULL, NULL,
-                                     NULL, db, local_abspath,
+                                     NULL, NULL, NULL, db, local_abspath,
                                      scratch_pool, scratch_pool));
 
   /* A wc-wc diff of replaced files actually shows a diff against the
@@ -844,7 +839,7 @@ walk_local_nodes_diff(struct edit_baton 
       const char *name = APR_ARRAY_IDX(children, i, const char*);
       const char *child_abspath, *child_path;
       svn_wc__db_status_t status;
-      svn_wc__db_kind_t kind;
+      svn_kind_t kind;
 
       svn_pool_clear(iterpool);
 
@@ -880,12 +875,12 @@ walk_local_nodes_diff(struct edit_baton 
 
       switch (kind)
         {
-        case svn_wc__db_kind_file:
-        case svn_wc__db_kind_symlink:
+        case svn_kind_file:
+        case svn_kind_symlink:
           SVN_ERR(file_diff(eb, child_abspath, child_path, iterpool));
           break;
 
-        case svn_wc__db_kind_dir:
+        case svn_kind_dir:
           /* ### TODO: Don't know how to do replaced dirs. How do I get
              information about what is being replaced? If it was a
              directory then the directory elements are also going to be
@@ -964,8 +959,8 @@ report_wc_file_as_added(struct edit_bato
 
   if (status == svn_wc__db_status_added)
     SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL, NULL,
-                                     NULL, NULL, NULL, db, local_abspath,
-                                     scratch_pool, scratch_pool));
+                                     NULL, NULL, NULL, NULL, NULL, db,
+                                     local_abspath, scratch_pool, scratch_pool));
 
   /* We can't show additions for files that don't exist. */
   SVN_ERR_ASSERT(status != svn_wc__db_status_deleted || eb->use_text_base);
@@ -1085,7 +1080,7 @@ report_wc_directory_as_added(struct edit
       const char *name = APR_ARRAY_IDX(children, i, const char *);
       const char *child_abspath, *child_path;
       svn_wc__db_status_t status;
-      svn_wc__db_kind_t kind;
+      svn_kind_t kind;
 
       svn_pool_clear(iterpool);
 
@@ -1116,13 +1111,13 @@ report_wc_directory_as_added(struct edit
 
       switch (kind)
         {
-        case svn_wc__db_kind_file:
-        case svn_wc__db_kind_symlink:
+        case svn_kind_file:
+        case svn_kind_symlink:
           SVN_ERR(report_wc_file_as_added(eb, child_abspath, child_path,
                                           iterpool));
           break;
 
-        case svn_wc__db_kind_dir:
+        case svn_kind_dir:
           if (depth > svn_depth_files || depth == svn_depth_unknown)
             {
               svn_depth_t depth_below_here = depth;
@@ -1149,7 +1144,7 @@ report_wc_directory_as_added(struct edit
 }
 
 
-/* An editor function. */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 set_target_revision(void *edit_baton,
                     svn_revnum_t target_revision,
@@ -1161,7 +1156,7 @@ set_target_revision(void *edit_baton,
   return SVN_NO_ERROR;
 }
 
-/* An editor function. The root of the comparison hierarchy */
+/* An svn_delta_editor_t function. The root of the comparison hierarchy */
 static svn_error_t *
 open_root(void *edit_baton,
           svn_revnum_t base_revision,
@@ -1178,7 +1173,7 @@ open_root(void *edit_baton,
   return SVN_NO_ERROR;
 }
 
-/* An editor function. */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 delete_entry(const char *path,
              svn_revnum_t base_revision,
@@ -1192,7 +1187,7 @@ delete_entry(const char *path,
   const char *name = svn_dirent_basename(path, NULL);
   const char *local_abspath = svn_dirent_join(pb->local_abspath, name, pool);
   svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
 
   /* Mark this node as compared in the parent directory's baton. */
   apr_hash_set(pb->compared, apr_pstrdup(pb->pool, path),
@@ -1212,8 +1207,8 @@ delete_entry(const char *path,
   SVN_ERR(get_empty_file(pb->eb, &empty_file));
   switch (kind)
     {
-    case svn_wc__db_kind_file:
-    case svn_wc__db_kind_symlink:
+    case svn_kind_file:
+    case svn_kind_symlink:
       /* A delete is required to change working-copy into requested
          revision, so diff should show this as an add. Thus compare
          the empty file against the current working copy.  If
@@ -1250,7 +1245,7 @@ delete_entry(const char *path,
           SVN_ERR(report_wc_file_as_added(eb, local_abspath, path, pool));
         }
       break;
-    case svn_wc__db_kind_dir:
+    case svn_kind_dir:
       /* A delete is required to change working-copy into requested
          revision, so diff should show this as an add. */
       SVN_ERR(report_wc_directory_as_added(eb,
@@ -1266,7 +1261,7 @@ delete_entry(const char *path,
   return SVN_NO_ERROR;
 }
 
-/* An editor function. */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 add_directory(const char *path,
               void *parent_baton,
@@ -1295,7 +1290,7 @@ add_directory(const char *path,
   return SVN_NO_ERROR;
 }
 
-/* An editor function. */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 open_directory(const char *path,
                void *parent_baton,
@@ -1326,8 +1321,8 @@ open_directory(const char *path,
 }
 
 
-/* An editor function.  When a directory is closed, all the directory
- * elements that have been added or replaced will already have been
+/* An svn_delta_editor_t function.  When a directory is closed, all the
+ * directory elements that have been added or replaced will already have been
  * diff'd. However there may be other elements in the working copy
  * that have not yet been considered.  */
 static svn_error_t *
@@ -1418,7 +1413,7 @@ close_directory(void *dir_baton,
   return SVN_NO_ERROR;
 }
 
-/* An editor function. */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 add_file(const char *path,
          void *parent_baton,
@@ -1443,7 +1438,7 @@ add_file(const char *path,
   return SVN_NO_ERROR;
 }
 
-/* An editor function. */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 open_file(const char *path,
           void *parent_baton,
@@ -1507,7 +1502,7 @@ window_handler(svn_txdelta_window_t *win
   return SVN_NO_ERROR;
 }
 
-/* An editor function. */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 apply_textdelta(void *file_baton,
                 const char *base_checksum,
@@ -1548,7 +1543,7 @@ apply_textdelta(void *file_baton,
   return SVN_NO_ERROR;
 }
 
-/* An editor function.  When the file is closed we have a temporary
+/* An svn_delta_editor_t function.  When the file is closed we have a temporary
  * file containing a pristine version of the repository file. This can
  * be compared against the working copy.
  *
@@ -1664,7 +1659,7 @@ close_file(void *file_baton,
 
   if (status == svn_wc__db_status_added)
     SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL, NULL,
-                                     NULL, NULL, NULL, eb->db,
+                                     NULL, NULL, NULL, NULL, NULL, eb->db,
                                      fb->local_abspath,
                                      scratch_pool, scratch_pool));
 
@@ -1800,7 +1795,7 @@ close_file(void *file_baton,
 }
 
 
-/* An editor function. */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 change_file_prop(void *file_baton,
                  const char *name,
@@ -1818,7 +1813,7 @@ change_file_prop(void *file_baton,
 }
 
 
-/* An editor function. */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 change_dir_prop(void *dir_baton,
                 const char *name,
@@ -1836,7 +1831,7 @@ change_dir_prop(void *dir_baton,
 }
 
 
-/* An editor function. */
+/* An svn_delta_editor_t function. */
 static svn_error_t *
 close_edit(void *edit_baton,
            apr_pool_t *pool)
@@ -1928,11 +1923,17 @@ svn_wc_get_diff_editor6(const svn_delta_
                                                 inner_baton,
                                                 result_pool));
 
-  return svn_delta_get_cancellation_editor(cancel_func,
-                                           cancel_baton,
-                                           inner_editor,
-                                           inner_baton,
-                                           editor,
-                                           edit_baton,
-                                           result_pool);
+  SVN_ERR(svn_delta_get_cancellation_editor(cancel_func,
+                                            cancel_baton,
+                                            inner_editor,
+                                            inner_baton,
+                                            editor,
+                                            edit_baton,
+                                            result_pool));
+
+  SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton,
+                                   NULL, NULL, NULL, NULL,
+                                   result_pool, scratch_pool));
+
+  return SVN_NO_ERROR;
 }

Modified: subversion/branches/svn_mutex/subversion/libsvn_wc/diff_local.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn_mutex/subversion/libsvn_wc/diff_local.c?rev=1182053&r1=1182052&r2=1182053&view=diff
==============================================================================
--- subversion/branches/svn_mutex/subversion/libsvn_wc/diff_local.c (original)
+++ subversion/branches/svn_mutex/subversion/libsvn_wc/diff_local.c Tue Oct 11 19:52:34 2011
@@ -113,12 +113,7 @@ get_empty_file(struct diff_baton *eb,
 static const char *
 get_prop_mimetype(apr_hash_t *props)
 {
-  const svn_string_t *mimetype_val;
-
-  mimetype_val = apr_hash_get(props,
-                              SVN_PROP_MIME_TYPE,
-                              strlen(SVN_PROP_MIME_TYPE));
-  return (mimetype_val) ? mimetype_val->data : NULL;
+  return svn_prop_get_value(props, SVN_PROP_MIME_TYPE);
 }
 
 
@@ -143,7 +138,7 @@ file_diff(struct diff_baton *eb,
   const char *empty_file;
   const char *original_repos_relpath;
   svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   svn_revnum_t revision;
   const svn_checksum_t *checksum;
   svn_boolean_t op_root;
@@ -172,7 +167,7 @@ file_diff(struct diff_baton *eb,
 
       if (replaced && base_replace /* && !have_more_work */)
         {
-          svn_wc__db_kind_t base_kind;
+          svn_kind_t base_kind;
           SVN_ERR(svn_wc__db_base_get_info(&base_status, &base_kind,
                                            &base_revision,
                                            NULL, NULL, NULL, NULL, NULL, NULL,
@@ -210,7 +205,7 @@ file_diff(struct diff_baton *eb,
   if (status == svn_wc__db_status_added)
     SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL,
                                      &original_repos_relpath, NULL, NULL,
-                                     NULL, db, local_abspath,
+                                     NULL, NULL, NULL, db, local_abspath,
                                      scratch_pool, scratch_pool));
 
 
@@ -450,11 +445,25 @@ diff_status_callback(void *baton,
         break; /* Go check other conditions */
     }
 
-  if (eb->changelist_hash != NULL
-      && (!status->changelist
-          || ! apr_hash_get(eb->changelist_hash, status->changelist,
-                            APR_HASH_KEY_STRING)))
-    return SVN_NO_ERROR; /* Filtered via changelist */
+  /* Filter items by changelist. */
+  /* ### duplicated in ../libsvn_client/status.c */
+  if (eb->changelist_hash)
+    {
+      if (status->changelist)
+        {
+          /* Skip unless the caller requested this changelist. */
+          if (! apr_hash_get(eb->changelist_hash, status->changelist,
+                             APR_HASH_KEY_STRING))
+            return SVN_NO_ERROR;
+        }
+      else
+        {
+          /* Skip unless the caller requested changelist-lacking items. */
+          if (! apr_hash_get(eb->changelist_hash, "",
+                             APR_HASH_KEY_STRING))
+            return SVN_NO_ERROR;
+        }
+    }
 
   /* ### The following checks should probably be reversed as it should decide
          when *not* to show a diff, because generally all changed nodes should
@@ -479,8 +488,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
@@ -489,9 +519,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,
@@ -503,6 +530,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;
 }
@@ -524,14 +560,14 @@ svn_wc_diff6(svn_wc_context_t *wc_ctx,
              apr_pool_t *scratch_pool)
 {
   struct diff_baton eb = { 0 };
-  svn_wc__db_kind_t kind;
+  svn_kind_t kind;
   svn_boolean_t get_all;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR(svn_wc__db_read_kind(&kind, wc_ctx->db, local_abspath, FALSE,
                                scratch_pool));
 
-  if (kind == svn_wc__db_kind_dir)
+  if (kind == svn_kind_dir)
       eb.anchor_abspath = local_abspath;
   else
     eb.anchor_abspath = svn_dirent_dirname(local_abspath, scratch_pool);