subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1357984 - in /subversion/trunk/subversion/libsvn_wc: update_editor.c wc_db.c wc_db.h
Date Thu, 05 Jul 2012 22:52:44 GMT
Author: rhuijben
Date: Thu Jul  5 22:52:43 2012
New Revision: 1357984

URL: http://svn.apache.org/viewvc?rev=1357984&view=rev
Log:
Allow atomically setting properties from svn_wc__db_op_copy_file()
to avoid having to use two operations until a stable db state is reached.

* subversion/libsvn_wc/update_editor.c
  (close_file): Update caller.
  (svn_wc_add_repos_file4): Update caller.

* subversion/libsvn_wc/wc_db.c
  (insert_working_baton_t): Add actual props variables.
  (insert_working_node): Add update props support, like in insert_base_node.
  (svn_wc__db_op_copy_file): Support setting actual properties.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_op_copy_file): Support setting actual properties.

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

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1357984&r1=1357983&r2=1357984&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Jul  5 22:52:43 2012
@@ -4553,6 +4553,8 @@ close_file(void *file_baton,
                                       eb->repos_uuid,
                                       *eb->target_revision,
                                       new_checksum,
+                                      FALSE /* update_actual_props */,
+                                      NULL /* new_actual_props */,
                                       TRUE /* is_move */,
                                       NULL /* conflict */,
                                       NULL, /* no work, just modify DB */
@@ -5690,16 +5692,10 @@ svn_wc_add_repos_file4(svn_wc_context_t 
                                   original_uuid,
                                   copyfrom_rev,
                                   new_text_base_sha1_checksum,
+                                  TRUE,
+                                  new_props,
                                   FALSE /* is_move */,
                                   NULL /* conflict */,
-                                  NULL /* work_items */,
-                                  pool));
-
-  /* ### if below fails, then the above db change would remain :-(  */
-
-  SVN_ERR(svn_wc__db_op_set_props(db, local_abspath,
-                                  new_props, FALSE,
-                                  NULL /* conflict */,
                                   all_work_items,
                                   pool));
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1357984&r1=1357983&r2=1357984&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Jul  5 22:52:43 2012
@@ -217,6 +217,9 @@ typedef struct insert_working_baton_t {
   /* for inserting symlinks */
   const char *target;
 
+  svn_boolean_t update_actual_props;
+  const apr_hash_t *new_actual_props;
+
   /* may have work items to queue in this transaction  */
   const svn_skel_t *work_items;
 
@@ -1082,6 +1085,29 @@ insert_working_node(void *baton,
                                        piwb->op_depth,
                                        scratch_pool));
 
+  if (piwb->update_actual_props)
+    {
+      /* Cast away const, to allow calling property helpers */
+      apr_hash_t *base_props = (apr_hash_t *)piwb->props;
+      apr_hash_t *new_actual_props = (apr_hash_t *)piwb->new_actual_props;
+
+      if (base_props != NULL
+          && new_actual_props != NULL
+          && (apr_hash_count(base_props) == apr_hash_count(new_actual_props)))
+        {
+          apr_array_header_t *diffs;
+
+          SVN_ERR(svn_prop_diffs(&diffs, new_actual_props, base_props,
+                                 scratch_pool));
+
+          if (diffs->nelts == 0)
+            new_actual_props = NULL;
+        }
+
+      SVN_ERR(set_actual_props(wcroot->wc_id, local_relpath, new_actual_props,
+                               wcroot->sdb, scratch_pool));
+    }
+
   if (piwb->kind == svn_kind_dir)
     {
       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -4660,6 +4686,8 @@ svn_wc__db_op_copy_file(svn_wc__db_t *db
                         const char *original_uuid,
                         svn_revnum_t original_revision,
                         const svn_checksum_t *checksum,
+                        svn_boolean_t set_actual_props,
+                        const apr_hash_t *new_actual_props,
                         svn_boolean_t is_move,
                         const svn_skel_t *conflict,
                         const svn_skel_t *work_items,
@@ -4711,6 +4739,12 @@ svn_wc__db_op_copy_file(svn_wc__db_t *db
 
   iwb.checksum = checksum;
 
+  if (set_actual_props)
+    {
+      iwb.update_actual_props = set_actual_props;
+      iwb.new_actual_props = new_actual_props;
+    }
+
   iwb.work_items = work_items;
   iwb.conflict = conflict;
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1357984&r1=1357983&r2=1357984&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Thu Jul  5 22:52:43 2012
@@ -1331,6 +1331,8 @@ svn_wc__db_op_copy_file(svn_wc__db_t *db
                         const char *original_uuid,
                         svn_revnum_t original_revision,
                         const svn_checksum_t *checksum,
+                        svn_boolean_t set_actual_props,
+                        const apr_hash_t *new_actual_props,
                         svn_boolean_t is_move,
                         const svn_skel_t *conflict,
                         const svn_skel_t *work_items,



Mime
View raw message