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/05/08 08:47:00 UTC

svn commit: r942320 - in /subversion/trunk/subversion: libsvn_wc/props.c 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: Sat May  8 06:47:00 2010
New Revision: 942320

URL: http://svn.apache.org/viewvc?rev=942320&view=rev
Log:
Enable db_op_set_props() to record a conflict and (transactionally) queue
work items.

* subversion/libsvn_wc/wc_db.h:
  (svn_wc__db_op_set_props): accept CONFLICT and WORK_ITEMS params

* subversion/libsvn_wc/wc_db.c:
  (struct set_props_baton): record CONFLICT and WORK_ITEMS values
  (set_props_txn): note that we cannot handle a conflict yet. queue any
    provided work items.
  (svn_wc__db_op_set_props): accept CONFLICT and WORK_ITEMS params, then
    stash them into the baton.

* subversion/libsvn_wc/props.c:
  (immediate_install_props): pass NULL values for the new op_set_props
    parameters.

* subversion/libsvn_wc/upgrade.c:
  (migrate_props): pass NULL values for the new op_set_props parameters.

* subversion/libsvn_wc/workqueue.c:
  (run_revert, run_install_properties): pass NULL values for the new
    op_set_props parameters.

* subversion/tests/libsvn_wc/db-test.c:
  (validate_node): pass NULL values for the new op_set_props parameters.

Modified:
    subversion/trunk/subversion/libsvn_wc/props.c
    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/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=942320&r1=942319&r2=942320&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Sat May  8 06:47:00 2010
@@ -435,6 +435,7 @@ immediate_install_props(svn_wc__db_t *db
   SVN_ERR(svn_wc__db_op_set_props(db, local_abspath,
                                   (prop_diffs->nelts > 0) ? working_props
                                                           : NULL,
+                                  NULL, NULL,
                                   scratch_pool));
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=942320&r1=942319&r2=942320&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Sat May  8 06:47:00 2010
@@ -1018,7 +1018,7 @@ migrate_props(const char *wcroot_abspath
       if (working_props != NULL)
         {
           SVN_ERR(svn_wc__db_op_set_props(db, child_abspath, working_props,
-                                          iterpool));
+                                          NULL, NULL, iterpool));
         }
     }
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=942320&r1=942319&r2=942320&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sat May  8 06:47:00 2010
@@ -2846,10 +2846,15 @@ svn_wc__db_op_add_symlink(svn_wc__db_t *
 struct set_props_baton
 {
   apr_hash_t *props;
+
   const char *local_relpath;
   svn_wc__db_pdh_t *pdh;
+
+  const svn_skel_t *conflict;
+  const svn_skel_t *work_items;
 };
 
+
 /* Set the 'properties' column in the 'ACTUAL_NODE' table to BATON->props.
    Create an entry in the ACTUAL table for the node if it does not yet
    have one.
@@ -2862,20 +2867,22 @@ set_props_txn(void *baton, svn_sqlite__d
   svn_sqlite__stmt_t *stmt;
   int affected_rows;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, db, STMT_UPDATE_ACTUAL_PROPS));
+  /* ### we dunno what to do with CONFLICT yet.  */
+  SVN_ERR_ASSERT(spb->conflict == NULL);
 
+  /* First order of business: insert all the work items.  */
+  SVN_ERR(add_work_items(db, spb->work_items, scratch_pool));
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, db, STMT_UPDATE_ACTUAL_PROPS));
   SVN_ERR(svn_sqlite__bindf(stmt, "is", spb->pdh->wcroot->wc_id,
                             spb->local_relpath));
-
   SVN_ERR(svn_sqlite__bind_properties(stmt, 3, spb->props, scratch_pool));
   SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
 
   if (affected_rows == 1)
     return SVN_NO_ERROR; /* We are done */
 
-
   /* We have to insert a row in actual */
-  /* ### Check if we have base or working here ? */
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, db, STMT_INSERT_ACTUAL_PROPS));
 
@@ -2895,10 +2902,15 @@ svn_error_t *
 svn_wc__db_op_set_props(svn_wc__db_t *db,
                         const char *local_abspath,
                         apr_hash_t *props,
+                        const svn_skel_t *conflict,
+                        const svn_skel_t *work_items,
                         apr_pool_t *scratch_pool)
 {
   struct set_props_baton spb;
+
   spb.props = props;
+  spb.conflict = conflict;
+  spb.work_items = work_items;
 
   SVN_ERR(parse_local_abspath(&spb.pdh, &spb.local_relpath, db, local_abspath,
                               svn_sqlite__mode_readwrite,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=942320&r1=942319&r2=942320&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sat May  8 06:47:00 2010
@@ -1017,17 +1017,26 @@ svn_wc__db_op_add_symlink(svn_wc__db_t *
    To specify no properties, PROPS must be an empty hash, not NULL.
    If the node is not present, return an error.
 
-   @note: This will overwrite whatever working properties the node currently
+   CONFLICT is used to register a conflict on this node at the same time
+   the properties are changed.
+
+   WORK_ITEMS are inserted into the work queue, as additional things that
+   need to be completed before the working copy is stable.
+
+   NOTE: This will overwrite ALL working properties the node currently
    has. There is no db_op_set_prop() function. Callers must read all the
    properties, change one, and write all the properties.
+   ### ugh. this has poor transaction semantics...
 
-   @note: This will create an entry in the ACTUAL table for the node if it
+   NOTE: This will create an entry in the ACTUAL table for the node if it
    does not yet have one.
 */
 svn_error_t *
 svn_wc__db_op_set_props(svn_wc__db_t *db,
                         const char *local_abspath,
                         apr_hash_t *props,
+                        const svn_skel_t *conflict,
+                        const svn_skel_t *work_items,
                         apr_pool_t *scratch_pool);
 
 /* ### Set the properties of the node LOCAL_ABSPATH in the BASE tree to PROPS.

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=942320&r1=942319&r2=942320&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Sat May  8 06:47:00 2010
@@ -231,7 +231,8 @@ run_revert(svn_wc__db_t *db,
                             kind, svn_wc__props_working, scratch_pool));
   SVN_ERR(svn_io_remove_file2(working_props_path, TRUE, scratch_pool));
 
-  SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, NULL, scratch_pool));
+  SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, NULL, NULL, NULL,
+                                  scratch_pool));
 
   /* Deal with the working file, as needed.  */
   if (kind == svn_wc__db_kind_file)
@@ -1683,7 +1684,7 @@ run_install_properties(svn_wc__db_t *db,
   }
 
   SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, actual_props,
-                                  scratch_pool));
+                                  NULL, NULL, scratch_pool));
 
   return SVN_NO_ERROR;
 }

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=942320&r1=942319&r2=942320&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/db-test.c Sat May  8 06:47:00 2010
@@ -642,7 +642,7 @@ validate_node(svn_wc__db_t *db,
   /* Now add a property value and read it back (all on actual) */
   apr_hash_set(props, "p999", APR_HASH_KEY_STRING, value);
 
-  SVN_ERR(svn_wc__db_op_set_props(db, path, props, scratch_pool));
+  SVN_ERR(svn_wc__db_op_set_props(db, path, props, NULL, NULL, scratch_pool));
   SVN_ERR(svn_wc__db_read_props(&props, db, path,
                                 scratch_pool, scratch_pool));
   SVN_TEST_ASSERT(props != NULL);