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 2011/04/28 22:42:45 UTC

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

Author: rhuijben
Date: Thu Apr 28 20:42:45 2011
New Revision: 1097601

URL: http://svn.apache.org/viewvc?rev=1097601&view=rev
Log:
Following up on r1096759, remove some unneeded arguments from
svn_wc__check_for_obstructions and perform_obstruction_check.

* subversion/include/private/svn_wc_private.h
  (svn_wc__check_for_obstructions): Update argument list and write
    documentation.

* subversion/libsvn_client/merge.c
  (perform_obstruction_check): Remove two arguments. Update caller.
  (merge_dir_props_changed,
   merge_file_changed,
   merge_file_added,
   merge_file_deleted,
   merge_dir_added,
   merge_dir_deleted,
   merge_dir_opened): Update caller.

* subversion/libsvn_wc/node.c
  (svn_wc__check_for_obstructions): Remove arguments. Allow checking for
    conflicts.

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=1097601&r1=1097600&r2=1097601&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Thu Apr 28 20:42:45 2011
@@ -907,20 +907,42 @@ svn_wc__node_get_commit_status(svn_node_
                                apr_pool_t *result_pool,
                                apr_pool_t *scratch_pool);
 
-/* Checks for obstructions for the merge processing
+/* Checks a node LOCAL_ABSPATH in WC_CTX for several kinds of obstructions
+ * for tasks like merge processing.
  *
- * ### Currently this API is work in progress and is designed for just this
- * ### caller.
+ * If a node is not obstructed it sets *OBSTRUCTION_STATE to
+ * svn_wc_notify_state_inapplicable. If a node is obstructed or when its
+ * direct parent does not exist or is deleted return _state_obstructed. When
+ * a node doesn't exist but should exist return svn_wc_notify_state_missing.
  *
- * All output arguments except OBSTRUCTION_STATE may be NULL.
+ * A node is also obstructed if it is marked excluded or absent or when
+ * an unversioned file or directory exists. And if NO_WCROOT_CHECK is FALSE,
+ * the root of a working copy is also obstructed; this to allow detecting
+ * obstructing working copies.
+ *
+ * If KIND is not NULL, set *KIND to the kind of node registered in the working
+ * copy, or SVN_NODE_NONE if the node doesn't
+ *
+ * If ADDED is not NULL, set *ADDED to TRUE if the node is added. (Addition,
+ * copy or moved).
+ *
+ * If DELETED is not NULL, set *DELETED to TRUE if the node is marked as
+ * deleted in the working copy.
+ *
+ * If CONFLICTED is not NULL, set *CONFLICTED to TRUE if the node is somehow
+ * conflicted.
+ *
+ * All output arguments except OBSTRUCTION_STATE can be NULL to ommit the
+ * result.
+ *
+ * This function performs temporary allocations in SCRATCH_POOL.
  */
 svn_error_t *
 svn_wc__check_for_obstructions(svn_wc_notify_state_t *obstruction_state,
-                               svn_boolean_t *exists,
-                               svn_boolean_t *versioned,
+                               svn_node_kind_t *kind,
                                svn_boolean_t *added,
                                svn_boolean_t *deleted,
-                               svn_node_kind_t *kind,
+                               svn_boolean_t *conflicted,
                                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=1097601&r1=1097600&r2=1097601&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu Apr 28 20:42:45 2011
@@ -362,8 +362,6 @@ 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 *exists,
-                          svn_boolean_t *versioned,
                           svn_boolean_t *added,
                           svn_boolean_t *deleted,
                           svn_node_kind_t *kind,
@@ -380,10 +378,6 @@ perform_obstruction_check(svn_wc_notify_
 
   *obstruction_state = svn_wc_notify_state_inapplicable;
 
-  if (exists)
-    *exists = FALSE;
-  if (versioned)
-    *versioned = FALSE;
   if (added)
     *added = FALSE;
   if (deleted)
@@ -397,12 +391,10 @@ perform_obstruction_check(svn_wc_notify_
       if (dry_run_deleted_p(merge_b, local_abspath))
         {
           *obstruction_state = svn_wc_notify_state_inapplicable;
-        
-          if (versioned)
-            *versioned = TRUE;
+
           if (deleted)
             *deleted = TRUE;
-        
+
           if (expected_kind != svn_node_unknown
               && expected_kind != svn_node_none)
             *obstruction_state = svn_wc_notify_state_obstructed;
@@ -412,8 +404,6 @@ perform_obstruction_check(svn_wc_notify_
         {
           *obstruction_state = svn_wc_notify_state_inapplicable;
 
-          if (versioned)
-            *versioned = TRUE;
           if (added)
             *added = TRUE;
           if (kind)
@@ -429,11 +419,10 @@ perform_obstruction_check(svn_wc_notify_
   check_root = ! strcmp(local_abspath, merge_b->target_abspath);
 
   SVN_ERR(svn_wc__check_for_obstructions(obstruction_state,
-                                         exists,
-                                         versioned,
+                                         kind,
                                          added,
                                          deleted,
-                                         kind,
+                                         NULL,
                                          wc_ctx, local_abspath,
                                          check_root,
                                          scratch_pool));
@@ -1212,7 +1201,7 @@ merge_dir_props_changed(svn_wc_notify_st
   merge_cmd_baton_t *merge_b = diff_baton;
   svn_wc_notify_state_t obstr_state;
 
-  SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL, NULL, NULL,
+  SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL,
                                     NULL,
                                     merge_b, local_abspath, svn_node_dir,
                                     scratch_pool));
@@ -1339,7 +1328,7 @@ merge_file_changed(svn_wc_notify_state_t
   {
     svn_wc_notify_state_t obstr_state;
 
-    SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL, NULL,
+    SVN_ERR(perform_obstruction_check(&obstr_state, NULL,
                                       &is_deleted, &wc_kind,
                                       merge_b, mine_abspath, svn_node_unknown,
                                       scratch_pool));
@@ -1590,7 +1579,7 @@ merge_file_added(svn_wc_notify_state_t *
   {
     svn_wc_notify_state_t obstr_state;
 
-    SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL, NULL, NULL,
+    SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL,
                                       &kind,
                                       merge_b, mine_abspath, svn_node_unknown,
                                       scratch_pool));
@@ -1877,7 +1866,7 @@ merge_file_deleted(svn_wc_notify_state_t
   {
     svn_wc_notify_state_t obstr_state;
 
-    SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL, NULL, NULL,
+    SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL,
                                       NULL,
                                       merge_b, mine_abspath, svn_node_unknown,
                                       scratch_pool));
@@ -2020,10 +2009,13 @@ merge_dir_added(svn_wc_notify_state_t *s
   {
     svn_wc_notify_state_t obstr_state;
 
-    SVN_ERR(perform_obstruction_check(&obstr_state, NULL, &is_versioned, NULL,
+    SVN_ERR(perform_obstruction_check(&obstr_state, NULL,
                                       &is_deleted, &kind,
                                       merge_b, local_abspath, svn_node_unknown,
                                       scratch_pool));
+
+    is_versioned = (kind == svn_node_dir) || (kind == svn_node_file);
+
     /* In this case of adding a directory, we have an exception to the usual
      * "skip if it's inconsistent" rule. If the directory exists on disk
      * unexpectedly, we simply make it versioned, because we can do so without
@@ -2192,10 +2184,13 @@ merge_dir_deleted(svn_wc_notify_state_t 
   {
     svn_wc_notify_state_t obstr_state;
 
-    SVN_ERR(perform_obstruction_check(&obstr_state, NULL, &is_versioned, NULL,
+    SVN_ERR(perform_obstruction_check(&obstr_state, NULL,
                                       &is_deleted, &kind,
                                       merge_b, local_abspath, svn_node_unknown,
                                       scratch_pool));
+
+    is_versioned = (kind == svn_node_dir) || (kind == svn_node_file);
+
     if (obstr_state != svn_wc_notify_state_inapplicable)
       {
         if (state)
@@ -2314,7 +2309,7 @@ merge_dir_opened(svn_boolean_t *tree_con
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
   /* Check for an obstructed or missing node on disk. */
-  SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL, NULL,
+  SVN_ERR(perform_obstruction_check(&obstr_state, NULL,
                                     &is_deleted, &wc_kind,
                                     merge_b, local_abspath, svn_node_unknown,
                                     scratch_pool));

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1097601&r1=1097600&r2=1097601&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Thu Apr 28 20:42:45 2011
@@ -1632,11 +1632,10 @@ svn_wc__rename_wc(svn_wc_context_t *wc_c
 
 svn_error_t *
 svn_wc__check_for_obstructions(svn_wc_notify_state_t *obstruction_state,
-                               svn_boolean_t *exists,
-                               svn_boolean_t *versioned,
+                               svn_node_kind_t *kind,
                                svn_boolean_t *added,
                                svn_boolean_t *deleted,
-                               svn_node_kind_t *kind,
+                               svn_boolean_t *conflicted,
                                svn_wc_context_t *wc_ctx,
                                const char *local_abspath,
                                svn_boolean_t no_wcroot_check,
@@ -1645,26 +1644,25 @@ svn_wc__check_for_obstructions(svn_wc_no
   svn_wc__db_status_t status;
   svn_wc__db_kind_t db_kind;
   svn_node_kind_t disk_kind;
+  svn_boolean_t conflicted_p;
   svn_error_t *err;
 
   *obstruction_state = svn_wc_notify_state_inapplicable;
-  if (exists)
-    *exists = FALSE;
-  if (versioned)
-    *versioned = FALSE;
+  if (kind)
+    *kind = svn_node_none;
   if (added)
     *added = FALSE;
   if (deleted)
     *deleted = FALSE;
-  if (kind)
-    *kind = svn_node_none;
+  if (conflicted)
+    *conflicted = FALSE;
 
   SVN_ERR(svn_io_check_path(local_abspath, &disk_kind, scratch_pool));
 
   err = svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL, NULL, NULL,
                              NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                             NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                             NULL, NULL, NULL, NULL,
+                             NULL, NULL, NULL, NULL, NULL, &conflicted_p, NULL,
+                             NULL, NULL, NULL, NULL, NULL,
                              wc_ctx->db, local_abspath,
                              scratch_pool, scratch_pool);
 
@@ -1679,10 +1677,10 @@ svn_wc__check_for_obstructions(svn_wc_no
           return SVN_NO_ERROR;
         }
 
-      err = svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL, NULL, NULL,
+      err = svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL, NULL,
+                                 NULL, NULL, NULL, 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);
@@ -1733,8 +1731,6 @@ svn_wc__check_for_obstructions(svn_wc_no
   switch (status)
     {
       case svn_wc__db_status_deleted:
-        if (versioned)
-          *versioned = TRUE;
         if (deleted)
           *deleted = TRUE;
         /* Fall through to svn_wc__db_status_not_present */
@@ -1746,8 +1742,6 @@ svn_wc__check_for_obstructions(svn_wc_no
       case svn_wc__db_status_excluded:
       case svn_wc__db_status_absent:
       case svn_wc__db_status_incomplete:
-        if (versioned)
-          *versioned = TRUE;
         *obstruction_state = svn_wc_notify_state_missing;
         break;
 
@@ -1756,10 +1750,6 @@ svn_wc__check_for_obstructions(svn_wc_no
           *added = TRUE;
         /* Fall through to svn_wc__db_status_normal */
       case svn_wc__db_status_normal:
-        if (versioned)
-          *versioned = TRUE;
-        if (exists)
-          *exists = TRUE;
         if (disk_kind == svn_node_none)
           *obstruction_state = svn_wc_notify_state_missing;
         else
@@ -1777,6 +1767,17 @@ svn_wc__check_for_obstructions(svn_wc_no
         SVN_ERR_MALFUNCTION();
     }
 
+  if (conflicted_p && (conflicted != NULL))
+    {
+      svn_boolean_t text_c, prop_c, tree_c;
+
+      SVN_ERR(svn_wc__internal_conflicted_p(&text_c, &prop_c, &tree_c,
+                                            wc_ctx->db, local_abspath,
+                                            scratch_pool));
+
+      *conflicted = (text_c || prop_c || tree_c);
+    }
+
   return SVN_NO_ERROR;
 }