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 10:50:00 UTC

svn commit: r942346 - in /subversion/trunk/subversion/libsvn_wc: props.c props.h update_editor.c workqueue.c

Author: gstein
Date: Sat May  8 08:49:59 2010
New Revision: 942346

URL: http://svn.apache.org/viewvc?rev=942346&view=rev
Log:
Rejigger property installation. OP_INSTALL_PROPERTIES is now just a way to
queue/delay installation of properties into the database. The old-style
prop files are now handled properly with OP_WRITE_OLD_PROPS.

Adjust a bunch of callers to svn_wc__install_props() to clarify that the
pristine properties will always be provided. They may not be installed in
all cases, however (see svn_wc_merge_props3:BASE_MERGE).

* subversion/libsvn_wc/props.h:
  (svn_wc__install_props): add a KIND parameter to indicate the (future)
    kind of the node.

* subversion/libsvn_wc/props.c:
  (svn_wc__install_props): add a KIND parameter. assert that all callers
    will pass a set of pristine props. use the new KIND param to indicate
    the intended kind of the node, and to computer propfile paths. queue
    up operations to write out old-style prop files.
  (svn_wc_merge_props3): add an assertion to clarify that we have both
    sets of props. pass KIND to install_props.

* subversion/libsvn_wc/update_editor.c:
  (close_directory): add an assertion after the merge_props call to
    clarify that we have both sets of props. simplify the test for the
    install_props call, and add a big comment to explain why we can do
    this, and to clarify that a set of pristine props will always be
    provided. pass kind_dir to install_props.
  (close_file): add an assertion about having both sets of props after a
    merge_props call, and remove the test for the install_props call. also
    pass kind_file to install_props.
  (svn_wc_add_repos_file4): pass kind_file to install_props. earlier
    assertions indicate we are passing pristine props.

* subversion/libsvn_wc/workqueue.c:
  (run_install_properties): rip out all the handling for writing old-style
    property files. that is now handled elsewhere.

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

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=942346&r1=942345&r2=942346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Sat May  8 08:49:59 2010
@@ -364,6 +364,7 @@ svn_wc__load_revert_props(apr_hash_t **r
 svn_error_t *
 svn_wc__install_props(svn_wc__db_t *db,
                       const char *local_abspath,
+                      svn_wc__db_kind_t kind,
                       apr_hash_t *pristine_props,
                       apr_hash_t *props,
                       svn_boolean_t install_pristine_props,
@@ -371,6 +372,10 @@ svn_wc__install_props(svn_wc__db_t *db,
                       apr_pool_t *scratch_pool)
 {
   apr_array_header_t *prop_diffs;
+  const char *prop_abspath;
+  const svn_skel_t *work_item;
+
+  SVN_ERR_ASSERT(pristine_props != NULL);
 
   /* Check if the props are modified. */
   SVN_ERR(svn_prop_diffs(&prop_diffs, props, pristine_props, scratch_pool));
@@ -379,9 +384,33 @@ svn_wc__install_props(svn_wc__db_t *db,
   if (prop_diffs->nelts == 0)
     props = NULL; /* Remove actual properties*/
 
+  if (install_pristine_props)
+    {
+      /* Write out a new set of pristine properties.  */
+      SVN_ERR(svn_wc__prop_path(&prop_abspath, local_abspath, kind,
+                                svn_wc__props_base, scratch_pool));
+      SVN_ERR(svn_wc__wq_build_write_old_props(&work_item,
+                                               prop_abspath,
+                                               pristine_props,
+                                               scratch_pool));
+      SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, scratch_pool));
+    }
+
+  /* For the old school: write the properties into the "working" (aka ACTUAL)
+     location. Note that PROPS may be NULL, indicating a removal of the
+     props file.  */
+  SVN_ERR(svn_wc__prop_path(&prop_abspath, local_abspath, kind,
+                            svn_wc__props_working, scratch_pool));
+  SVN_ERR(svn_wc__wq_build_write_old_props(&work_item,
+                                           prop_abspath,
+                                           props,
+                                           scratch_pool));
+  SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, scratch_pool));
+
+  /* ### this is disappearing. for now, it is a delayed call to put
+     ### properties into wc_db.  */
   if (!install_pristine_props)
     pristine_props = NULL; /* Don't change the pristine properties */
