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 2014/10/09 11:01:40 UTC

svn commit: r1630337 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/commit.c libsvn_wc/adm_ops.c libsvn_wc/deprecated.c

Author: rhuijben
Date: Thu Oct  9 09:01:39 2014
New Revision: 1630337

URL: http://svn.apache.org/r1630337
Log:
Following up on r1603617 and r1603619, move the logic of the post commit
handling of nodes that shouldn't be bumped in the commit queue. This moves
the logic into the working copy and allows further improvements by reducing
the number of db transactions.

* subversion/include/svn_wc.h
  (svn_wc_queue_committed4): New function.
  (svn_wc_queue_committed3): Deprecate function.

* subversion/libsvn_client/commit.c
  (post_process_commit_item): Update caller.
  (post_process_no_commit_item): Remove function.
  (svn_client_commit6): Remove no-commit filter and no-commit handling.

* subversion/libsvn_wc/adm_ops.c
  (committed_queue_item_t): Add committed boolean.
  (svn_wc_queue_committed3): Rename to ...
  (svn_wc_queue_committed4): ... this and allow setting committed boolean.
  (svn_wc_process_committed_queue2): Handle not bumping specific items.

* subversion/libsvn_wc/deprecated.c
  (svn_wc_queue_committed3): New function.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/deprecated.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1630337&r1=1630336&r2=1630337&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Thu Oct  9 09:01:39 2014
