Author: gstein
Date: Tue May 17 13:01:17 2011
New Revision: 1104218

URL: http://svn.apache.org/viewvc?rev=1104218&view=rev
Log:
With the simplification of new_revert_partial() in r1104185, the
REVERT_ROOT parameter is not used. In fact, it is not used by this entire
set of revert functions. So... nuke it. From orbit. It's the only way to
be safe.

Also, fold revert_internal() into svn_wc_revert4().

* subversion/libsvn_wc/adm_ops.c:
  (revert_restore): remove REVERT_ROOT and adjust recursive call.
  (new_revert_internal): remove REVERT_ROOT and adjust call to
    revert_restore().
  (new_revert_changelist): remove REVERT_ROOT and adjust recursive call.
    adjust call to new_revert_internal().
  (new_revert_partial): remove REVERT_ROOT and adjust calls to
    new_revert_internal().
  (revert_internal): removed. folded into ...
  (svn_wc_revert4): ... here. directly call new_revert_changelist() if we
    have any changelist_filters. call new_revert_internal() or
    new_revert_partial() depending upon the DEPTH parameter. add an error
    return for bogus DEPTH values.

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=1104218&r1=1104217&r2=1104218&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue May 17 13:01:17 2011
@@ -1230,7 +1230,6 @@ remove_conflict_file(svn_boolean_t *noti
    for all paths equal to or below LOCAL_ABSPATH that are reverted. */
 static svn_error_t *
 revert_restore(svn_wc__db_t *db,
-               const char *revert_root,
                const char *local_abspath,
                svn_depth_t depth,
                svn_boolean_t use_commit_times,
@@ -1502,7 +1501,7 @@ revert_restore(svn_wc__db_t *db,
                                                         const char *),
                                           iterpool);
 
-          SVN_ERR(revert_restore(db, revert_root, child_abspath, depth,
+          SVN_ERR(revert_restore(db, child_abspath, depth,
                                  use_commit_times,
                                  cancel_func, cancel_baton,
                                  notify_func, notify_baton,
@@ -1525,7 +1524,6 @@ revert_restore(svn_wc__db_t *db,
    reverts. */
 static svn_error_t *
 new_revert_internal(svn_wc__db_t *db,
-                    const char *revert_root,
                     const char *local_abspath,
                     svn_depth_t depth,
                     svn_boolean_t use_commit_times,
@@ -1554,7 +1552,7 @@ new_revert_internal(svn_wc__db_t *db,
   SVN_ERR(svn_wc__db_op_revert(db, local_abspath, depth,
                                scratch_pool, scratch_pool));
 
-  SVN_ERR(revert_restore(db, revert_root, local_abspath, depth,
+  SVN_ERR(revert_restore(db, local_abspath, depth,
                          use_commit_times,
                          cancel_func, cancel_baton,
                          notify_func, notify_baton,
@@ -1568,7 +1566,6 @@ new_revert_internal(svn_wc__db_t *db,
    CHANGELIST_HASH and notify for all reverts. */
 static svn_error_t *
 new_revert_changelist(svn_wc__db_t *db,
-                      const char *revert_root,
                       const char *local_abspath,
                       svn_depth_t depth,
                       svn_boolean_t use_commit_times,
@@ -1589,7 +1586,7 @@ 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, revert_root, local_abspath,
+    SVN_ERR(new_revert_internal(db, local_abspath,
                                 svn_depth_empty, use_commit_times,
                                 cancel_func, cancel_baton,
                                 notify_func, notify_baton,
@@ -1623,7 +1620,7 @@ new_revert_changelist(svn_wc__db_t *db,
                                                     const char *),
                                       iterpool);
 
-      SVN_ERR(new_revert_changelist(db, revert_root, child_abspath, depth,
+      SVN_ERR(new_revert_changelist(db, child_abspath, depth,
                                     use_commit_times, changelist_hash,
                                     cancel_func, cancel_baton,
                                     notify_func, notify_baton,
@@ -1646,7 +1643,6 @@ new_revert_changelist(svn_wc__db_t *db,
    ### partially recursive revert should handle actual-only nodes. */
 static svn_error_t *
 new_revert_partial(svn_wc__db_t *db,
-                   const char *revert_root,
                    const char *local_abspath,
                    svn_depth_t depth,
                    svn_boolean_t use_commit_times,
@@ -1669,7 +1665,7 @@ 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, revert_root, local_abspath, svn_depth_empty,
+  SVN_ERR(new_revert_internal(db, local_abspath, svn_depth_empty,
                               use_commit_times, cancel_func, cancel_baton,
                               notify_func, notify_baton, iterpool));
 
@@ -1699,7 +1695,7 @@ new_revert_partial(svn_wc__db_t *db,
         }
 
       /* Revert just this node (depth=empty).  */
-      SVN_ERR(new_revert_internal(db, revert_root, child_abspath,
+      SVN_ERR(new_revert_internal(db, child_abspath,
                                   svn_depth_empty, use_commit_times,
                                   cancel_func, cancel_baton,
                                   notify_func, notify_baton,
@@ -1712,38 +1708,38 @@ new_revert_partial(svn_wc__db_t *db,
 }
 
 
-/* This is just the guts of svn_wc_revert4() save that it accepts a
-   hash CHANGELIST_HASH whose keys are changelist names instead of an
-   array of said names.  See svn_wc_revert4() for additional
-   documentation. */
-static svn_error_t *
-revert_internal(svn_wc__db_t *db,
-                const char *revert_root,
-                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 *pool)
+svn_error_t *
+svn_wc_revert4(svn_wc_context_t *wc_ctx,
+               const char *local_abspath,
+               svn_depth_t depth,
+               svn_boolean_t use_commit_times,
+               const apr_array_header_t *changelist_filter,
+               svn_cancel_func_t cancel_func,
+               void *cancel_baton,
+               svn_wc_notify_func2_t notify_func,
+               void *notify_baton,
+               apr_pool_t *scratch_pool)
 {
-  if (changelist_hash)
-    return svn_error_return(new_revert_changelist(db, revert_root,
-                                                  local_abspath, depth,
-                                                  use_commit_times,
-                                                  changelist_hash,
-                                                  cancel_func, cancel_baton,
-                                                  notify_func, notify_baton,
-                                                  pool));
+  if (changelist_filter && changelist_filter->nelts)
+    {
+      apr_hash_t *changelist_hash;
+
+      SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelist_filter,
+                                         scratch_pool));
+      return svn_error_return(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_return(new_revert_internal(db, revert_root, local_abspath,
+    return svn_error_return(new_revert_internal(wc_ctx->db, local_abspath,
                                                 depth, use_commit_times,
                                                 cancel_func, cancel_baton,
                                                 notify_func, notify_baton,
-                                                pool));
+                                                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
@@ -1752,41 +1748,14 @@ revert_internal(svn_wc__db_t *db,
      revert too much we could invoke the recursive call above. */
 
   if (depth == svn_depth_files || depth == svn_depth_immediates)
-    return svn_error_return(new_revert_partial(db, revert_root, local_abspath,
+    return svn_error_return(new_revert_partial(wc_ctx->db, local_abspath,
                                                depth, use_commit_times,
                                                cancel_func, cancel_baton,
                                                notify_func, notify_baton,
-                                               pool));
-
-  /* Other depths, throw an error? */
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_wc_revert4(svn_wc_context_t *wc_ctx,
-               const char *local_abspath,
-               svn_depth_t depth,
-               svn_boolean_t use_commit_times,
-               const apr_array_header_t *changelist_filter,
-               svn_cancel_func_t cancel_func,
-               void *cancel_baton,
-               svn_wc_notify_func2_t notify_func,
-               void *notify_baton,
-               apr_pool_t *pool)
-{
-  apr_hash_t *changelist_hash = NULL;
-
-  if (changelist_filter && changelist_filter->nelts)
-    SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelist_filter,
-                                       pool));
+                                               scratch_pool));
 
-  return svn_error_return(revert_internal(wc_ctx->db,
-                                          local_abspath, local_abspath, depth,
-                                          use_commit_times, changelist_hash,
-                                          cancel_func, cancel_baton,
-                                          notify_func, notify_baton,
-                                          pool));
+  /* Bogus depth. Tell the caller.  */
+  return svn_error_create(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL, NULL);
 }
 
 


Reply via email to