You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/02/06 23:34:22 UTC

svn commit: r1443248 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/merge.c libsvn_wc/node.c

Author: rhuijben
Date: Wed Feb  6 22:34:21 2013
New Revision: 1443248

URL: http://svn.apache.org/viewvc?rev=1443248&view=rev
Log:
Tweak the obstruction detection helper code for merging a bit to remove
some unused arguments and to avoid an additional call for shallowness tests.

* subversion/include/private/svn_wc_private.h
  (svn_wc__check_for_obstructions): Add two arguments.

* subversion/libsvn_client/merge.c
  (perform_obstruction_check): Add two arguments and remove another one.
  (merge_file_opened,
   merge_dir_opened,
   record_skips_in_mergeinfo): Update caller.

* subversion/libsvn_wc/node.c
  (svn_wc__check_for_obstructions): Fill a few more optional arguments.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_wc/node.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1443248&r1=1443247&r2=1443248&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed Feb  6 22:34:21 2013
@@ -1076,6 +1076,12 @@ svn_wc__get_not_present_descendants(cons
  * If DELETED is not NULL, set *DELETED to TRUE if the node is marked as
  * deleted in the working copy.
  *
+ * If EXCLUDED is not NULL, set *EXCLUDED to TRUE if the node is marked as
+ * user or server excluded.
+ *
+ * If PARENT_DEPTH is not NULL, set *PARENT_DEPTH to the depth stored on the
+ * parent. (Set to svn_depth_unknown if LOCAL_ABSPATH itself exists as node)
+ *
  * All output arguments except OBSTRUCTION_STATE can be NULL to ommit the
  * result.
  *
@@ -1085,6 +1091,8 @@ svn_error_t *
 svn_wc__check_for_obstructions(svn_wc_notify_state_t *obstruction_state,
                                svn_node_kind_t *kind,
                                svn_boolean_t *deleted,
+                               svn_boolean_t *excluded,
+                               svn_depth_t *parent_depth,
                                svn_wc_context_t *wc_ctx,
                                const char *local_abspath,
                                svn_boolean_t no_wcroot_check,

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1443248&r1=1443247&r2=1443248&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Wed Feb  6 22:34:21 2013
@@ -536,10 +536,11 @@ is_path_conflicted_by_merge(merge_cmd_ba
 static svn_error_t *
 perform_obstruction_check(svn_wc_notify_state_t *obstruction_state,
                           svn_boolean_t *deleted,
+                          svn_boolean_t *excluded,
                           svn_node_kind_t *kind,
+                          svn_depth_t *parent_depth,
                           const merge_cmd_baton_t *merge_b,
                           const char *local_abspath,
-                          svn_node_kind_t expected_kind,
                           apr_pool_t *scratch_pool)
 {
   svn_wc_context_t *wc_ctx = merge_b->ctx->wc_ctx;
@@ -563,17 +564,11 @@ perform_obstruction_check(svn_wc_notify_
   SVN_ERR(svn_wc__check_for_obstructions(obstruction_state,
                                          kind,
                                          deleted,
+                                         excluded,
+                                         parent_depth,
                                          wc_ctx, local_abspath,
                                          check_root,
                                          scratch_pool));
-
-  if (*obstruction_state == svn_wc_notify_state_inapplicable
-      && expected_kind != svn_node_unknown
-      && *kind != expected_kind)
-    {
-      *obstruction_state = svn_wc_notify_state_obstructed;
-    }
-
   return SVN_NO_ERROR;
 }
 
@@ -1943,13 +1938,16 @@ merge_file_opened(void **new_file_baton,
       /* Node is expected to be a file, which will be changed or deleted. */
       svn_node_kind_t kind;
       svn_boolean_t is_deleted;
+      svn_boolean_t excluded;
+      svn_depth_t parent_depth;
 
       {
         svn_wc_notify_state_t obstr_state;
 
-        SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, &kind,
+        SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, &excluded,
+                                          &kind, &parent_depth,
                                           merge_b, local_abspath,
-                                          svn_node_unknown, scratch_pool));
+                                          scratch_pool));
 
         if (obstr_state != svn_wc_notify_state_inapplicable)
           {
@@ -1975,24 +1973,15 @@ merge_file_opened(void **new_file_baton,
              Non-inheritable mergeinfo will be recorded, allowing
              future merges into non-shallow working copies to merge
              changes we missed this time around. */
-          if (pdb != NULL)
-            {
-              svn_depth_t parent_depth;
-              const char *dir_abspath = svn_dirent_dirname(local_abspath,
-                                                           scratch_pool);
-
-              SVN_ERR(svn_wc__node_get_depth(&parent_depth,
-                                             merge_b->ctx->wc_ctx,
-                                             dir_abspath, scratch_pool));
-              if (parent_depth != svn_depth_unknown &&
-                  parent_depth < svn_depth_immediates)
-                {
-                  fb->shadowed = TRUE;
-
-                  fb->tree_conflict_reason = CONFLICT_REASON_SKIP;
-                  fb->skip_reason = svn_wc_notify_state_missing;
-                  return SVN_NO_ERROR;
-                }
+          if (pdb && (excluded
+                      || (parent_depth != svn_depth_unknown &&
+                          parent_depth < svn_depth_files)))
+            {
+                fb->shadowed = TRUE;
+
+                fb->tree_conflict_reason = CONFLICT_REASON_SKIP;
+                fb->skip_reason = svn_wc_notify_state_missing;
+                return SVN_NO_ERROR;
             }
 
           if (is_deleted)
@@ -2060,9 +2049,9 @@ merge_file_opened(void **new_file_baton,
           svn_node_kind_t kind;
           svn_boolean_t is_deleted;
 
-          SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, &kind,
+          SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, NULL,
+                                            &kind, NULL,
                                             merge_b, local_abspath,
-                                            svn_node_unknown,
                                             scratch_pool));
 
           if (obstr_state != svn_wc_notify_state_inapplicable)
@@ -2666,13 +2655,15 @@ merge_dir_opened(void **new_dir_baton,
       /* Node is expected to be a directory. */
       svn_node_kind_t kind;
       svn_boolean_t is_deleted;
+      svn_boolean_t excluded;
+      svn_depth_t parent_depth;
 
       /* Check for an obstructed or missing node on disk. */
       {
         svn_wc_notify_state_t obstr_state;
-        SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, &kind,
+        SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, &excluded,
+                                          &kind, &parent_depth,
                                           merge_b, local_abspath,
-                                          svn_node_unknown,
                                           scratch_pool));
 
         if (obstr_state != svn_wc_notify_state_inapplicable)
@@ -2723,25 +2714,16 @@ merge_dir_opened(void **new_dir_baton,
              Non-inheritable mergeinfo will be recorded, allowing
              future merges into non-shallow working copies to merge
              changes we missed this time around. */
-          if (pdb != NULL)
+          if (pdb && (excluded
+                      || (parent_depth != svn_depth_unknown &&
+                          parent_depth < svn_depth_immediates)))
             {
-              svn_depth_t parent_depth;
-              const char *dir_abspath = svn_dirent_dirname(local_abspath,
-                                                           scratch_pool);
-
-              SVN_ERR(svn_wc__node_get_depth(&parent_depth,
-                                             merge_b->ctx->wc_ctx,
-                                             dir_abspath, scratch_pool));
-              if (parent_depth != svn_depth_unknown &&
-                  parent_depth < svn_depth_immediates)
-                {
-                  db->shadowed = TRUE;
+              db->shadowed = TRUE;
 
-                  db->tree_conflict_reason = CONFLICT_REASON_SKIP;
-                  db->skip_reason = svn_wc_notify_state_missing;
+              db->tree_conflict_reason = CONFLICT_REASON_SKIP;
+              db->skip_reason = svn_wc_notify_state_missing;
 
-                  return SVN_NO_ERROR;
-                }
+              return SVN_NO_ERROR;
             }
 
           if (is_deleted)
@@ -2828,9 +2810,9 @@ merge_dir_opened(void **new_dir_baton,
           svn_node_kind_t kind;
           svn_boolean_t is_deleted;
 
-          SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, &kind,
+          SVN_ERR(perform_obstruction_check(&obstr_state, &is_deleted, NULL,
+                                            &kind, NULL,
                                             merge_b, local_abspath,
-                                            svn_node_unknown,
                                             scratch_pool));
 
           /* In this case of adding a directory, we have an exception to the
@@ -5265,8 +5247,9 @@ record_skips_in_mergeinfo(const char *me
       /* Before we override, make sure this is a versioned path, it might
          be an external or missing from disk due to authz restrictions. */
       SVN_ERR(perform_obstruction_check(&obstruction_state, NULL, NULL,
+                                        NULL, NULL,
                                         merge_b, skipped_abspath,
-                                        svn_node_unknown, iterpool));
+                                        iterpool));
       if (obstruction_state == svn_wc_notify_state_obstructed
           || obstruction_state == svn_wc_notify_state_missing)
         continue;

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1443248&r1=1443247&r2=1443248&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Wed Feb  6 22:34:21 2013
@@ -1189,6 +1189,8 @@ svn_error_t *
 svn_wc__check_for_obstructions(svn_wc_notify_state_t *obstruction_state,
                                svn_node_kind_t *kind,
                                svn_boolean_t *deleted,
+                               svn_boolean_t *excluded,
+                               svn_depth_t *parent_depth,
                                svn_wc_context_t *wc_ctx,
                                const char *local_abspath,
                                svn_boolean_t no_wcroot_check,
@@ -1204,6 +1206,10 @@ svn_wc__check_for_obstructions(svn_wc_no
     *kind = svn_node_none;
   if (deleted)
     *deleted = FALSE;
+  if (excluded)
+    *excluded = FALSE;
+  if (parent_depth)
+    *parent_depth = svn_depth_unknown;
 
   SVN_ERR(svn_io_check_path(local_abspath, &disk_kind, scratch_pool));
 
@@ -1226,9 +1232,10 @@ svn_wc__check_for_obstructions(svn_wc_no
         }
 
       err = svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL, NULL,
+                                 NULL, NULL, NULL, parent_depth, NULL, NULL,
                                  NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                  NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                 NULL,
                                  wc_ctx->db, svn_dirent_dirname(local_abspath,
                                                                 scratch_pool),
                                  scratch_pool, scratch_pool);
@@ -1289,6 +1296,9 @@ svn_wc__check_for_obstructions(svn_wc_no
 
       case svn_wc__db_status_excluded:
       case svn_wc__db_status_server_excluded:
+        if (excluded)
+          *excluded = TRUE;
+        /* fall through */
       case svn_wc__db_status_incomplete:
         *obstruction_state = svn_wc_notify_state_missing;
         break;