@@ -5204,7 +5204,25 @@ svn_wc_committed_queue_create(apr_pool_t
  * Temporary allocations will be performed in @a scratch_pool, and persistent
  * allocations will use the same pool as @a queue used when it was created.
  *
+ * @since New in 1.9.
+ */
+svn_error_t *
+svn_wc_queue_committed4(svn_wc_committed_queue_t *queue,
+                        svn_wc_context_t *wc_ctx,
+                        const char *local_abspath,
+                        svn_boolean_t recurse,
+                        svn_boolean_t is_committed,
+                        const apr_array_header_t *wcprop_changes,
+                        svn_boolean_t remove_lock,
+                        svn_boolean_t remove_changelist,
+                        const svn_checksum_t *sha1_checksum,
+                        apr_pool_t *scratch_pool);
+
+/** Similar to svn_wc_queue_committed4, but with is_committed always
+ * TRUE.
+ *
  * @since New in 1.7.
+ * @deprecated Provided for backwards compatibility with the 1.8 API.
  */
 svn_error_t *
 svn_wc_queue_committed3(svn_wc_committed_queue_t *queue,

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1630337&r1=1630336&r2=1630337&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Thu Oct  9 09:01:39 2014
@@ -250,39 +250,18 @@ post_process_commit_item(svn_wc_committe
     remove_lock = TRUE;
 
   return svn_error_trace(
-         svn_wc_queue_committed3(queue, wc_ctx, item->path,
+         svn_wc_queue_committed4(queue, wc_ctx, item->path,
                                  loop_recurse,
+                                 0 != (item->state_flags & 
+                                       (SVN_CLIENT_COMMIT_ITEM_ADD
+                                        | SVN_CLIENT_COMMIT_ITEM_DELETE
+                                        | SVN_CLIENT_COMMIT_ITEM_TEXT_MODS
+                                        | SVN_CLIENT_COMMIT_ITEM_PROP_MODS)),
                                  item->incoming_prop_changes,
                                  remove_lock, !keep_changelists,
                                  sha1_checksum, scratch_pool));
 }
 
-/* Do similar handling as post_process_commit_item() but for items that
- * are commit items, but aren't actual changes. Most importantly
- * remove lock tokens. */
-static svn_error_t *
-post_process_no_commit_item(const svn_client_commit_item3_t *item,
-                            svn_wc_context_t *wc_ctx,
-                            svn_boolean_t keep_changelists,
-                            svn_boolean_t keep_locks,
-                            apr_pool_t *scratch_pool)
-{
-  if ((item->state_flags & SVN_CLIENT_COMMIT_ITEM_LOCK_TOKEN)
-      && !keep_locks)
-    {
-      SVN_ERR(svn_wc_remove_lock2(wc_ctx, item->path, scratch_pool));
-    }
-
-  if (!keep_changelists)
-    SVN_ERR(svn_wc_set_changelist2(wc_ctx, item->path, NULL,
-                                   svn_depth_empty, NULL,
-                                   NULL, NULL,
-                                   NULL, NULL,
-                                   scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
 /* Given a list of committables described by their common base abspath
    BASE_ABSPATH and a list of relative dirents TARGET_RELPATHS determine
    which absolute paths must be locked to commit all these targets and
@@ -943,11 +922,6 @@ svn_client_commit6(const apr_array_heade
           svn_client_commit_item3_t *item
             = APR_ARRAY_IDX(commit_items, i, svn_client_commit_item3_t *);
 
-          if (! (item->state_flags & ~ SVN_CLIENT_COMMIT_ITEM_LOCK_TOKEN))
-            {
-              continue; /* Nothing to post process via the queue */
-            }
-
           svn_pool_clear(iterpool);
           bump_err = post_process_commit_item(
                        queue, item, ctx->wc_ctx,
@@ -969,23 +943,6 @@ svn_client_commit6(const apr_array_heade
 
       if (bump_err)
         goto cleanup;
-
-      for (i = 0; i < commit_items->nelts; i++)
-        {
-          svn_client_commit_item3_t *item
-            = APR_ARRAY_IDX(commit_items, i, svn_client_commit_item3_t *);
-
-          if (item->state_flags & ~ SVN_CLIENT_COMMIT_ITEM_LOCK_TOKEN)
-            continue; /* Already processed via the queue */
-
-          svn_pool_clear(iterpool);
-          bump_err = post_process_no_commit_item(
-                       item, ctx->wc_ctx,
-                       keep_changelists, keep_locks,
-                       iterpool);
-          if (bump_err)
-            goto cleanup;
-        }
     }
 
  cleanup:

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1630337&r1=1630336&r2=1630337&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Thu Oct  9 09:01:39 2014
@@ -73,6 +73,7 @@ typedef struct committed_queue_item_t
 {
   const char *local_abspath;
   svn_boolean_t recurse;
+  svn_boolean_t committed;
   svn_boolean_t no_unlock;
   svn_boolean_t keep_changelist;
 
@@ -366,10 +367,11 @@ svn_wc_committed_queue_create(apr_pool_t
 
 
 svn_error_t *
-svn_wc_queue_committed3(svn_wc_committed_queue_t *queue,
+svn_wc_queue_committed4(svn_wc_committed_queue_t *queue,
                         svn_wc_context_t *wc_ctx,
                         const char *local_abspath,
                         svn_boolean_t recurse,
+                        svn_boolean_t is_commited,
                         const apr_array_header_t *wcprop_changes,
                         svn_boolean_t remove_lock,
                         svn_boolean_t remove_changelist,
@@ -390,6 +392,7 @@ svn_wc_queue_committed3(svn_wc_committed
   cqi = apr_palloc(queue->pool, sizeof(*cqi));
   cqi->local_abspath = local_abspath;
   cqi->recurse = recurse;
+  cqi->committed = is_commited;
   cqi->no_unlock = !remove_lock;
   cqi->keep_changelist = !remove_changelist;
   cqi->sha1_checksum = sha1_checksum;
@@ -473,16 +476,45 @@ svn_wc_process_committed_queue2(svn_wc_c
                                                          iterpool))
         continue;
 
-      SVN_ERR(svn_wc__process_committed_internal(
-                wc_ctx->db, cqi->local_abspath,
-                cqi->recurse,
-                TRUE /* top_of_recurse */,
-                new_revnum, new_date, rev_author,
-                cqi->new_dav_cache,
-                cqi->no_unlock,
-                cqi->keep_changelist,
-                cqi->sha1_checksum, queue,
-                iterpool));
+      if (!cqi->committed)
+        {
+          if (cqi->no_unlock && cqi->keep_changelist)
+            continue; /* Nothing to do */
+
+          if (!cqi->no_unlock)
+            {
+              svn_skel_t *work_item;
+
+              SVN_ERR(svn_wc__wq_build_sync_file_flags(&work_item,
+                                                       wc_ctx->db,
+                                                       cqi->local_abspath,
+                                                       iterpool, iterpool));
+
+              SVN_ERR(svn_wc__db_lock_remove(wc_ctx->db, cqi->local_abspath,
+                                             work_item, iterpool));
+            }
+          if (!cqi->keep_changelist)
+            SVN_ERR(svn_wc__db_op_set_changelist(wc_ctx->db,
+                                                 cqi->local_abspath,
+                                                 NULL, NULL,
+                                                 svn_depth_empty,
+                                                 NULL, NULL, /* notify */
+                                                 NULL, NULL, /* cancel */
+                                                 iterpool));
+        }
+      else
+        {
+          SVN_ERR(svn_wc__process_committed_internal(
+                                  wc_ctx->db, cqi->local_abspath,
+                                  cqi->recurse,
+                                  TRUE /* top_of_recurse */,
+                                  new_revnum, new_date, rev_author,
+                                  cqi->new_dav_cache,
+                                  cqi->no_unlock,
+                                  cqi->keep_changelist,
+                                  cqi->sha1_checksum, queue,
+                                  iterpool));
+        }
 
       /* Don't run the wq now, but remember that we must call it for this
          working copy */

Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1630337&r1=1630336&r2=1630337&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Thu Oct  9 09:01:39 2014
@@ -652,6 +652,24 @@ svn_wc_get_pristine_contents(svn_stream_
   return svn_error_trace(svn_wc_context_destroy(wc_ctx));
 }
 
+svn_error_t *
+svn_wc_queue_committed3(svn_wc_committed_queue_t *queue,
+                        svn_wc_context_t *wc_ctx,
+                        const char *local_abspath,
+                        svn_boolean_t recurse,
+                        const apr_array_header_t *wcprop_changes,
+                        svn_boolean_t remove_lock,
+                        svn_boolean_t remove_changelist,
+                        const svn_checksum_t *sha1_checksum,
+                        apr_pool_t *scratch_pool)
+{
+  return svn_error_trace(
+            svn_wc_queue_committed4(queue, wc_ctx, local_abspath,
+                                    recurse, TRUE /* is_committed */,
+                                    wcprop_changes, remove_lock,
+                                    remove_changelist, sha1_checksum,
+                                    scratch_pool));
+}
 
 svn_error_t *
 svn_wc_queue_committed2(svn_wc_committed_queue_t *queue,