subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1619121 - in /subversion/trunk/subversion/libsvn_wc: conflicts.c workqueue.c workqueue.h
Date Wed, 20 Aug 2014 14:41:31 GMT
Author: rhuijben
Date: Wed Aug 20 14:41:31 2014
New Revision: 1619121

URL: http://svn.apache.org/r1619121
Log:
Move the creation of the legacy workqueue property conflict marker create skels
to the workqueue to allow further refactoring, and to avoid reading these
functions as functions handling the 1.8+ conflict skels.

* subversion/libsvn_wc/conflicts.c
  (prop_conflict_skel_new,
   prepend_prop_value,
   prop_conflict_skel_add): Move to workqueue.c
  (svn_wc__conflict_create_markers): Update caller, by no longer passing
   data that is already available in the conflict skels.

* subversion/libsvn_wc/workqueue.c
  (prop_conflict_skel_new,
   prepend_prop_value,
   prop_conflict_skel_add): Moved here from conflicts.c.
  (run_prej_install): Resolve a TODO in the most simple way, by moving code
    from svn_wc__conflict_create_markers here.
  (svn_wc__wq_build_prej_install): Remove now unneeded argument.

* subversion/libsvn_wc/workqueue.h
  (svn_wc__wq_build_prej_install): Remove argument and a few TODOs attached to
    this argument.

