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 2012/05/12 21:58:12 UTC

svn commit: r1337619 - in /subversion/trunk/subversion: bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java include/private/svn_wc_private.h include/svn_wc.h libsvn_client/commit_util.c libsvn_wc/node.c

Author: rhuijben
Date: Sat May 12 19:58:11 2012
New Revision: 1337619

URL: http://svn.apache.org/viewvc?rev=1337619&view=rev
Log:
Following up on r1337604, report a commit error on all obstructed commit
targets instead of just symlink changes.
This fixes special_tests.py 12, which I accidentally broke with r1337604.

This allows removing more processing from libsvn_wc's commit helper function.

* subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java
  (Action): Add new value.

* subversion/include/private/svn_wc_private.h
  (svn_wc__node_get_commit_status): Remove many unneeded arguments.

* subversion/include/svn_wc.h
  (svn_wc_notify_action_t): Add notification for obstruction, to help gui
    clients diagnose this error.

* subversion/libsvn_client/commit_util.c
  (harvest_status_callback): Remove unused and/or unneeded variables.
    Generalize obstruction handling. Update caller.
    Use result pool for lock tokens.

* subversion/libsvn_wc/node.c
  (svn_wc__node_get_commit_status): Remove unneeded processing.

Modified:
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/libsvn_wc/node.c

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java?rev=1337619&r1=1337618&r2=1337619&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java Sat May 12 19:58:11 2012
@@ -547,7 +547,10 @@ public class ClientNotifyInformation ext
         skip_conflicted ("skipped conflicted path"),
 
         /** The lock on a file was removed during update */
-        update_broken_lock ("broken lock removed");
+        update_broken_lock ("broken lock removed"),
+
+        /** Operation failed because a node is obstructed */
+        failed_obstructed ("failed by obstruction");
 
 
         /**

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=1337619&r1=1337618&r2=1337619&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Sat May 12 19:58:11 2012
@@ -1051,23 +1051,14 @@ svn_wc__get_tmpdir(const char **tmpdir_a
  * ### it's caller will eventually move into a wc and maybe wc_db api.
  */
 svn_error_t *
