You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2011/04/05 00:51:27 UTC

svn commit: r1088815 - /subversion/trunk/subversion/libsvn_wc/adm_ops.c

Author: philip
Date: Mon Apr  4 22:51:27 2011
New Revision: 1088815

URL: http://svn.apache.org/viewvc?rev=1088815&view=rev
Log:
Start removing the old revert code.  This should remove the unreachable
code warnings.

* subversion/libsvn_wc/adm_ops.c:
  (verify_revert_depths): Remove.
  (revert_internal): Remove old code.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1088815&r1=1088814&r2=1088815&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon Apr  4 22:51:27 2011
@@ -1265,73 +1265,6 @@ svn_wc__register_file_external(svn_wc_co
 */
 
 
-/* Verifies if an add (or copy) to LOCAL_ABSPATH can be reverted with depth
- * DEPTH, without touching nodes that are filtered by DEPTH.
- *
- * Use ROOT_ABSPATH for generating error messages.
- */
-static svn_error_t *
-verify_revert_depth(svn_wc__db_t *db,
-                    const char *local_abspath,
-                    svn_depth_t depth,
-                    const char *root_abspath,
-                    apr_pool_t *scratch_pool)
-{
-  const apr_array_header_t *children;
-  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
-  int i;
-
-  SVN_ERR_ASSERT(depth >= svn_depth_empty && depth < svn_depth_infinity);
-
-  SVN_ERR(svn_wc__db_read_children(&children, db, local_abspath,
-                                   scratch_pool, iterpool));
-
-  for (i = 0; i < children->nelts; i++)
-    {
-      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_pool_clear(iterpool);
-
-      child_abspath = svn_dirent_join(local_abspath, name, iterpool);
-
-      SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL,
-                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                   NULL, NULL, NULL, NULL,
-                                   db, child_abspath, iterpool, iterpool));
-
-      /* Not-here and deleted nodes won't be reverted by reverting an operation
-         on a parent, so we can just skip them for the depth check. */
-      if (status == svn_wc__db_status_not_present
-          || status == svn_wc__db_status_absent
-          || status == svn_wc__db_status_excluded
-          || status == svn_wc__db_status_deleted)
-        continue;
-
-      if (depth == svn_depth_empty
-          || (depth == svn_depth_files && kind == svn_wc__db_kind_dir))
-        {
-          return svn_error_createf(
-                        SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
-                        _("Can't revert '%s' with this depth, as that requires"
-                          " reverting '%s'."),
-                        svn_dirent_local_style(root_abspath, iterpool),
-                        svn_dirent_local_style(child_abspath, iterpool));
-        }
-
-      if (kind == svn_wc__db_kind_dir)
-        SVN_ERR(verify_revert_depth(db, child_abspath, svn_depth_empty,
-                                    root_abspath, iterpool));
-    }
-
-  svn_pool_destroy(iterpool);
-
-  return SVN_NO_ERROR;
-}
-
 /* Remove conflict file NAME, which may not exist, associated with
  * *LOCAL_ABSPATH and set NOTIFY_REQUIRED to TRUE if the file was
  * present and removed. */
