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/06 21:17:40 UTC

svn commit: r1089592 - /subversion/trunk/subversion/libsvn_client/commit_util.c

Author: rhuijben
Date: Wed Apr  6 19:17:40 2011
New Revision: 1089592

URL: http://svn.apache.org/viewvc?rev=1089592&view=rev
Log:
* subversion/libsvn_client/commit_util.c
  (bail_on_tree_conflicted_ancestor): Simplify logic with some new wc-ng apis.
    This avoids some db operations that try to determine the working copy root.

Modified:
    subversion/trunk/subversion/libsvn_client/commit_util.c

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1089592&r1=1089591&r2=1089592&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Wed Apr  6 19:17:40 2011
@@ -254,44 +254,39 @@ bail_on_tree_conflicted_children(svn_wc_
 
 /* Helper function for svn_client__harvest_committables().
  * Determine whether we are within a tree-conflicted subtree of the
- * working copy and return an SVN_ERR_WC_FOUND_CONFLICT error if so.
- * Step outward through the parent directories up to the working copy
- * root, obtaining read locks temporarily. */
+ * working copy and return an SVN_ERR_WC_FOUND_CONFLICT error if so. */
 static svn_error_t *
 bail_on_tree_conflicted_ancestor(svn_wc_context_t *wc_ctx,
-                                 const char *first_abspath,
+                                 const char *local_abspath,
                                  apr_pool_t *scratch_pool)
 {
-  const char *local_abspath;
-  const char *parent_abspath;
-  svn_boolean_t wc_root;
-  svn_boolean_t tree_conflicted;
-
-  local_abspath = first_abspath;
-
-  while(1)
-    {
-      SVN_ERR(svn_wc__strictly_is_wc_root(&wc_root,
-                                          wc_ctx,
-                                          local_abspath,
-                                          scratch_pool));
+  const char *wcroot_abspath;
 
-      if (wc_root)
-        break;
+  SVN_ERR(svn_wc_get_wc_root(&wcroot_abspath, wc_ctx, local_abspath,
+                             scratch_pool, scratch_pool));
+
+  local_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
+
+  while(svn_dirent_is_ancestor(wcroot_abspath, local_abspath))
+    {
+      svn_boolean_t tree_conflicted;
 
-      /* Check the parent directory's entry for tree-conflicts
-       * on PATH. */
-      parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
+      /* Check if the parent has tree conflicts */
       SVN_ERR(svn_wc_conflicted_p3(NULL, NULL, &tree_conflicted,
-                                   wc_ctx, parent_abspath, scratch_pool));
+                                   wc_ctx, local_abspath, scratch_pool));
       if (tree_conflicted)
-        return svn_error_createf(
-                 SVN_ERR_WC_FOUND_CONFLICT, NULL,
-                 _("Aborting commit: '%s' remains in tree-conflict"),
-                 svn_dirent_local_style(local_abspath, scratch_pool));
+        {
+          return svn_error_createf(
+                   SVN_ERR_WC_FOUND_CONFLICT, NULL,
+                   _("Aborting commit: '%s' remains in tree-conflict"),
+                   svn_dirent_local_style(local_abspath, scratch_pool));
+        }
 
       /* Step outwards */
-      local_abspath = parent_abspath;
+      if (svn_dirent_is_root(local_abspath, strlen(local_abspath)))
+        break;
+      else
+        local_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
     }
 
   return SVN_NO_ERROR;