-svn_wc__node_get_commit_status(svn_node_kind_t *kind,
-                               svn_boolean_t *added,
+svn_wc__node_get_commit_status(svn_boolean_t *added,
                                svn_boolean_t *deleted,
-                               svn_boolean_t *replaced,
-                               svn_boolean_t *not_present,
-                               svn_boolean_t *excluded,
+                               svn_boolean_t *is_replace_root,
                                svn_boolean_t *is_op_root,
-                               svn_boolean_t *symlink,
                                svn_revnum_t *revision,
-                               const char **repos_relpath,
                                svn_revnum_t *original_revision,
                                const char **original_repos_relpath,
-                               svn_boolean_t *conflicted,
-                               const char **changelist,
-                               svn_boolean_t *props_mod,
                                svn_boolean_t *update_root,
-                               const char **lock_token,
                                svn_wc_context_t *wc_ctx,
                                const char *local_abspath,
                                apr_pool_t *result_pool,

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1337619&r1=1337618&r2=1337619&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Sat May 12 19:58:11 2012
@@ -1223,7 +1223,11 @@ typedef enum svn_wc_notify_action_t
 
   /** Just the lock on a file was removed during update.
    * @since New in 1.8. */
-  svn_wc_notify_update_broken_lock
+  svn_wc_notify_update_broken_lock,
+
+  /** Operation failed because a node is obstructed.
+   * @since New in 1.8. */
+  svn_wc_notify_failed_obstruction
 
 } svn_wc_notify_action_t;
 

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1337619&r1=1337618&r2=1337619&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Sat May 12 19:58:11 2012
@@ -532,8 +532,6 @@ harvest_status_callback(void *status_bat
                         apr_pool_t *scratch_pool)
 {
   apr_byte_t state_flags = 0;
-  svn_node_kind_t db_kind;
-  const char *node_relpath;
   svn_revnum_t node_rev;
   const char *cf_relpath = NULL;
   svn_revnum_t cf_rev = SVN_INVALID_REVNUM;
@@ -656,25 +654,22 @@ harvest_status_callback(void *status_bat
     }
   else if (status->node_status == svn_wc_status_obstructed)
     {
-      /* A node's type has changed before attempting to commit. */
-      svn_node_kind_t working_kind;
-      svn_boolean_t is_special;
+      /* A node's type has changed before attempting to commit.
+         This also catches symlink vs non symlink changes */
 
-      SVN_ERR(svn_io_check_special_path(local_abspath, &working_kind,
-                                        &is_special, scratch_pool));
-
-      if (status->kind == svn_node_file
-          && (working_kind == svn_node_file || is_special))
+      if (notify_func != NULL)
         {
-          /* A file was turned into a symlink or a symlink into a file */
-          return svn_error_createf(
-                    SVN_ERR_NODE_UNEXPECTED_KIND, NULL,
-                    _("Entry '%s' has unexpectedly changed special status"),
-                    svn_dirent_local_style(local_abspath, scratch_pool));
+          notify_func(notify_baton,
+                      svn_wc_create_notify(local_abspath,
+                                           svn_wc_notify_failed_obstruction,
+                                           scratch_pool),
+                      scratch_pool);
         }
 
-      /* The status walker will skip descendants */
-      return SVN_NO_ERROR;
+      return svn_error_createf(
+                    SVN_ERR_NODE_UNEXPECTED_KIND, NULL,
+                    _("Node '%s' has unexpectedly changed kind"),
+                    svn_dirent_local_style(local_abspath, scratch_pool));
     }
 
   if (status->conflicted && status->kind == svn_node_unknown)
@@ -683,22 +678,15 @@ harvest_status_callback(void *status_bat
   /* Return error on unknown path kinds.  We check both the entry and
      the node itself, since a path might have changed kind since its
      entry was written. */
-  SVN_ERR(svn_wc__node_get_commit_status(&db_kind, &is_added, &is_deleted,
+  SVN_ERR(svn_wc__node_get_commit_status(&is_added, &is_deleted,
                                          &is_replaced,
-                                         NULL /* not_present */,
-                                         NULL /* excluded */,
-                                         &is_op_root, NULL,
-                                         &node_rev, &node_relpath,
+                                         &is_op_root,
+                                         &node_rev,
                                          &original_rev, &original_relpath,
-                                         NULL, NULL, NULL,
                                          &is_update_root,
-                                         NULL,
                                          wc_ctx, local_abspath,
                                          scratch_pool, scratch_pool));
 
-  if (!node_relpath && commit_relpath)
-    node_relpath = commit_relpath;
-
   /* Handle file externals.
    * (IS_UPDATE_ROOT is more generally defined, but at the moment this
    * condition matches only file externals.)
@@ -711,7 +699,7 @@ harvest_status_callback(void *status_bat
    * targets iff they count.
    */
   if (is_update_root
-      && db_kind == svn_node_file
+      && status->kind == svn_node_file
       && (copy_mode || ! is_harvest_root))
     {
       return SVN_NO_ERROR;
@@ -742,9 +730,6 @@ harvest_status_callback(void *status_bat
   if (is_deleted && !is_op_root /* && !is_added */)
     return SVN_NO_ERROR; /* Not an operational delete and not an add. */
 
-  if (node_relpath == NULL)
-    node_relpath = status->repos_relpath;
-
   /* Check for the deletion case.
      * We delete explicitly deleted nodes (duh!)
      * We delete not-present children of copies
@@ -807,7 +792,7 @@ harvest_status_callback(void *status_bat
       svn_boolean_t text_mod = FALSE;
       svn_boolean_t prop_mod = FALSE;
 
-      if (db_kind == svn_node_file)
+      if (status->kind == svn_node_file)
         {
           /* Check for text modifications on files */
           if ((state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)
@@ -843,11 +828,12 @@ harvest_status_callback(void *status_bat
       if (matches_changelists)
         {
           /* Finally, add the committable item. */
-          SVN_ERR(add_committable(committables, local_abspath, db_kind,
+          SVN_ERR(add_committable(committables, local_abspath,
+                                  status->kind,
                                   repos_root_url,
                                   copy_mode
                                       ? commit_relpath
-                                      : node_relpath,
+                                      : status->repos_relpath,
                                   copy_mode
                                       ? SVN_INVALID_REVNUM
                                       : node_rev,
@@ -858,10 +844,10 @@ harvest_status_callback(void *status_bat
           if (state_flags & SVN_CLIENT_COMMIT_ITEM_LOCK_TOKEN)
             apr_hash_set(lock_tokens,
                          svn_path_url_add_component2(
-                             repos_root_url, node_relpath,
-                             apr_hash_pool_get(lock_tokens)),
+                             repos_root_url, status->repos_relpath,
+                             result_pool),
                          APR_HASH_KEY_STRING,
-                         apr_pstrdup(apr_hash_pool_get(lock_tokens),
+                         apr_pstrdup(result_pool,
                                      status->lock->token));
         }
     }
@@ -936,7 +922,7 @@ harvest_status_callback(void *status_bat
       && !(state_flags & SVN_CLIENT_COMMIT_ITEM_ADD))
     {
       /* Skip all descendants */
-      if (db_kind == svn_node_dir)
+      if (status->kind == svn_node_dir)
         baton->skip_below_abspath = apr_pstrdup(baton->result_pool,
                                                 local_abspath);
       return SVN_NO_ERROR;
@@ -945,7 +931,7 @@ harvest_status_callback(void *status_bat
   /* Recursively handle each node according to depth, except when the
      node is only being deleted, or is in an added tree (as added trees
      use the normal commit handling). */
-  if (copy_mode && !is_added && !is_deleted && db_kind == svn_node_dir)
+  if (copy_mode && !is_added && !is_deleted && status->kind == svn_node_dir)
     {
       SVN_ERR(harvest_not_present_for_copy(wc_ctx, local_abspath, committables,
                                            repos_root_url, commit_relpath,

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1337619&r1=1337618&r2=1337619&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Sat May 12 19:58:11 2012
@@ -1502,68 +1502,40 @@ svn_wc__node_get_origin(svn_boolean_t *i
 }
 
 svn_error_t *
-svn_wc__node_get_commit_status(svn_node_kind_t *kind,
-                               svn_boolean_t *added,
+svn_wc__node_get_commit_status(svn_boolean_t *added,
                                svn_boolean_t *deleted,
                                svn_boolean_t *is_replace_root,
-                               svn_boolean_t *not_present,
-                               svn_boolean_t *excluded,
                                svn_boolean_t *is_op_root,
-                               svn_boolean_t *symlink,
                                svn_revnum_t *revision,
-                               const char **repos_relpath,
                                svn_revnum_t *original_revision,
                                const char **original_repos_relpath,
-                               svn_boolean_t *conflicted,
-                               const char **changelist,
-                               svn_boolean_t *props_mod,
                                svn_boolean_t *update_root,
-                               const char **lock_token,
                                svn_wc_context_t *wc_ctx,
                                const char *local_abspath,
                                apr_pool_t *result_pool,
                                apr_pool_t *scratch_pool)
 {
   svn_wc__db_status_t status;
-  svn_kind_t db_kind;
-  svn_wc__db_lock_t *lock;
   svn_boolean_t had_props;
-  svn_boolean_t props_mod_tmp;
   svn_boolean_t have_base;
   svn_boolean_t have_more_work;
   svn_boolean_t op_root;
 
-  if (!props_mod)
-    props_mod = &props_mod_tmp;
-
   /* ### All of this should be handled inside a single read transaction */
-  SVN_ERR(svn_wc__db_read_info(&status, &db_kind, revision, repos_relpath,
+  SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, NULL,
                                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                original_repos_relpath, NULL, NULL,
-                               original_revision, &lock, NULL, NULL,
-                               changelist, conflicted,
-                               &op_root, &had_props, props_mod,
+                               original_revision, NULL, NULL, NULL,
+                               NULL, NULL,
+                               &op_root, NULL, NULL,
                                &have_base, &have_more_work, NULL,
                                wc_ctx->db, local_abspath,
                                result_pool, scratch_pool));
 
-  if (kind)
-    {
-      if (db_kind == svn_kind_file)
-        *kind = svn_node_file;
-      else if (db_kind == svn_kind_dir)
-        *kind = svn_node_dir;
-      else
-        *kind = svn_node_unknown;
-    }
   if (added)
     *added = (status == svn_wc__db_status_added);
   if (deleted)
     *deleted = (status == svn_wc__db_status_deleted);
-  if (not_present)
-    *not_present = (status == svn_wc__db_status_not_present);
-  if (excluded)
-    *excluded = (status == svn_wc__db_status_excluded);
   if (is_op_root)
     *is_op_root = op_root;
 
@@ -1579,23 +1551,6 @@ svn_wc__node_get_commit_status(svn_node_
         *is_replace_root = FALSE;
     }
 
-  if (symlink)
-    {
-      apr_hash_t *props;
-      *symlink = FALSE;
-
-      if (db_kind == svn_kind_file
-          && (had_props || *props_mod))
-        {
-          SVN_ERR(svn_wc__db_read_props(&props, wc_ctx->db, local_abspath,
-                                        scratch_pool, scratch_pool));
-
-          *symlink = ((props != NULL)
-                      && (apr_hash_get(props, SVN_PROP_SPECIAL,
-                                       APR_HASH_KEY_STRING) != NULL));
-        }
-    }
-
   /* Retrieve some information from BASE which is needed for replacing
      and/or deleting BASE nodes. (We don't need lock here) */
   if (have_base
@@ -1611,9 +1566,6 @@ svn_wc__node_get_commit_status(svn_node_
   else if (update_root)
     *update_root = FALSE;
 
-  if (lock_token)
-    *lock_token = lock ? lock->token : NULL;
-
   return SVN_NO_ERROR;
 }