You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2012/12/06 18:06:15 UTC

svn commit: r1418004 - in /subversion/trunk/subversion/libsvn_wc: merge.c props.c props.h

Author: julianfoad
Date: Thu Dec  6 17:06:13 2012
New Revision: 1418004

URL: http://svn.apache.org/viewvc?rev=1418004&view=rev
Log:
Stop altering the 'actual_props' input parameter in svn_wc__merge_props().
A follow-up to r1417926 which did the same for the 'pristine_props' input.

I thought this might even fix an outstanding bug or two related to using the
post-merge EOL style to translate a pre-merge version of the file, but the
test suite doesn't indicate any change of behaviour.

* subversion/libsvn_wc/props.h
  (svn_wc__merge_props): Comment that the three hash input parameters are
    'const'. Unfortunately it is awkward to really use the 'const' qualifier
    with apr_hash_t because the APR hash API isn't const-correct.

* subversion/libsvn_wc/props.c
  (svn_wc__merge_props): Don't alter the 'actual_props' hash. Notice how
    this simplifies the code.
  (svn_wc__perform_props_merge): No need to make a copy of the 'actual_props'
    hash now. Incidentally, remove the redundant initializer.

* subversion/libsvn_wc/merge.c
  (svn_wc_merge5): No need to make a copy of the 'actual_props' hash now.
    Incidentally, remove the redundant initializer.

Modified:
    subversion/trunk/subversion/libsvn_wc/merge.c
    subversion/trunk/subversion/libsvn_wc/props.c
    subversion/trunk/subversion/libsvn_wc/props.h

Modified: subversion/trunk/subversion/libsvn_wc/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/merge.c?rev=1418004&r1=1418003&r2=1418004&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/merge.c (original)
+++ subversion/trunk/subversion/libsvn_wc/merge.c Thu Dec  6 17:06:13 2012
@@ -1145,7 +1145,7 @@ svn_wc_merge5(enum svn_wc_merge_outcome_
   svn_skel_t *work_items;
   svn_skel_t *conflict_skel = NULL;
   apr_hash_t *pristine_props = NULL;
-  apr_hash_t *actual_props = NULL;
+  apr_hash_t *actual_props;
   apr_hash_t *new_actual_props = NULL;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(left_abspath));
@@ -1222,7 +1222,7 @@ svn_wc_merge5(enum svn_wc_merge_outcome_
                                       scratch_pool, scratch_pool));
       }
     else if (pristine_props)
-      actual_props = apr_hash_copy(scratch_pool, pristine_props);
+      actual_props = pristine_props;
     else
       actual_props = apr_hash_make(scratch_pool);
   }

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1418004&r1=1418003&r2=1418004&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Thu Dec  6 17:06:13 2012
@@ -200,7 +200,7 @@ svn_wc__perform_props_merge(svn_wc_notif
   svn_wc__db_status_t status;
   svn_kind_t kind;
   apr_hash_t *pristine_props = NULL;
-  apr_hash_t *actual_props = NULL;
+  apr_hash_t *actual_props;
   apr_hash_t *new_pristine_props;
   apr_hash_t *new_actual_props;
   svn_boolean_t had_props, props_mod;
@@ -289,7 +289,7 @@ svn_wc__perform_props_merge(svn_wc_notif
     SVN_ERR(svn_wc__get_actual_props(&actual_props, db, local_abspath,
                                      scratch_pool, scratch_pool));
   else
-    actual_props = apr_hash_copy(scratch_pool, pristine_props);
+    actual_props = pristine_props;
 
   /* Note that while this routine does the "real" work, it's only
      prepping tempfiles and writing log commands.  */
@@ -1191,19 +1191,14 @@ svn_wc__merge_props(svn_skel_t **conflic
   apr_pool_t *iterpool;
   int i;
   apr_hash_t *conflict_props = NULL;
-  apr_hash_t *old_actual_props;
   apr_hash_t *their_props;
 
   SVN_ERR_ASSERT(pristine_props != NULL);
   SVN_ERR_ASSERT(actual_props != NULL);
 
-  /* Just copy the pointers as we copy the data in the skel if
-     necessary */
-  old_actual_props = apr_hash_copy(scratch_pool, actual_props);
-
   if (new_pristine_props)
     *new_pristine_props = apr_hash_copy(result_pool, pristine_props);
-  *new_actual_props = NULL;
+  *new_actual_props = apr_hash_copy(result_pool, actual_props);
 
   if (!server_baseprops)
     server_baseprops = pristine_props;
@@ -1255,21 +1250,21 @@ svn_wc__merge_props(svn_skel_t **conflic
       if (! from_val)  /* adding a new property */
         SVN_ERR(apply_single_prop_add(state, &conflict_remains,
                                       db, local_abspath,
-                                      actual_props,
+                                      *new_actual_props,
                                       propname, base_val, to_val,
                                       result_pool, iterpool));
 
       else if (! to_val) /* delete an existing property */
         SVN_ERR(apply_single_prop_delete(state, &conflict_remains,
                                          db, local_abspath,
-                                         actual_props,
+                                         *new_actual_props,
                                          propname, base_val, from_val,
                                          result_pool, iterpool));
 
       else  /* changing an existing property */
         SVN_ERR(apply_single_prop_change(state, &conflict_remains,
                                          db, local_abspath,
-                                         actual_props,
+                                         *new_actual_props,
                                          propname, base_val, from_val, to_val,
                                          result_pool, iterpool));
 
@@ -1292,8 +1287,6 @@ svn_wc__merge_props(svn_skel_t **conflic
 
   /* Finished applying all incoming propchanges to our hashes! */
 
-  *new_actual_props = actual_props;
-
   if (conflict_props != NULL)
     {
       /* Ok, we got some conflict. Lets store all the property knowledge we
@@ -1305,7 +1298,7 @@ svn_wc__merge_props(svn_skel_t **conflic
       SVN_ERR(svn_wc__conflict_skel_add_prop_conflict(*conflict_skel,
                                                       db, local_abspath,
                                                       NULL /* reject_path */,
-                                                      old_actual_props,
+                                                      actual_props,
                                                       server_baseprops,
                                                       their_props,
                                                       conflict_props,

Modified: subversion/trunk/subversion/libsvn_wc/props.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.h?rev=1418004&r1=1418003&r2=1418004&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.h (original)
+++ subversion/trunk/subversion/libsvn_wc/props.h Thu Dec  6 17:06:13 2012
@@ -97,9 +97,9 @@ svn_wc__merge_props(svn_skel_t **conflic
                     apr_hash_t **new_actual_props,
                     svn_wc__db_t *db,
                     const char *local_abspath,
-                    apr_hash_t *server_baseprops,
-                    apr_hash_t *pristine_props,
-                    apr_hash_t *actual_props,
+                    /*const*/ apr_hash_t *server_baseprops,
+                    /*const*/ apr_hash_t *pristine_props,
+                    /*const*/ apr_hash_t *actual_props,
                     const apr_array_header_t *propchanges,
                     apr_pool_t *result_pool,
                     apr_pool_t *scratch_pool);