Modified:
    subversion/trunk/subversion/libsvn_wc/conflicts.c
    subversion/trunk/subversion/libsvn_wc/workqueue.c
    subversion/trunk/subversion/libsvn_wc/workqueue.h

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1619121&r1=1619120&r2=1619121&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Wed Aug 20 14:41:31 2014
@@ -1047,68 +1047,7 @@ svn_wc__conflict_read_markers(const apr_
 
 /* --------------------------------------------------------------------
  */
-/* Helper for svn_wc__conflict_create_markers */
-static svn_skel_t *
-prop_conflict_skel_new(apr_pool_t *result_pool)
-{
-  svn_skel_t *operation = svn_skel__make_empty_list(result_pool);
-  svn_skel_t *result = svn_skel__make_empty_list(result_pool);
-
-  svn_skel__prepend(operation, result);
-  return result;
-}
-
-
-/* Helper for prop_conflict_skel_add */
-static void
-prepend_prop_value(const svn_string_t *value,
-                   svn_skel_t *skel,
-                   apr_pool_t *result_pool)
-{
-  svn_skel_t *value_skel = svn_skel__make_empty_list(result_pool);
-
-  if (value != NULL)
-    {
-      const void *dup = apr_pmemdup(result_pool, value->data, value->len);
 
-      svn_skel__prepend(svn_skel__mem_atom(dup, value->len, result_pool),
-                        value_skel);
-    }
-
-  svn_skel__prepend(value_skel, skel);
-}
-
-
-/* Helper for svn_wc__conflict_create_markers */
-static svn_error_t *
-prop_conflict_skel_add(
-  svn_skel_t *skel,
-  const char *prop_name,
-  const svn_string_t *original_value,
-  const svn_string_t *mine_value,
-  const svn_string_t *incoming_value,
-  const svn_string_t *incoming_base_value,
-  apr_pool_t *result_pool,
-  apr_pool_t *scratch_pool)
-{
-  svn_skel_t *prop_skel = svn_skel__make_empty_list(result_pool);
-
-  /* ### check that OPERATION has been filled in.  */
-
-  /* See notes/wc-ng/conflict-storage  */
-  prepend_prop_value(incoming_base_value, prop_skel, result_pool);
-  prepend_prop_value(incoming_value, prop_skel, result_pool);
-  prepend_prop_value(mine_value, prop_skel, result_pool);
-  prepend_prop_value(original_value, prop_skel, result_pool);
-  svn_skel__prepend_str(apr_pstrdup(result_pool, prop_name), prop_skel,
-                        result_pool);
-  svn_skel__prepend_str(SVN_WC__CONFLICT_KIND_PROP, prop_skel, result_pool);
-
-  /* Now we append PROP_SKEL to the end of the provided conflict SKEL.  */
-  svn_skel__append(skel, prop_skel);
-
-  return SVN_NO_ERROR;
-}
 
 svn_error_t *
 svn_wc__conflict_create_markers(svn_skel_t **work_items,
@@ -1138,10 +1077,8 @@ svn_wc__conflict_create_markers(svn_skel
 
       /* Ok, currently we have to do a few things for property conflicts:
          - Create a marker file
-         - Create a WQ item that sets the marker name
-         - Create a WQ item that fills the marker with the expected data
-
-         This can be simplified once we really store conflict_skel in wc.db */
+         - Store the name in the conflict_skel
+         - Create a WQ item that fills the marker with the expected data */
 
       SVN_ERR(svn_io_check_path(local_abspath, &kind, scratch_pool));
 
@@ -1173,65 +1110,9 @@ svn_wc__conflict_create_markers(svn_skel
         svn_skel__prepend_str(marker_relpath, prop_conflict->children->next,
                             result_pool);
       }
-
-      /* Store the data in the WQ item in the same format used as 1.7.
-         Once we store the data in DB it is easier to just read it back
-         from the workqueue */
-      {
-        svn_skel_t *prop_data;
-        apr_hash_index_t *hi;
-        apr_hash_t *old_props;
-        apr_hash_t *mine_props;
-        apr_hash_t *their_original_props;
-        apr_hash_t *their_props;
-        apr_hash_t *conflicted_props;
-
-        SVN_ERR(svn_wc__conflict_read_prop_conflict(NULL,
-                                                    &mine_props,
-                                                    &their_original_props,
-                                                    &their_props,
-                                                    &conflicted_props,
-                                                    db, local_abspath,
-                                                    conflict_skel,
-                                                    scratch_pool,
-                                                    scratch_pool));
-
-        if (operation == svn_wc_operation_merge)
-          SVN_ERR(svn_wc__db_read_pristine_props(&old_props, db, local_abspath,
-                                                 scratch_pool, scratch_pool));
-        else
-          old_props = their_original_props;
-
-        prop_data = prop_conflict_skel_new(result_pool);
-
-        for (hi = apr_hash_first(scratch_pool, conflicted_props);
-             hi;
-             hi = apr_hash_next(hi))
-          {
-            const char *propname = apr_hash_this_key(hi);
-
-            SVN_ERR(prop_conflict_skel_add(
-                            prop_data, propname,
-                            old_props
-                                    ? svn_hash_gets(old_props, propname)
-                                    : NULL,
-                            mine_props
-                                    ? svn_hash_gets(mine_props, propname)
-                                    : NULL,
-                            their_props
-                                    ? svn_hash_gets(their_props, propname)
-                                      : NULL,
-                            their_original_props
-                                    ? svn_hash_gets(their_original_props, propname)
-                                      : NULL,
-                            result_pool, scratch_pool));
-          }
-
-        SVN_ERR(svn_wc__wq_build_prej_install(work_items,
-                                              db, local_abspath,
-                                              prop_data,
-                                              scratch_pool, scratch_pool));
-      }
+      SVN_ERR(svn_wc__wq_build_prej_install(work_items,
+                                            db, local_abspath,
+                                            scratch_pool, scratch_pool));
     }
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=1619121&r1=1619120&r2=1619121&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Wed Aug 20 14:41:31 2014
@@ -1086,6 +1086,70 @@ svn_wc__wq_build_sync_file_flags(svn_ske
 
 /* OP_PREJ_INSTALL  */
 
+/* Helper for run_prej_install.  Originally in conflict.c */
+static svn_skel_t *
+prop_conflict_skel_new(apr_pool_t *result_pool)
+{
+  svn_skel_t *operation = svn_skel__make_empty_list(result_pool);
+  svn_skel_t *result = svn_skel__make_empty_list(result_pool);
+
+  svn_skel__prepend(operation, result);
+  return result;
+}
+
+/* Helper for prop_conflict_skel_add.  Originally in conflict.c */
+static void
+prepend_prop_value(const svn_string_t *value,
+                   svn_skel_t *skel,
+                   apr_pool_t *result_pool)
+{
+  svn_skel_t *value_skel = svn_skel__make_empty_list(result_pool);
+
+  if (value != NULL)
+    {
+      const void *dup = apr_pmemdup(result_pool, value->data, value->len);
+
+      svn_skel__prepend(svn_skel__mem_atom(dup, value->len, result_pool),
+                        value_skel);
+    }
+
+  svn_skel__prepend(value_skel, skel);
+}
+
+
+/* Helper for run_prej_install.  Originally in conflict.c */
+static svn_error_t *
+prop_conflict_skel_add(
+  svn_skel_t *skel,
+  const char *prop_name,
+  const svn_string_t *original_value,
+  const svn_string_t *mine_value,
+  const svn_string_t *incoming_value,
+  const svn_string_t *incoming_base_value,
+  apr_pool_t *result_pool,
+  apr_pool_t *scratch_pool)
+{
+  svn_skel_t *prop_skel = svn_skel__make_empty_list(result_pool);
+
+  /* ### check that OPERATION has been filled in.  */
+
+  /* See notes/wc-ng/conflict-storage  */
+  prepend_prop_value(incoming_base_value, prop_skel, result_pool);
+  prepend_prop_value(incoming_value, prop_skel, result_pool);
+  prepend_prop_value(mine_value, prop_skel, result_pool);
+  prepend_prop_value(original_value, prop_skel, result_pool);
+  svn_skel__prepend_str(apr_pstrdup(result_pool, prop_name), prop_skel,
+                        result_pool);
+  svn_skel__prepend_str(SVN_WC__CONFLICT_KIND_PROP, prop_skel, result_pool);
+
+  /* Now we append PROP_SKEL to the end of the provided conflict SKEL.  */
+  svn_skel__append(skel, prop_skel);
+
+  return SVN_NO_ERROR;
+}
+
+
+
 static svn_error_t *
 run_prej_install(work_item_baton_t *wqb,
                  svn_wc__db_t *db,
@@ -1116,9 +1180,64 @@ run_prej_install(work_item_baton_t *wqb,
                                               scratch_pool, scratch_pool));
 
   if (arg1->next != NULL)
-    prop_conflict_skel = arg1->next;
+    prop_conflict_skel = arg1->next; /* Before Subversion 1.9 */
   else
-    SVN_ERR_MALFUNCTION();  /* ### wc_db can't provide it ... yet.  */
+    {
+      svn_wc_operation_t operation;
+      apr_hash_index_t *hi;
+      apr_hash_t *old_props;
+      apr_hash_t *mine_props;
+      apr_hash_t *their_original_props;
+      apr_hash_t *their_props;
+      apr_hash_t *conflicted_props;
+
+      SVN_ERR(svn_wc__conflict_read_info(&operation, NULL, NULL, NULL, NULL,
+                                         db, local_abspath,
+                                         conflicts,
+                                         scratch_pool, scratch_pool));
+
+      /* Create the data in the skel in the same format used as 1.7 */
+      SVN_ERR(svn_wc__conflict_read_prop_conflict(NULL,
+                                                  &mine_props,
+                                                  &their_original_props,
+                                                  &their_props,
+                                                  &conflicted_props,
+                                                  db, local_abspath,
+                                                  conflicts,
+                                                  scratch_pool,
+                                                  scratch_pool));
+
+      if (operation == svn_wc_operation_merge)
+        SVN_ERR(svn_wc__db_read_pristine_props(&old_props, db, local_abspath,
+                                                scratch_pool, scratch_pool));
+      else
+        old_props = their_original_props;
+
+      prop_conflict_skel = prop_conflict_skel_new(scratch_pool);
+
+      for (hi = apr_hash_first(scratch_pool, conflicted_props);
+           hi;
+           hi = apr_hash_next(hi))
+        {
+          const char *propname = apr_hash_this_key(hi);
+
+          SVN_ERR(prop_conflict_skel_add(
+                          prop_conflict_skel, propname,
+                          old_props
+                                  ? svn_hash_gets(old_props, propname)
+                                  : NULL,
+                          mine_props
+                                  ? svn_hash_gets(mine_props, propname)
+                                  : NULL,
+                          their_props
+                                  ? svn_hash_gets(their_props, propname)
+                                    : NULL,
+                          their_original_props
+                                  ? svn_hash_gets(their_original_props, propname)
+                                    : NULL,
+                          scratch_pool, scratch_pool));
+        }
+    }
 
   /* Construct a property reject file in the temporary area.  */
   SVN_ERR(svn_wc__create_prejfile(&tmp_prejfile_abspath,
@@ -1140,21 +1259,21 @@ svn_error_t *
 svn_wc__wq_build_prej_install(svn_skel_t **work_item,
                               svn_wc__db_t *db,
                               const char *local_abspath,
-                              svn_skel_t *conflict_skel,
+                              /*svn_skel_t *conflict_skel,*/
                               apr_pool_t *result_pool,
                               apr_pool_t *scratch_pool)
 {
   const char *local_relpath;
   *work_item = svn_skel__make_empty_list(result_pool);
 
-  /* ### gotta have this, today  */
-  SVN_ERR_ASSERT(conflict_skel != NULL);
-
   SVN_ERR(svn_wc__db_to_relpath(&local_relpath, db, local_abspath,
                                 local_abspath, result_pool, scratch_pool));
 
-  if (conflict_skel != NULL)
-    svn_skel__prepend(conflict_skel, *work_item);
+  /* ### In Subversion 1.7 and 1.8 we created a legacy property conflict skel
+         here:
+    if (conflict_skel != NULL)
+      svn_skel__prepend(conflict_skel, *work_item);
+   */
   svn_skel__prepend_str(local_relpath, *work_item, result_pool);
   svn_skel__prepend_str(OP_PREJ_INSTALL, *work_item, result_pool);
 

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.h?rev=1619121&r1=1619120&r2=1619121&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.h Wed Aug 20 14:41:31 2014
@@ -181,22 +181,12 @@ svn_wc__wq_build_sync_file_flags(svn_ske
 
 
 /* Set *WORK_ITEM to a new work item that will install a property reject
-   file for LOCAL_ABSPATH into the working copy. The property conflicts will
-   be taken from CONFLICT_SKEL.
-
-   ### Caution: Links CONFLICT_SKEL into the *WORK_ITEM, which involves
-       modifying *CONFLICT_SKEL.
-
-   ### TODO: Make CONFLICT_SKEL 'const' and dup it into RESULT_POOL.
-
-   ### TODO: If CONFLICT_SKEL is NULL, take property conflicts from wc_db
-       for the given DB/LOCAL_ABSPATH.
+   file for LOCAL_ABSPATH into the working copy.
  */
 svn_error_t *
 svn_wc__wq_build_prej_install(svn_skel_t **work_item,
                               svn_wc__db_t *db,
                               const char *local_abspath,
-                              svn_skel_t *conflict_skel,
                               apr_pool_t *result_pool,
                               apr_pool_t *scratch_pool);
 



Mime
View raw message