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/12 12:47:45 UTC

svn commit: r1091367 - in /subversion/trunk/subversion/libsvn_wc: workqueue.c workqueue.h

Author: philip
Date: Tue Apr 12 10:47:45 2011
New Revision: 1091367

URL: http://svn.apache.org/viewvc?rev=1091367&view=rev
Log:
Remove remains of old wq revert code.

* subversion/libsvn_wc/workqueue.h
  (svn_wc__wq_add_revert): Remove.

* subversion/libsvn_wc/workqueue.c
  (OP_REVERT, maybe_remove_conflict, run_revert, verify_pristine_present,
   svn_wc__wq_add_revert): Remove.
  (dispatch_table): Remove OP_REVERT.

Modified:
    subversion/trunk/subversion/libsvn_wc/workqueue.c
    subversion/trunk/subversion/libsvn_wc/workqueue.h

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=1091367&r1=1091366&r2=1091367&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Tue Apr 12 10:47:45 2011
@@ -41,7 +41,6 @@
 
 
 /* Workqueue operation names.  */
-#define OP_REVERT "revert"
 #define OP_BASE_REMOVE "base-remove"
 #define OP_DELETION_POSTCOMMIT "deletion-postcommit"
 /* Arguments of OP_POSTCOMMIT:
@@ -136,341 +135,6 @@ get_and_record_fileinfo(svn_wc__db_t *db
 
 
 /* ------------------------------------------------------------------------ */
