You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/03/19 06:43:03 UTC

svn commit: r925099 - in /subversion/trunk/subversion: libsvn_wc/adm_ops.c libsvn_wc/props.c libsvn_wc/props.h libsvn_wc/upgrade.c libsvn_wc/wc_db.c libsvn_wc/wc_db.h libsvn_wc/workqueue.c tests/libsvn_wc/db-test.c

Author: gstein
Date: Fri Mar 19 05:43:02 2010
New Revision: 925099

URL: http://svn.apache.org/viewvc?rev=925099&view=rev
Log:
Revamp some of the wc-ng property handling code.

In particular, svn_wc__db_temp_op_set_pristine_props() used a boolean flag
to alter semantics; this revision splits that into two separate functions
to make it very clear which properties are being set (BASE or WORKING).

Some of the wc_db property funcs were tightened up around their declared
semantics (e.g must provide props; not NULL).

* subversion/libsvn_wc/wc_db.h:
  (svn_wc__db_base_get_props, svn_wc__db_read_props,
      svn_wc__db_read_pristine_props): note that NULL will never be
    returned from these functions
  (svn_wc__db_temp_op_set_pristine_props): removed in favor of ...
  (svn_wc__db_temp_base_set_props, svn_wc__db_temp_working_set_props): ...
    these two new functions. they explicitly set the props for a BASE or a
    WORKING node. add explanation for why these should (not) exist.
    document the error if the underlying node does not exist.

* subversion/libsvn_wc/wc_db.c:
  (svn_wc__db_base_get_props): return an empty hash rather than NULL. note
    that we may want to turn this into a DB error instead.
  (svn_wc__db_temp_op_set_pristine_props): rename into ...
  (set_properties): ... this new private function and rejigger the
    arguments to pass a statement index and a table name for any error.
  (svn_wc__db_temp_base_set_props, svn_wc__db_temp_working_set_props): new
    functions to call set_properties() for the BASE and WORKING trees
  (svn_wc__db_pristine_props): if there is a WORKING row, then we never
    look at the BASE_NODE table. rejigger accordingly. note that a null
    properties column *may* be okay in WORKING_NODE. regardless, ensure
    that we always return an empty set of props rather than NULL.

* subversion/libsvn_wc/adm_ops.c:
  (mark_item_copied, svn_wc_add4): use svn_wc__db_temp_working_set_props()
    explicitly rather than a flag to the old set_pristine_props. add some
    comments to svn_wc_add4 noting how the PROPS localvar is set/used.

* subversion/libsvn_wc/props.h:
* subversion/libsvn_wc/props.c:
  (svn_wc__prop_pristine_is_working): unused. removed.

* subversion/libsvn_wc/upgrade.c:
  (migrate_props): adjust doc and code: if the revert props exist, then we
    always used them (no need to look at DB state). when migrating
    "base_props" to wc-ng, we (now) attempt to write them to WORKING and,
    failing that, write them to BASE. no real need to look at the node
    status since (by definition) if a WORKING row exists, then the
    "base_props" file is associated with WORKING rather than the BASE
    tree. also use the new wc_db APIs for setting props.

* subversion/libsvn_wc/workqueue.c:
  (run_revert, run_prepare_revert_files): these two functions stored empty
    properties into the WORKING table, which is bogus. switch the function
    over, #if it out, and leave comments describing why this is wrong
  (run_install_properties): adjust the code to attempt to write to WORKING
    properties first, and then fall back to writing BASE properties. in
    the future, callers should already know *which* props to set, but this
    is the most compatible with current expectations.

* subversion/tests/libsvn_wc/db-test.c:
  (validate_note): remove spurious call to set_pristine_props

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/props.c
    subversion/trunk/subversion/libsvn_wc/props.h
    subversion/trunk/subversion/libsvn_wc/upgrade.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/libsvn_wc/workqueue.c
    subversion/trunk/subversion/tests/libsvn_wc/db-test.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=925099&r1=925098&r2=925099&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Fri Mar 19 05:43:02 2010
