subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1603617 - in /subversion/trunk/subversion: libsvn_client/commit.c tests/cmdline/lock_tests.py
Date Wed, 18 Jun 2014 20:05:57 GMT
Author: rhuijben
Date: Wed Jun 18 20:05:57 2014
New Revision: 1603617

URL: http://svn.apache.org/r1603617
Log:
Resolve the issue for which I added a regression test in r1603497.

* subversion/libsvn_client/commit.c
  (post_process_commit_item): Add svn_error_tracer
  (post_process_no_commit_item): New function like post_process_commit_item,
    but just handling the no-commit operations.
  (svn_client_commit6): Only call post_process_commit_item on items that we
    are really committing, and post_process_no_commit_item on everything else.

* subversion/tests/cmdline/lock_tests.py
  (commit_file_unlock): Update expected result to no longer
    expect an invalid bump.
  (lock_commit_bump): Remove XFail marker.

Modified:
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/tests/cmdline/lock_tests.py

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1603617&r1=1603616&r2=1603617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Wed Jun 18 20:05:57 2014
@@ -249,10 +249,38 @@ post_process_commit_item(svn_wc_committe
   if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
     remove_lock = TRUE;
 
-  return svn_wc_queue_committed3(queue, wc_ctx, item->path,
-                                 loop_recurse, item->incoming_prop_changes,
+  return svn_error_trace(
+         svn_wc_queue_committed3(queue, wc_ctx, item->path,
+                                 loop_recurse,
+                                 item->incoming_prop_changes,
                                  remove_lock, !keep_changelists,
-                                 sha1_checksum, scratch_pool);
+                                 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
@@ -915,6 +943,12 @@ 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))
+            {
+              SVN_DBG(("Skip handling for: %s: %d", item->path, item->state_flags));
+              continue; /* Nothing to post process via the queue */
+            }
+
           svn_pool_clear(iterpool);
           bump_err = post_process_commit_item(
                        queue, item, ctx->wc_ctx,
@@ -933,6 +967,26 @@ svn_client_commit6(const apr_array_heade
                    commit_info->author,
                    ctx->cancel_func, ctx->cancel_baton,
                    iterpool);
+
+      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/tests/cmdline/lock_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/lock_tests.py?rev=1603617&r1=1603616&r2=1603617&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/lock_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/lock_tests.py Wed Jun 18 20:05:57 2014
@@ -165,14 +165,20 @@ def commit_file_unlock(sbox):
 
   # make a change and commit it, allowing lock to be released
   sbox.simple_append('A/mu', 'Tweak!\n')
-  sbox.simple_commit()
+
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/mu'              : Item(verb='Sending'),
+  })
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.tweak('A/mu', wc_rev=2)
-  expected_status.tweak('iota', wc_rev=2)
 
-  # Make sure the file is unlocked
-  svntest.actions.run_and_verify_status(wc_dir, expected_status)
+  # Make sure both iota an mu are unlocked, but only mu is bumped
+  svntest.actions.run_and_verify_commit(wc_dir,
+                                        expected_output,
+                                        expected_status,
+                                        None,
+                                        wc_dir)
 
 #----------------------------------------------------------------------
 def commit_propchange(sbox):
@@ -2305,7 +2311,6 @@ def delete_locked_file_with_percent(sbox
   #  Invalid percent encoded URI in tagged If-header [400, #104]
   sbox.simple_commit()
 
-@XFail()
 def lock_commit_bump(sbox):
   "a commit should not bump just locked files"
 



Mime
View raw message