subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject svn commit: r928939 - in /subversion/trunk/subversion/libsvn_wc: wc_db.c wc_db.h
Date Mon, 29 Mar 2010 23:40:55 GMT
Author: gstein
Date: Mon Mar 29 23:40:55 2010
New Revision: 928939

URL: http://svn.apache.org/viewvc?rev=928939&view=rev
Log:
Add a wc_db entrypoint for updating a specific node. This will modify the
BASE_NODE and ACTUAL_NODE tables with the provided information. In
particular, this will perform the update atomically, compared to the
current piecemeal state tweaking that occurs today.

* subversion/libsvn_wc/wc_db.h:
  (svn_wc__db_global_update): new declaration

* subversion/libsvn_wc/wc_db.c:
  (svn_wc__db_global_update): new skeleton implemenation

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

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=928939&r1=928938&r2=928939&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Mar 29 23:40:55 2010
@@ -2352,6 +2352,8 @@ svn_wc__db_base_set_dav_cache(svn_wc__db
                                  STMT_UPDATE_BASE_DAV_CACHE, scratch_pool));
   SVN_ERR(svn_sqlite__bind_properties(stmt, 3, props, scratch_pool));
 
+  /* ### we should assert that 1 row was affected.  */
+
   return svn_error_return(svn_sqlite__step_done(stmt));
 }
 
@@ -4662,6 +4664,95 @@ svn_wc__db_global_commit(svn_wc__db_t *d
 }
 
 
+struct update_baton {
+  svn_wc__db_pdh_t *pdh;
+  const char *local_relpath;
+
+  const char *new_repos_relpath;
+  svn_revnum_t new_revision;
+  const apr_hash_t *new_props;
+  svn_revnum_t new_changed_rev;
+  apr_time_t new_changed_date;
+  const char *new_changed_author;
+  const apr_array_header_t *new_children;
+  const svn_checksum_t *new_checksum;
+  const char *new_target;
+  const svn_skel_t *conflict;
+  const svn_skel_t *work_items;
+};
+
+
+svn_error_t *
+svn_wc__db_global_update(svn_wc__db_t *db,
+                         const char *local_abspath,
+                         const char *new_repos_relpath,
+                         svn_revnum_t new_revision,
+                         const apr_hash_t *new_props,
+                         svn_revnum_t new_changed_rev,
+                         apr_time_t new_changed_date,
+                         const char *new_changed_author,
+                         const apr_array_header_t *new_children,
+                         const svn_checksum_t *new_checksum,
+                         const char *new_target,
+                         const svn_skel_t *conflict,
+                         const svn_skel_t *work_items,
+                         apr_pool_t *scratch_pool)
+{
+  svn_wc__db_pdh_t *pdh;
+  const char *local_relpath;
+  struct update_baton ub;
+
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+  /* ### allow NULL for NEW_REPOS_RELPATH to indicate "no change"?  */
+  SVN_ERR_ASSERT(svn_relpath_is_canonical(new_repos_relpath, scratch_pool));
+  SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(new_revision));
+  SVN_ERR_ASSERT(new_props != NULL);
+  SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(new_changed_rev));
+  SVN_ERR_ASSERT((new_children != NULL
+                  && new_checksum == NULL
+                  && new_target == NULL)
+                 || (new_children == NULL
+                     && new_checksum != NULL
+                     && new_target == NULL)
+                 || (new_children == NULL
+                     && new_checksum == NULL
+                     && new_target != NULL));
+
+  SVN_ERR(parse_local_abspath(&pdh, &local_relpath, db, local_abspath,
+                              svn_sqlite__mode_readwrite,
+                              scratch_pool, scratch_pool));
+  VERIFY_USABLE_PDH(pdh);
+
+  ub.pdh = pdh;
+  ub.local_relpath = local_relpath;
+
+  ub.new_repos_relpath = new_repos_relpath;
+  ub.new_revision = new_revision;
+  ub.new_props = new_props;
+  ub.new_changed_rev = new_changed_rev;
+  ub.new_changed_date = new_changed_date;
+  ub.new_changed_author = new_changed_author;
+  ub.new_children = new_children;
+  ub.new_checksum = new_checksum;
+  ub.new_target = new_target;
+
+  ub.conflict = conflict;
+  ub.work_items = work_items;
+
+  NOT_IMPLEMENTED();
+
+#if 0
+  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb, update_node, &ub,
+                                       scratch_pool));
+#endif
+
+  /* We *totally* monkeyed the entries. Toss 'em.  */
+  flush_entries(pdh);
+
+  return SVN_NO_ERROR;
+}
+
+
 svn_error_t *
 svn_wc__db_lock_add(svn_wc__db_t *db,
                     const char *local_abspath,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=928939&r1=928938&r2=928939&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Mon Mar 29 23:40:55 2010
@@ -1406,7 +1406,7 @@ svn_wc__db_node_hidden(svn_boolean_t *hi
 /* @} */
 
 
-/* @defgroup svn_wc__db_global  Operations that alter BASE and WORKING trees
+/* @defgroup svn_wc__db_global  Operations that alter multiple trees
    @{
 */
 
@@ -1473,6 +1473,50 @@ svn_wc__db_global_commit(svn_wc__db_t *d
                          apr_pool_t *scratch_pool);
 
 
+/* ### docco
+
+   Perform an "update" operation at this node. It will create/modify a BASE
+   node, and possibly update the ACTUAL tree's node (e.g put the node into
+   a conflicted state).
+
+   ### there may be cases where we need to tweak an existing WORKING node
+
+   ### this operations on a single node, but may affect children
+
+   ### the repository cannot be changed with this function, but a "switch"
+   ### (aka changing repos_relpath) is possible
+
+   ### one of NEW_CHILDREN, NEW_CHECKSUM, or NEW_TARGET must be provided.
+   ### the other two values must be NULL.
+   ### should this be broken out into an update_(directory|file|symlink) ?
+
+   ### how does this differ from base_add_*? just the CONFLICT param.
+   ### the WORK_ITEMS param is new here, but the base_add_* functions
+   ### should probably grow that. should we instead just (re)use base_add
+   ### rather than grow a new function?
+
+   ### this does not allow a change of depth
+
+   ### we do not update a file's TRANSLATED_SIZE here. at some future point,
+   ### when the file is installed, then a TRANSLATED_SIZE will be set.
+*/
+svn_error_t *
+svn_wc__db_global_update(svn_wc__db_t *db,
+                         const char *local_abspath,
+                         const char *new_repos_relpath,
+                         svn_revnum_t new_revision,
+                         const apr_hash_t *new_props,
+                         svn_revnum_t new_changed_rev,
+                         apr_time_t new_changed_date,
+                         const char *new_changed_author,
+                         const apr_array_header_t *new_children,
+                         const svn_checksum_t *new_checksum,
+                         const char *new_target,
+                         const svn_skel_t *conflict,
+                         const svn_skel_t *work_items,
+                         apr_pool_t *scratch_pool);
+
+
 /* ### post-commit handling.
    ### maybe multiple phases?
    ### 1) mark a changelist as being-committed



Mime
View raw message