@@ -1204,9 +1204,9 @@ mark_item_copied(svn_wc__db_t *db,
   SVN_ERR(svn_wc__entry_modify2(db, local_abspath, kind, FALSE, &tmp_entry,
                                 SVN_WC__ENTRY_MODIFY_COPIED, scratch_pool));
 
-  /* Reinstall the pristine properties on working */
-  SVN_ERR(svn_wc__db_temp_op_set_pristine_props(db, local_abspath, props,
-                                                TRUE, scratch_pool));
+  /* Reinstall the pristine properties on WORKING */
+  SVN_ERR(svn_wc__db_temp_working_set_props(db, local_abspath, props,
+                                            scratch_pool));
   
   return SVN_NO_ERROR;
 }
@@ -1453,8 +1453,14 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
      we might delete the base table */
   if ((exists && status != svn_wc__db_status_not_present)
       && !is_replace && copyfrom_url != NULL)
-    SVN_ERR(svn_wc__db_read_pristine_props(&props, db, local_abspath,
-                                           pool, pool));
+    {
+      /* NOTE: the conditions to reach here *exactly* match the
+         conditions used below when PROPS is referenced.
+         Be careful to keep these sets of conditionals aligned to avoid
+         an uninitialized PROPS value.  */
+      SVN_ERR(svn_wc__db_read_pristine_props(&props, db, local_abspath,
+                                             pool, pool));
+    }
 
   /* Now, add the entry for this item to the parent_dir's
      entries file, marking it for addition. */
@@ -1612,12 +1618,20 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
   if (exists && status != svn_wc__db_status_not_present)
     {
       if (!is_replace && copyfrom_url != NULL)
-        SVN_ERR(svn_wc__db_temp_op_set_pristine_props(db, local_abspath, props,
-                                                      TRUE, pool));
+        {
+          /* NOTE: the conditions to reach here *exactly* match the
+             conditions that were used to initialize the PROPS localvar.
+             Be careful to keep these sets of conditionals aligned to avoid
+             an uninitialized PROPS value.  */
+          SVN_ERR(svn_wc__db_temp_working_set_props(db, local_abspath, props,
+                                                    pool));
+        }
       else
-        SVN_ERR(svn_wc__db_temp_op_set_pristine_props(db, local_abspath,
-                                                      apr_hash_make(pool),
-                                                      TRUE, pool));
+        {
+          SVN_ERR(svn_wc__db_temp_working_set_props(db, local_abspath,
+                                                    apr_hash_make(pool),
+                                                    pool));
+        }
     }
 
   /* Report the addition to the caller. */

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=925099&r1=925098&r2=925099&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Fri Mar 19 05:43:02 2010
@@ -266,58 +266,6 @@ get_existing_prop_reject_file(const char
 /*---------------------------------------------------------------------*/
 
 
-/* Temporary helper for determining where to store pristine properties.
-   All calls will eventually be replaced by direct wc_db operations
-   of the right type. */
-svn_error_t *
-svn_wc__prop_pristine_is_working(svn_boolean_t *working,
-                                 svn_wc__db_t *db,
-                                 const char *local_abspath,
-                                 apr_pool_t *scratch_pool)
-{
-  svn_wc__db_status_t status;
-  svn_boolean_t base_shadowed;
-  *working = TRUE;
-
-  SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL,
-                               &base_shadowed, NULL, NULL,
-                               db, local_abspath, scratch_pool, scratch_pool));
-
-  switch (status)
-    {
-      case svn_wc__db_status_normal:
-        *working = FALSE;
-        break;
-      case svn_wc__db_status_incomplete:
-        *working = base_shadowed;
-        break;
-      case svn_wc__db_status_deleted:
-        /* ### This call fails in some update_editor scenarios, because
-               the parent directory can be incomplete. In this specific
-               case a caller MUST provide the right location itself.
-               (Which (in this case) is always the BASE_NODE table)*/
-        SVN_ERR(svn_wc__db_scan_deletion(NULL, working, NULL, NULL, db,
-                                         local_abspath, scratch_pool,
-                                         scratch_pool));
-        break;
-      case svn_wc__db_status_added:
-        break;
-      case svn_wc__db_status_not_present:
-      case svn_wc__db_status_absent:
-      case svn_wc__db_status_excluded:
-        SVN_ERR_ASSERT(0 && "Node not here");
-      case svn_wc__db_status_obstructed:
-      case svn_wc__db_status_obstructed_add:
-      case svn_wc__db_status_obstructed_delete:
-        SVN_ERR_ASSERT(0 && "Node misses property information");
-      default:
-        SVN_ERR_ASSERT(0 && "Unhandled status");
-    }
-
-  return SVN_NO_ERROR;
-}
 
 /*** Loading regular properties. ***/
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_wc/props.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.h?rev=925099&r1=925098&r2=925099&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.h (original)
+++ subversion/trunk/subversion/libsvn_wc/props.h Fri Mar 19 05:43:02 2010
@@ -231,16 +231,6 @@ svn_wc__marked_as_binary(svn_boolean_t *
                          apr_pool_t *scratch_pool);
 
 