-
   SVN_ERR(svn_wc__wq_add_install_properties(db,
                                             local_abspath,
                                             pristine_props,
@@ -656,7 +685,10 @@ svn_wc_merge_props3(svn_wc_notify_state_
       /* Verify that we're holding this directory's write lock.  */
       SVN_ERR(svn_wc__write_check(wc_ctx->db, dir_abspath, pool));
 
-      SVN_ERR(svn_wc__install_props(wc_ctx->db, local_abspath,
+      /* After a (not-dry-run) merge, we ALWAYS have props to save.  */
+      SVN_ERR_ASSERT(new_base_props != NULL && new_actual_props != NULL);
+
+      SVN_ERR(svn_wc__install_props(wc_ctx->db, local_abspath, kind,
                                     new_base_props, new_actual_props,
                                     base_merge, FALSE, pool));
 

Modified: subversion/trunk/subversion/libsvn_wc/props.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.h?rev=942346&r1=942345&r2=942346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.h (original)
+++ subversion/trunk/subversion/libsvn_wc/props.h Sat May  8 08:49:59 2010
@@ -144,6 +144,7 @@ svn_boolean_t svn_wc__has_magic_property
 svn_error_t *
 svn_wc__install_props(svn_wc__db_t *db,
                       const char *local_abspath,
+                      svn_wc__db_kind_t kind,
                       apr_hash_t *pristine_props,
                       apr_hash_t *props,
                       svn_boolean_t install_pristine_props,

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=942346&r1=942345&r2=942346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Sat May  8 08:49:59 2010
@@ -3015,6 +3015,8 @@ close_directory(void *dir_baton,
                                         db->pool,
                                         pool),
                     _("Couldn't do property merge"));
+          /* After a (not-dry-run) merge, we ALWAYS have props to save.  */
+          SVN_ERR_ASSERT(new_base_props != NULL && new_actual_props != NULL);
         }
 
       SVN_ERR(accumulate_last_change(&last_change, NULL, eb->db,
@@ -3086,8 +3088,13 @@ close_directory(void *dir_baton,
     }
 
   /* Queue some items to install the properties.  */
-  if (new_base_props || new_actual_props)
+  /* ### note: we do not have to test NEW_ACTUAL_PROPS. if it is not-NULL,
+     ### then NEW_BASE_PROPS is not-NULL (per logic above). by simplifying
+     ### this conditional, it becomes obvious that NEW_BASE_PROPS will
+     ### be not-NULL when passed to svn_wc__install_props.  */
+  if (new_base_props != NULL)
     SVN_ERR(svn_wc__install_props(eb->db, db->local_abspath,
+                                  svn_wc__db_kind_dir,
                                   new_base_props, new_actual_props,
                                   TRUE /* write_base_props */, TRUE, pool));
 
@@ -4759,15 +4766,17 @@ close_file(void *file_baton,
                               eb->cancel_func, eb->cancel_baton,
                               pool,
                               pool));
+  /* We will ALWAYS have properties to save (after a not-dry-run merge).  */
+  SVN_ERR_ASSERT(new_base_props != NULL && new_actual_props != NULL);
 
   /* We have the new (merged) properties now. Queue some work items to
      install them.  */
-  if (new_base_props || new_actual_props)
-    SVN_ERR(svn_wc__install_props(eb->db, fb->local_abspath,
-                                  new_base_props, new_actual_props,
-                                  TRUE /* write_base_props */,
-                                  TRUE /* force_base_install */,
-                                  pool));
+  SVN_ERR(svn_wc__install_props(eb->db, fb->local_abspath,
+                                svn_wc__db_kind_file,
+                                new_base_props, new_actual_props,
+                                TRUE /* write_base_props */,
+                                TRUE /* force_base_install */,
+                                pool));
 
   /* This writes a whole bunch of log commands to install wcprops.  */
   /* ### no it doesn't. this immediately modifies them. should probably
@@ -5823,7 +5832,8 @@ svn_wc_add_repos_file4(svn_wc_context_t 
   }
 
   /* Add some work items to install the properties.  */
-  SVN_ERR(svn_wc__install_props(db, local_abspath, new_base_props,
+  SVN_ERR(svn_wc__install_props(db, local_abspath, svn_wc__db_kind_file,
+                                new_base_props,
                                 new_props ? new_props : new_base_props,
                                 TRUE, FALSE, pool));
 

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=942346&r1=942345&r2=942346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Sat May  8 08:49:59 2010
@@ -1596,8 +1596,6 @@ run_install_properties(svn_wc__db_t *db,
   const char *local_abspath;
   apr_hash_t *base_props;
   apr_hash_t *actual_props;
-  svn_wc__db_kind_t kind;
-  const char *prop_abspath;
   svn_boolean_t force_base_install;
 
   /* We need a NUL-terminated path, so copy it out of the skel.  */
@@ -1618,25 +1616,8 @@ run_install_properties(svn_wc__db_t *db,
   arg = arg->next;
   force_base_install = arg && svn_skel__parse_int(arg, scratch_pool);
 
-  SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath, FALSE, scratch_pool));
   if (base_props != NULL)
     {
-      SVN_ERR(svn_wc__prop_path(&prop_abspath, local_abspath, kind,
-                                svn_wc__props_base, scratch_pool));
-      /* ### oh hack!  */
-      {
-        const svn_skel_t *write_item;
-
-        SVN_ERR(svn_wc__wq_build_write_old_props(&write_item,
-                                                 prop_abspath,
-                                                 base_props,
-                                                 scratch_pool));
-        /* ### double-hack!  */
-        SVN_ERR(dispatch_work_item(db, local_abspath, write_item,
-                                   cancel_func, cancel_baton, scratch_pool));
-      }
-
-      {
         svn_boolean_t written = FALSE;
 
         if (!force_base_install)
@@ -1664,25 +1645,9 @@ run_install_properties(svn_wc__db_t *db,
         if (!written)
           SVN_ERR(svn_wc__db_temp_base_set_props(db, local_abspath,
                                                  base_props, scratch_pool));
-      }
     }
 
-
-  SVN_ERR(svn_wc__prop_path(&prop_abspath, local_abspath, kind,
-                            svn_wc__props_working, scratch_pool));
-  /* ### oh hack!  */
-  {
-    const svn_skel_t *write_item;
-
-    SVN_ERR(svn_wc__wq_build_write_old_props(&write_item,
-                                             prop_abspath,
-                                             actual_props,
-                                             scratch_pool));
-    /* ### double-hack!  */
-    SVN_ERR(dispatch_work_item(db, local_abspath, write_item,
-                               cancel_func, cancel_baton, scratch_pool));
-  }
-
+  /* Okay. It's time to save the ACTUAL props.  */
   SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, actual_props,
                                   NULL, NULL, scratch_pool));