@@ -1784,17 +1717,6 @@ revert_internal(svn_wc__db_t *db,
                 void *notify_baton,
                 apr_pool_t *pool)
 {
-  svn_node_kind_t disk_kind;
-  svn_wc__db_status_t status, base_status;
-  svn_wc__db_kind_t db_kind;
-  svn_boolean_t unversioned;
-  svn_boolean_t have_base;
-  svn_boolean_t replaced;
-  svn_boolean_t reverted = FALSE;
-  const svn_wc_conflict_description2_t *tree_conflict;
-  const char *op_root_abspath = NULL;
-  svn_error_t *err;
-
   if (changelist_hash)
     return svn_error_return(new_revert_changelist(db, revert_root,
                                                   local_abspath, depth,
@@ -1826,306 +1748,6 @@ revert_internal(svn_wc__db_t *db,
 
   /* Other depths, throw an error? */
   return SVN_NO_ERROR;
-
-  /* Check cancellation here, so recursive calls get checked early. */
-  if (cancel_func)
-    SVN_ERR(cancel_func(cancel_baton));
-
-
-  /* Safeguard 1: the item must be versioned for any reversion to make sense,
-     except that a tree conflict can exist on an unversioned item. */
-  err = svn_wc__db_read_info(&status, &db_kind,
-                             NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                             NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                             NULL, NULL, NULL, NULL, &have_base, NULL, NULL,
-                             NULL,
-                             db, local_abspath, pool, pool);
-
-  if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
-    {
-      svn_error_clear(err);
-      unversioned = TRUE;
-    }
-  else if (err)
-    return svn_error_return(err);
-  else
-    switch (status)
-      {
-        case svn_wc__db_status_not_present:
-        case svn_wc__db_status_absent:
-        case svn_wc__db_status_excluded:
-          unversioned = TRUE;
-          break;
-        case svn_wc__db_status_incomplete:
-          /* Remove NAME from PATH's entries file
-
-             Not being able to revert incomplete entries breaks working
-             copies flat out, but the usual revert process can't be
-             applied.  Most preconditions aren't met. */
-          SVN_ERR(svn_wc__db_temp_op_remove_entry(db, local_abspath, pool));
-          return SVN_NO_ERROR;
-          break;
-        default:
-          unversioned = FALSE;
-          break;
-      }
-
-  if (! unversioned && have_base)
-    SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, NULL,
-                                     NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                     NULL, NULL, NULL, NULL, NULL, NULL,
-                                     db, local_abspath, pool, pool));
-
-  replaced = ! unversioned && (status == svn_wc__db_status_added
-              && have_base
-              && base_status != svn_wc__db_status_not_present);
-
-  SVN_ERR(svn_wc__db_op_read_tree_conflict(&tree_conflict, db, local_abspath,
-                                           pool, pool));
-  if (unversioned && tree_conflict == NULL)
-    return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
-                             _("Cannot revert unversioned item '%s'"),
-                             svn_dirent_local_style(local_abspath, pool));
-
-  /* Safeguard 1.5:  is this a missing versioned directory? */
-  SVN_ERR(svn_io_check_path(local_abspath, &disk_kind, pool));
-  if (!unversioned && (db_kind == svn_wc__db_kind_dir))
-    {
-      if (disk_kind == svn_node_file)
-        {
-          /* When the directory itself is missing, we can't revert without
-             hitting the network.  Someday a '--force' option will
-             make this happen.  For now, send notification of the failure. */
-          if (notify_func != NULL)
-            {
-              svn_wc_notify_t *notify =
-                svn_wc_create_notify(local_abspath,
-                                     svn_wc_notify_failed_revert,
-                                     pool);
-              notify_func(notify_baton, notify, pool);
-            }
-          return SVN_NO_ERROR;
-        }
-    }
-
-  /* Safeguard 2:  can we handle this entry's recorded kind? */
-  if (!unversioned
-      && (db_kind != svn_wc__db_kind_file)
-      && (db_kind != svn_wc__db_kind_dir)
-      && (db_kind != svn_wc__db_kind_symlink))
-    return svn_error_createf
-      (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
-       _("Cannot revert '%s': unsupported entry node kind"),
-       svn_dirent_local_style(local_abspath, pool));
-
-  /* Safeguard 3:  can we deal with the node kind of PATH currently in
-     the working copy?
-
-     Note: we can reach this point for paths which have tree conflict info
-           set on them.  Those are not necessarily nodes we can version,
-           meaning this check doesn't make sense for unversioned nodes. */
-  if (!unversioned
-      && (disk_kind != svn_node_none)
-      && (disk_kind != svn_node_file)
-      && (disk_kind != svn_node_dir))
-    return svn_error_createf
-      (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
-       _("Cannot revert '%s': unsupported node kind in working copy"),
-       svn_dirent_local_style(local_abspath, pool));
-
-  if (!unversioned && status == svn_wc__db_status_added)
-    SVN_ERR(svn_wc__db_scan_addition(NULL, &op_root_abspath, NULL, NULL,
-                                     NULL, NULL, NULL, NULL, NULL,
-                                     db, local_abspath, pool, pool));
-
-  /* Safeguard 4:  Make sure we don't revert deeper then asked */
-  if (!unversioned
-      && status == svn_wc__db_status_added
-      && db_kind == svn_wc__db_kind_dir
-      && depth >= svn_depth_empty
-      && depth < svn_depth_infinity)
-    {
-      /* If this node is an operation root for a copy/add, then reverting
-         it will change its descendants, if it has any. */
-      if (strcmp(local_abspath, op_root_abspath) == 0)
-        SVN_ERR(verify_revert_depth(db, local_abspath, depth,
-                                    local_abspath, pool));
-    }
-
-  /* If the entry passes changelist filtering, revert it!  */
-  if (svn_wc__internal_changelist_match(db, local_abspath, changelist_hash,
-                                        pool))
-    {
-      const svn_wc_conflict_description2_t *conflict;
-
-      /* Clear any tree conflict on the path, even if it is not a versioned
-         resource. */
-      SVN_ERR(svn_wc__db_op_read_tree_conflict(&conflict, db, local_abspath,
-                                               pool, pool));
-      if (conflict)
-        {
-          SVN_ERR(svn_wc__db_op_set_tree_conflict(db, local_abspath, NULL,
-                                                  pool));
-          reverted = TRUE;
-        }
-
-      /* Actually revert this entry.  If this is a working copy root,
-         we provide a base_name from the parent path. */
-      if (!unversioned)
-        {
-          /* Revert the prop, text and tree mods (if any). */
-          SVN_ERR(svn_wc__wq_add_revert(&reverted, db, revert_root,
-                                        local_abspath, use_commit_times,
-                                        pool));
-          SVN_ERR(svn_wc__wq_run(db, local_abspath,
-                                 cancel_func, cancel_baton, pool));
-
-          /* Force recursion on replaced directories. */
-          if (db_kind == svn_wc__db_kind_dir && replaced)
-            depth = svn_depth_infinity;
-
-        }
-
-      /* Notify */
-      if (notify_func && reverted)
-        (*notify_func)(notify_baton,
-                       svn_wc_create_notify(local_abspath,
-                                            svn_wc_notify_revert, pool),
-                       pool);
-    }
-
-
-  if (op_root_abspath && strcmp(local_abspath, op_root_abspath) == 0)
-    /* If this is a copy or add root, disable notifications for the children,
-       because wc-1.0 used to behave like that. */
-    {
-      notify_func = NULL;
-      notify_baton = NULL;
-    }
-
-  /* Finally, recurse if requested. */
-
-  /* ### This doesn't work properly for added directories.  Reverting
-     ### the parent before the children is wrong, it means node rows
-     ### exist for the children after the parent row is removed.
-     ### Either the wq revert of the parent above has to remove the
-     ### children or this recursion has to do children before parents.
-   */
-  if (!unversioned && db_kind == svn_wc__db_kind_dir && depth > svn_depth_empty)
-    {
-      const apr_array_header_t *children;
-      apr_hash_t *nodes = apr_hash_make(pool);
-      svn_depth_t depth_under_here = depth;
-      int i;
-      apr_pool_t *iterpool = svn_pool_create(pool);
-
-      if (depth == svn_depth_files || depth == svn_depth_immediates)
-        depth_under_here = svn_depth_empty;
-
-      SVN_ERR(svn_wc__db_read_children(&children, db, local_abspath, pool,
-                                       iterpool));
-
-      for (i = 0; i < children->nelts; i++)
-        {
-          const char *name = APR_ARRAY_IDX(children, i, const char *);
-          const char *node_abspath;
-          svn_boolean_t hidden;
-          svn_wc__db_kind_t child_db_kind;
-
-          svn_pool_clear(iterpool);
-
-          node_abspath = svn_dirent_join(local_abspath, name, iterpool);
-
-          SVN_ERR(svn_wc__db_node_hidden(&hidden, db, node_abspath, iterpool));
-
-          if (hidden)
-            continue;
-
-          apr_hash_set(nodes, name, APR_HASH_KEY_STRING, name);
-
-          SVN_ERR(svn_wc__db_read_kind(&child_db_kind, db, node_abspath, FALSE,
-                                       iterpool));
-
-          /* Skip subdirectories if we're called with depth-files. */
-          if ((depth == svn_depth_files) &&
-              (child_db_kind != svn_wc__db_kind_file) &&
-              (child_db_kind != svn_wc__db_kind_symlink))
-            continue;
-
-          /* Revert the entry. */
-          SVN_ERR(revert_internal(db, revert_root, node_abspath,
-                                  depth_under_here, use_commit_times,
-                                  changelist_hash, cancel_func, cancel_baton,
-                                  notify_func, notify_baton, iterpool));
-        }
-
-      /* Visit any unversioned children that are tree conflict victims. */
-      {
-        const apr_array_header_t *conflict_victims;
-
-        /* Loop through all the tree conflict victims */
-        SVN_ERR(svn_wc__db_read_conflict_victims(&conflict_victims,
-                                                 db, local_abspath,
-                                                 pool, pool));
-
-        for (i = 0; i < conflict_victims->nelts; ++i)
-          {
-            int j;
-            const apr_array_header_t *child_conflicts;
-            const char *child_name;
-            const char *child_abspath;
-
-            svn_pool_clear(iterpool);
-
-            child_name = APR_ARRAY_IDX(conflict_victims, i, const char *);
-
-            /* Skip if in this dir's entries, we only want unversioned */
-            if (apr_hash_get(nodes, child_name, APR_HASH_KEY_STRING))
-              continue;
-
-            child_abspath = svn_dirent_join(local_abspath, child_name,
-                                            iterpool);
-
-            SVN_ERR(svn_wc__db_read_conflicts(&child_conflicts,
-                                              db, child_abspath,
-                                              iterpool, iterpool));
-
-            for (j = 0; j < child_conflicts->nelts; ++j)
-              {
-                const svn_wc_conflict_description2_t *conflict =
-                  APR_ARRAY_IDX(child_conflicts, j,
-                                const svn_wc_conflict_description2_t *);
-
-                if (conflict->kind == svn_wc_conflict_kind_tree)
-                  SVN_ERR(revert_internal(db, revert_root,
-                                          conflict->local_abspath,
-                                          svn_depth_empty,
-                                          use_commit_times, changelist_hash,
-                                          cancel_func, cancel_baton,
-                                          notify_func, notify_baton,
-                                          iterpool));
-              }
-          }
-      }
-
-      svn_pool_destroy(iterpool);
-    }
-
-  if (reverted  /* implies !unversioned; only versioned paths get reverted */
-      && ! replaced
-      && status == svn_wc__db_status_added
-      && db_kind == svn_wc__db_kind_dir)
-    {
-      /* Non-replaced directories have their admin area deleted. wc-1.0 */
-      /* In wc-ng, this call does not really delete the admin area - since
-         there isn't one - but it does destroy the adm_access structure
-         which may be cached inside DB, if the DB is used with old entries
-         functions. */
-      SVN_ERR(svn_wc__adm_destroy(db, local_abspath,
-                                  cancel_func, cancel_baton, pool));
-    }
-
-  return SVN_NO_ERROR;
 }