-/* Temporary helper for determining where to store pristine properties.
-   All calls will eventually be replaced by direct wc_db operations
-   of the right type. */
-svn_error_t *
-svn_wc__prop_pristine_is_working(svn_boolean_t *working,
-                                 svn_wc__db_t *db,
-                                 const char *local_abspath,
-                                 apr_pool_t *scratch_pool);
-
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=925099&r1=925098&r2=925099&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Fri Mar 19 05:43:02 2010
@@ -905,7 +905,7 @@ migrate_props(const char *wcroot_abspath
      (since we aren't yet in a centralized system), and for any properties that
      exist, map them as follows:
 
-     if (node is replaced):
+     if (revert props exist):
        revert  -> BASE
        base    -> WORKING
        working -> ACTUAL
@@ -916,6 +916,8 @@ migrate_props(const char *wcroot_abspath
        base    -> BASE
        working -> ACTUAL
 
+     ### the middle "test" should simply look for a WORKING_NODE row
+
      Note that it is legal for "working" props to be missing. That implies
      no local changes to the properties.
   */
@@ -980,32 +982,33 @@ migrate_props(const char *wcroot_abspath
       SVN_ERR(read_propfile(&base_props, prop_base_path, iterpool, iterpool));
       SVN_ERR_ASSERT(base_props != NULL);
 
-      /* if node is replaced ... */
-      SVN_ERR(svn_wc__internal_is_replaced(&replaced, db, child_abspath,
-                                           iterpool));
-      if (replaced)
+      SVN_ERR(read_propfile(&revert_props, prop_revert_path,
+                            iterpool, iterpool));
+      if (revert_props != NULL)
         {
-          apr_hash_t *revert_props;
-
-          SVN_ERR(read_propfile(&revert_props, prop_revert_path,
-                                iterpool, iterpool));
-          SVN_ERR_ASSERT(revert_props != NULL);
-
-          SVN_ERR(svn_wc__db_temp_op_set_pristine_props(db, child_abspath,
-                                                        revert_props, FALSE,
-                                                        iterpool));
-          SVN_ERR(svn_wc__db_temp_op_set_pristine_props(db, child_abspath,
-                                                        base_props, TRUE,
-                                                        iterpool));
+          SVN_ERR(svn_wc__db_temp_base_set_props(db, child_abspath,
+                                                 revert_props, iterpool));
+          SVN_ERR(svn_wc__db_temp_working_set_props(db, child_abspath,
+                                                    base_props, iterpool));
         }
       else
         {
-          SVN_ERR(svn_wc__prop_pristine_is_working(&pristine_is_working, db,
-                                                   child_abspath, iterpool));
-          SVN_ERR(svn_wc__db_temp_op_set_pristine_props(db, child_abspath,
-                                                        base_props,
-                                                        pristine_is_working,
-                                                        iterpool));
+          /* Try writing to the WORKING tree first.  */
+          err = svn_wc__db_temp_working_set_props(db, local_abspath,
+                                                  base_props,
+                                                  scratch_pool);
+          if (err)
+            {
+              if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+                return svn_error_return(err);
+              svn_error_clear(err);
+
+              /* The WORKING node is not present. Try writing to the
+                 BASE node now.  */
+              SVN_ERR(svn_wc__db_temp_base_set_props(db, local_abspath,
+                                                     base_props,
+                                                     scratch_pool));
+            }
         }
 
       /* If the properties file does not exist, then that simply means

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=925099&r1=925098&r2=925099&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Mar 19 05:43:02 2010
@@ -2261,6 +2261,12 @@ svn_wc__db_base_get_props(apr_hash_t **p
 
   err = svn_sqlite__column_properties(props, stmt, 0, result_pool,
                                       scratch_pool);
+  if (err == NULL && *props == NULL)
+    {
+      /* ### is this a DB constraint violation? the column "probably" should
+         ### never be null.  */
+      *props = apr_hash_make(result_pool);
+    }
 
   return svn_error_compose_create(err, svn_sqlite__reset(stmt));
 }
@@ -2636,18 +2642,22 @@ svn_wc__db_op_set_props(svn_wc__db_t *db
                                          scratch_pool));
 }
 