-
-/* OP_REVERT  */
-
-
-/* Remove the file CONFLICT_ABSPATH if it is not the working file
-   defined by LOCAL_ABSPATH. If CONFLICT_ABSPATH is NULL, then nothing
-   is done. All temp allocations are made within SCRATCH_POOL.  */
-static svn_error_t *
-maybe_remove_conflict(const char *conflict_abspath,
-                      const char *local_abspath,
-                      apr_pool_t *scratch_pool)
-{
-  if (conflict_abspath != NULL)
-    {
-      if (strcmp(conflict_abspath, local_abspath) != 0)
-        SVN_ERR(svn_io_remove_file2(conflict_abspath, TRUE,
-                                    scratch_pool));
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
-/* Process the OP_REVERT work item WORK_ITEM.
- * See svn_wc__wq_add_revert() which generates this work item.
- * Implements (struct work_item_dispatch).func. */
-static svn_error_t *
-run_revert(svn_wc__db_t *db,
-           const svn_skel_t *work_item,
-           const char *wri_abspath,
-           svn_cancel_func_t cancel_func,
-           void *cancel_baton,
-           apr_pool_t *scratch_pool)
-{
-  const svn_skel_t *arg1 = work_item->children->next;
-  const char *local_abspath;
-  svn_wc__db_kind_t kind;
-  svn_wc__db_status_t status;
-  const char *parent_abspath;
-  svn_boolean_t conflicted;
-  apr_int64_t val;
-  svn_boolean_t reinstall_working;
-  svn_boolean_t remove_working;
-
-  /* We need a NUL-terminated path, so copy it out of the skel.  */
-  local_abspath = apr_pstrmemdup(scratch_pool, arg1->data, arg1->len);
-
-  SVN_ERR(svn_skel__parse_int(&val, arg1->next, scratch_pool));
-  remove_working = (val != 0);
-
-  SVN_ERR(svn_skel__parse_int(&val, arg1->next->next, scratch_pool));
-  reinstall_working = (val != 0);
-
-  /* use_commit_times is extracted further below.  */
-
-  /* NOTE: we can read KIND here since uncommitted kind changes are not
-     (yet) allowed. If we read any conflict files, then we (obviously) have
-     not removed them from the metadata (yet).  */
-  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,
-            &conflicted, NULL,
-            db, local_abspath,
-            scratch_pool, scratch_pool));
-
-  if (kind == svn_wc__db_kind_dir)
-    {
-      parent_abspath = local_abspath;
-    }
-  else
-    {
-      parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
-    }
-
-  if (conflicted)
-    {
-      const apr_array_header_t *conflicts;
-      int i;
-
-      SVN_ERR(svn_wc__db_read_conflicts(&conflicts, db, local_abspath,
-                                        scratch_pool, scratch_pool));
-
-      for (i = 0; i < conflicts->nelts; i++)
-        {
-          const svn_wc_conflict_description2_t *cd;
-
-          cd = APR_ARRAY_IDX(conflicts, i,
-                             const svn_wc_conflict_description2_t *);
-
-          SVN_ERR(maybe_remove_conflict(cd->base_abspath,
-                                        local_abspath, scratch_pool));
-          SVN_ERR(maybe_remove_conflict(cd->their_abspath,
-                                        local_abspath, scratch_pool));
-          SVN_ERR(maybe_remove_conflict(cd->my_abspath,
-                                        local_abspath, scratch_pool));
-          if (cd->merged_file)
-            SVN_ERR(maybe_remove_conflict(svn_dirent_join(parent_abspath,
-                                                          cd->merged_file,
-                                                          scratch_pool),
-                                          local_abspath, scratch_pool));
-        }
-    }
-
-  /* Reverting the actual node destroys conflict markers and local props.
-     Don't use svn_wc__db_op_set_props() and svn_wc__db_op_mark_resolved()
-     because those leave a record in the ACTUALS table, which is a
-     performance issue.  Besides, this does all that in one blow. */
-  SVN_ERR(svn_wc__db_op_revert_actual(db, local_abspath, scratch_pool));
-
-  /* Deal with the working file, as needed.  */
-  if (kind == svn_wc__db_kind_file)
-    {
-      if (reinstall_working)
-        {
-          svn_boolean_t use_commit_times;
-          svn_skel_t *wi_file_install;
-
-          SVN_ERR(svn_skel__parse_int(&val, arg1->next->next->next,
-                                     scratch_pool));
-          use_commit_times = (val != 0);
-
-          SVN_ERR(svn_wc__wq_build_file_install(&wi_file_install,
-                                                db, local_abspath,
-                                                NULL /* source_abspath */,
-                                                use_commit_times,
-                                                TRUE /* record_fileinfo */,
-                                                scratch_pool, scratch_pool));
-          SVN_ERR(svn_wc__db_wq_add(db, local_abspath, wi_file_install,
-                                    scratch_pool));
-        }
-    }
-  else if (kind == svn_wc__db_kind_symlink)
-    {
-      SVN__NOT_IMPLEMENTED();
-    }
-  else if (reinstall_working && kind == svn_wc__db_kind_dir)
-    {
-      svn_node_kind_t on_disk;
-
-      /* Unfortunately we need another stat(), because I don't want
-         to resort to APR error macros to see if we're creating a
-         directory on top of an existing path */
-      SVN_ERR(svn_io_check_path(local_abspath, &on_disk, scratch_pool));
-      if (on_disk == svn_node_none)
-        SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
-    }
-
-
-  if (remove_working)
-    {
-      SVN_ERR(svn_wc__db_temp_op_remove_working(db, local_abspath,
-                                                scratch_pool));
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
-/* Return an APR_ENOENT error if LOCAL_ABSPATH has no text base.
-
-   For issue #2101, we need to deliver this error. When the wc-ng pristine
-   handling comes into play, the issue should be fixed, and this code can
-   go away.  */
-static svn_error_t *
-verify_pristine_present(svn_wc__db_t *db,
-                        const char *local_abspath,
-                        apr_pool_t *scratch_pool)
-{
-  const svn_checksum_t *base_checksum;
-
-  SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, &base_checksum,
-                               NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL,
-                               db, local_abspath,
-                               scratch_pool, scratch_pool));
-  if (base_checksum != NULL)
-    return SVN_NO_ERROR;
-
-  SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL,
-                                   NULL, NULL, NULL, NULL, NULL,
-                                   &base_checksum, NULL, NULL, NULL, NULL,
-                                   db, local_abspath,
-                                   scratch_pool, scratch_pool));
-  if (base_checksum != NULL)
-    return SVN_NO_ERROR;
-
-  /* A real file must have either a regular or a revert text-base.
-     If it has neither, we could be looking at the situation described
-     in issue #2101, in which case all we can do is deliver the expected
-     error.  */
-  return svn_error_createf(APR_ENOENT, NULL,
-                           _("Error restoring text for '%s'"),
-                           svn_dirent_local_style(local_abspath,
-                                                  scratch_pool));
-}
-
-
-/* Record a work item to revert LOCAL_ABSPATH.  */
-svn_error_t *
-svn_wc__wq_add_revert(svn_boolean_t *will_revert,
-                      svn_wc__db_t *db,
-                      const char *revert_root,
-                      const char *local_abspath,
-                      svn_boolean_t use_commit_times,
-                      apr_pool_t *scratch_pool)
-{
-  svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
-  svn_boolean_t replaced;
-  svn_boolean_t remove_working = FALSE;
-  svn_boolean_t reinstall_working;
-
-  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, local_abspath,
-            scratch_pool, scratch_pool));
-
-  /* Special handling for issue #2101, which is specifically
-     about reverting copies of 'deleted' files and dirs, being inserted
-     in the copy as a schedule-delete files, yet can't be reverted. */
-  if (kind == svn_wc__db_kind_file
-      && status == svn_wc__db_status_deleted)
-    SVN_ERR(verify_pristine_present(db, local_abspath, scratch_pool));
-
-  /* Gather a few items *before* the revert work-item has a chance to run.
-     During its operation, this data could/will change, which means that a
-     potential re-run of the work-item may gather incorrect values.  */
-
-  SVN_ERR(svn_wc__internal_is_replaced(&replaced, db, local_abspath,
-                                       scratch_pool));
-
-  /* If a replacement has occurred, then a revert definitely happens.  */
-  *will_revert = reinstall_working = replaced;
-
-  if (status == svn_wc__db_status_normal)
-    {
-      apr_hash_t *base_props;
-      apr_hash_t *working_props;
-      apr_array_header_t *prop_diffs;
-
-      SVN_ERR(svn_wc__get_pristine_props(&base_props,
-                                         db, local_abspath,
-                                         scratch_pool, scratch_pool));
-      SVN_ERR(svn_wc__get_actual_props(&working_props,
-                                       db, local_abspath,
-                                       scratch_pool, scratch_pool));
-      SVN_ERR(svn_prop_diffs(&prop_diffs, working_props, base_props,
-                             scratch_pool));
-      if (svn_wc__has_magic_property(prop_diffs))
-        reinstall_working = TRUE;
-
-      if (prop_diffs->nelts > 0)
-        {
-          /* Property changes cause a revert to occur.  */
-          *will_revert = TRUE;
-        }
-    }
-  else
-    {
-      *will_revert = TRUE;
-      if (status != svn_wc__db_status_added)
-        reinstall_working = TRUE;
-    }
-
-  /* We may need to restore a missing working file.  */
-  if (! reinstall_working
-      && status != svn_wc__db_status_added)
-    {
-      svn_node_kind_t on_disk;
-
-      SVN_ERR(svn_io_check_path(local_abspath, &on_disk, scratch_pool));
-      reinstall_working = (on_disk == svn_node_none);
-      *will_revert = *will_revert || reinstall_working;
-    }
-
-  if (! reinstall_working
-      && status == svn_wc__db_status_normal)
-    {
-      /* ### there may be ways to simplify this test, rather than
-         ### doing file comparisons and junk... */
-      SVN_ERR(svn_wc__internal_text_modified_p(&reinstall_working,
-                                               db, local_abspath,
-                                               FALSE, FALSE,
-                                               scratch_pool));
-      *will_revert = *will_revert || reinstall_working;
-    }
-
-
-  if (! remove_working
-      && status == svn_wc__db_status_added)
-    {
-      /* When looking at an added, non-replacing node, its entry
-         will have to be removed after revert: if not, it'll look
-         like it's still under version control. */
-      const char *op_root_abspath;
-
-      SVN_ERR(svn_wc__db_scan_addition(NULL, &op_root_abspath, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL,
-                                       db, local_abspath,
-                                       scratch_pool, scratch_pool));
-
-      if (svn_dirent_is_ancestor(revert_root, op_root_abspath))
-        remove_working = TRUE;
-    }
-  else
-    remove_working = TRUE;
-
-
-  /* Don't even bother to queue a work item if there is nothing to do.  */
-  if (*will_revert)
-    {
-      svn_skel_t *work_item;
-
-      work_item = svn_skel__make_empty_list(scratch_pool);
-
-      /* These skel atoms hold references to very transitory state, but
-         we only need the work_item to survive for the duration of wq_add.  */
-      svn_skel__prepend_int(use_commit_times, work_item, scratch_pool);
-      svn_skel__prepend_int(reinstall_working, work_item, scratch_pool);
-      svn_skel__prepend_int(remove_working, work_item, scratch_pool);
-      svn_skel__prepend_str(local_abspath, work_item, scratch_pool);
-      svn_skel__prepend_str(OP_REVERT, work_item, scratch_pool);
-
-      SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, scratch_pool));
-    }
-
-  return SVN_NO_ERROR;
-}
-
-/* ------------------------------------------------------------------------ */
 /* OP_REMOVE_BASE  */
 
 /* Removes a BASE_NODE and all it's data, leaving any adds and copies as is.
@@ -2111,7 +1775,6 @@ svn_wc__wq_build_pristine_get_translated
 /* ------------------------------------------------------------------------ */
 
 static const struct work_item_dispatch dispatch_table[] = {
-  { OP_REVERT, run_revert },
   { OP_DELETION_POSTCOMMIT, run_deletion_postcommit },
   { OP_POSTCOMMIT, run_postcommit },
   { OP_FILE_INSTALL, run_file_install },

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.h?rev=1091367&r1=1091366&r2=1091367&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.h Tue Apr 12 10:47:45 2011
@@ -196,16 +196,6 @@ svn_wc__wq_build_record_fileinfo(svn_ske
                                  apr_pool_t *result_pool);
 
 
-/* Record a work item to revert LOCAL_ABSPATH;
-   REVERT_ROOT designates the root of the entire revert operation. */
-svn_error_t *
-svn_wc__wq_add_revert(svn_boolean_t *will_revert,
-                      svn_wc__db_t *db,
-                      const char *revert_root,
-                      const char *local_abspath,
-                      svn_boolean_t use_commit_times,
-                      apr_pool_t *scratch_pool);
-
 /* Set *WORK_ITEM to a new work item that will remove all the data of
    the BASE_NODE of LOCAL_ABSPATH and all it's descendants, but keeping
    any WORKING_NODE data.