-svn_error_t *
-svn_wc__db_temp_op_set_pristine_props(svn_wc__db_t *db,
-                                      const char *local_abspath,
-                                      const apr_hash_t *props,
-                                      svn_boolean_t on_working,
-                                      apr_pool_t *scratch_pool)
+
+/* Set properties in a given table. The row must exist.  */
+static svn_error_t *
+set_properties(svn_wc__db_t *db,
+               const char *local_abspath,
+               const apr_hash_t *props,
+               int stmt_idx,
+               const char *table_name,
+               apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
   int affected_rows;
-  SVN_ERR(get_statement_for_path(&stmt, db, local_abspath,
-                                 on_working ? STMT_UPDATE_WORKING_PROPS
-                                            : STMT_UPDATE_BASE_PROPS,
+
+  SVN_ERR_ASSERT(props != NULL);
+
+  SVN_ERR(get_statement_for_path(&stmt, db, local_abspath, stmt_idx,
                                  scratch_pool));
 
   SVN_ERR(svn_sqlite__bind_properties(stmt, 3, props, scratch_pool));
@@ -2658,11 +2668,38 @@ svn_wc__db_temp_op_set_pristine_props(sv
                              _("Can't store properties for '%s' in '%s'."),
                              svn_dirent_local_style(local_abspath,
                                                     scratch_pool),
-                             on_working ? "working_node" : "base_node");
+                             table_name);
 
   return SVN_NO_ERROR;
 }
 
+
+svn_error_t *
+svn_wc__db_temp_base_set_props(svn_wc__db_t *db,
+                               const char *local_abspath,
+                               const apr_hash_t *props,
+                               apr_pool_t *scratch_pool)
+{
+  return svn_error_return(set_properties(db, local_abspath, props,
+                                         STMT_UPDATE_BASE_PROPS,
+                                         "base_node",
+                                         scratch_pool));
+}
+
+
+svn_error_t *
+svn_wc__db_temp_working_set_props(svn_wc__db_t *db,
+                                  const char *local_abspath,
+                                  const apr_hash_t *props,
+                                  apr_pool_t *scratch_pool)
+{
+  return svn_error_return(set_properties(db, local_abspath, props,
+                                         STMT_UPDATE_WORKING_PROPS,
+                                         "working_node",
+                                         scratch_pool));
+}
+
+
 svn_error_t *
 svn_wc__db_op_delete(svn_wc__db_t *db,
                      const char *local_abspath,
@@ -3977,6 +4014,7 @@ svn_wc__db_read_props(apr_hash_t **props
   if (have_row)
     return SVN_NO_ERROR;
 
+  /* No local changes. Return the pristine props for this node.  */
   return svn_error_return(
       svn_wc__db_read_pristine_props(props, db, local_abspath,
                                      result_pool, scratch_pool));
@@ -3991,36 +4029,41 @@ svn_wc__db_read_pristine_props(apr_hash_
                                apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
-  svn_boolean_t have_row, have_value;
-  svn_error_t *err = NULL;
+  svn_boolean_t have_row;
+  svn_error_t *err;
+
   *props = NULL;
 
   SVN_ERR(get_statement_for_path(&stmt, db, local_abspath,
                                  STMT_SELECT_WORKING_PROPS, scratch_pool));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
-  if (have_row && !svn_sqlite__column_is_null(stmt, 0))
+  /* If there is a WORKING row, then we're done.
+
+     For adds/copies/moves, then properties are in this row.
+     For deletes, there are no properties.
+
+     Regardless, we never look at BASE. The properties (or not) are here.  */
+  if (have_row)
     {
-      have_value = TRUE;
       err = svn_sqlite__column_properties(props, stmt, 0, result_pool,
                                           scratch_pool);
+      SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
+      if (*props == NULL)
+        {
+          /* ### is this a DB constraint violation? the column "probably"
+             ### should never be null. maybe we should leave it null for
+             ### delete operations, so this is okay.  */
+          *props = apr_hash_make(result_pool);
+        }
+      return SVN_NO_ERROR;
     }
-  else
-    have_value = FALSE;
-
-  SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
-
-  if (have_value)
-    return SVN_NO_ERROR;
-
-  err = svn_wc__db_base_get_props(props, db, local_abspath,
-                                  result_pool, scratch_pool);
-
-  if (err && (!have_row || err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND))
-    return svn_error_return(err);
+  SVN_ERR(svn_sqlite__reset(stmt));
 
-  svn_error_clear(err);
-  return SVN_NO_ERROR;
+  /* No WORKING node, so the props must be in the BASE node.  */
+  return svn_error_return(svn_wc__db_base_get_props(props, db, local_abspath,
+                                                    result_pool,
+                                                    scratch_pool));
 }
 
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=925099&r1=925098&r2=925099&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri Mar 19 05:43:02 2010
@@ -659,6 +659,7 @@ svn_wc__db_base_get_prop(const svn_strin
 
    *PROPS maps "const char *" names to "const svn_string_t *" values.
    If the node has no properties, set *PROPS to an empty hash.
+   *PROPS will never be set to NULL.
    If the node is not present in the BASE tree, return an error.
    Allocate *PROPS and its keys and values in RESULT_POOL.
 */
@@ -943,20 +944,38 @@ svn_wc__db_op_set_props(svn_wc__db_t *db
                         apr_hash_t *props,
                         apr_pool_t *scratch_pool);
 
-/* Set the properties of the node LOCAL_ABSPATH in the BASE tree (if
-   ON_WORKING is FALSE) or in the WORKING tree (if ON_WORKING is TRUE) to
-   PROPS.
+/* ### Set the properties of the node LOCAL_ABSPATH in the BASE tree to PROPS.
+   ###
+   ### This function should not exist because properties should be stored
+   ### onto the BASE node at construction time, in a single atomic operation.
+   ###
+   ### PROPS maps "const char *" names to "const svn_string_t *" values.
+   ### To specify no properties, PROPS must be an empty hash, not NULL.
+   ### If the node is not present, SVN_ERR_WC_PATH_NOT_FOUND is returned.
+*/
+svn_error_t *
+svn_wc__db_temp_base_set_props(svn_wc__db_t *db,
+                               const char *local_abspath,
+                               const apr_hash_t *props,
+                               apr_pool_t *scratch_pool);
 
-   PROPS maps "const char *" names to "const svn_string_t *" values.
-   To specify no properties, PROPS must be an empty hash, not NULL.
-   If the node is not present in the specified tree, return an error.
+
+/* ### Set the properties of the node LOCAL_ABSPATH in the WORKING tree
+   ### to PROPS.
+   ###
+   ### This function should not exist because properties should be stored
+   ### onto the WORKING node at construction time, in a single atomic
+   ### operation.
+   ###
+   ### PROPS maps "const char *" names to "const svn_string_t *" values.
+   ### To specify no properties, PROPS must be an empty hash, not NULL.
+   ### If the node is not present, SVN_ERR_WC_PATH_NOT_FOUND is returned.
 */
 svn_error_t *
-svn_wc__db_temp_op_set_pristine_props(svn_wc__db_t *db,
-                                      const char *local_abspath,
-                                      const apr_hash_t *props,
-                                      svn_boolean_t on_working,
-                                      apr_pool_t *scratch_pool);
+svn_wc__db_temp_working_set_props(svn_wc__db_t *db,
+                                  const char *local_abspath,
+                                  const apr_hash_t *props,
+                                  apr_pool_t *scratch_pool);
 
 
 /* ### KFF: This handles files, dirs, symlinks, anything else? */
@@ -1273,6 +1292,7 @@ svn_wc__db_read_prop(const svn_string_t 
 
    PROPS maps "const char *" names to "const svn_string_t *" values.
    If the node has no properties, set *PROPS to an empty hash.
+   *PROPS will never be set to NULL.
    If the node is not present, return an error.
    Allocate *PROPS and its keys and values in RESULT_POOL.
 */
@@ -1289,6 +1309,7 @@ svn_wc__db_read_props(apr_hash_t **props
 
    *PROPS maps "const char *" names to "const svn_string_t *" values.
    If the node has no properties, set *PROPS to an empty hash.
+   *PROPS will never be set to NULL.
    If the node is not present, return an error.
    Allocate *PROPS and its keys and values in RESULT_POOL.
 */

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=925099&r1=925098&r2=925099&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Fri Mar 19 05:43:02 2010
@@ -220,8 +220,14 @@ run_revert(svn_wc__db_t *db,
       SVN_ERR(move_if_present(revert_props_path, base_props_path,
                               scratch_pool));
 
-      SVN_ERR(svn_wc__db_temp_op_set_pristine_props(db, local_abspath, NULL,
-                                                    TRUE, scratch_pool));
+      /* ### we should also be setting BASE props. and really... we shouldn't
+         ### even bother zero-ing out these props. the WORKING node should
+         ### be disappearing after a revert.  */
+#if 0
+      SVN_ERR(svn_wc__db_temp_working_set_props(db, local_abspath,
+                                                apr_hash_make(scratch_pool),
+                                                scratch_pool));
+#endif
     }
 
   /* The "working" props contain changes. Nuke 'em from orbit.  */
@@ -677,10 +683,14 @@ run_prepare_revert_files(svn_wc__db_t *d
                                         scratch_pool));
     }
 
-  /* Stop intheriting BASE_NODE properties */
-  SVN_ERR(svn_wc__db_temp_op_set_pristine_props(db, local_abspath,
-                                                apr_hash_make(scratch_pool),
-                                                TRUE, scratch_pool));
+  /* Put some blank properties into the WORKING node.  */
+  /* ### this seems bogus. something else should come along and put the
+     ### correct values in here. we shouldn't put empty values in.  */
+#if 0
+  SVN_ERR(svn_wc__db_temp_working_set_props(db, local_abspath,
+                                            apr_hash_make(scratch_pool),
+                                            scratch_pool));
+#endif
 
   return SVN_NO_ERROR;
 }
@@ -1671,17 +1681,33 @@ run_install_properties(svn_wc__db_t *db,
         }
 
       {
-        svn_boolean_t in_working;
+        svn_boolean_t written = FALSE;
 
-        if (force_base_install)
-          in_working = FALSE;
-        else
-          SVN_ERR(svn_wc__prop_pristine_is_working(&in_working, db,
-                                                   local_abspath, scratch_pool));
-
-        SVN_ERR(svn_wc__db_temp_op_set_pristine_props(db, local_abspath,
-                                                      base_props, in_working,
-                                                      scratch_pool));
+        if (!force_base_install)
+          {
+            svn_error_t *err;
+
+            /* Try writing to the WORKING tree first.  */
+            err = svn_wc__db_temp_working_set_props(db, local_abspath,
+                                                    base_props,
+                                                    scratch_pool);
+            if (err)
+              {
+                if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+                  return svn_error_return(err);
+                svn_error_clear(err);
+                /* The WORKING node is not present.  */
+              }
+            else
+              {
+                /* The WORKING node is present, and we wrote the props.  */
+                written = TRUE;
+              }
+          }
+
+        if (!written)
+          SVN_ERR(svn_wc__db_temp_base_set_props(db, local_abspath,
+                                                 base_props, scratch_pool));
       }
     }
 

Modified: subversion/trunk/subversion/tests/libsvn_wc/db-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/db-test.c?rev=925099&r1=925098&r2=925099&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/db-test.c Fri Mar 19 05:43:02 2010
@@ -649,10 +649,6 @@ validate_node(svn_wc__db_t *db,
   value = apr_hash_get(props, "p999", APR_HASH_KEY_STRING);
   SVN_TEST_ASSERT(value != NULL && strcmp(value->data, "v1") == 0);
 
-  if (status == svn_wc__db_status_normal)
-    SVN_ERR(svn_wc__db_temp_op_set_pristine_props(db, path, props, FALSE,
-                                                  scratch_pool));
-
   return SVN_NO_ERROR;
 }