Author: rhuijben
Date: Wed May  4 12:30:56 2011
New Revision: 1099429

URL: http://svn.apache.org/viewvc?rev=1099429&view=rev
Log:
Add an commit_as_operations mode to svn_client_commit5(), to allow committing
only a copy without the changes to its descendants.

This new flag changes the behavior for commits where the depth is limited by
passing an explicit depth.

* subversion/bindings/javahl/native/SVNClient.cpp
  (commit): Update caller. Ask for new behavior.

* subversion/include/svn_client.h
  (svn_client_commit5): Add argument and documentation for the new argument.

* subversion/libsvn_client/commit.c
  (post_process_commit_item): Add argument to change recursive behavior of the
    post commit processing.
  (svn_client_commit5): Add argument and use it to change the delete and copy
    behavior with limited depths. Clear iterpool after harvesting.

* subversion/libsvn_client/deprecated.c
  (svn_client_commit4): Update caller. Request old behavior.

* subversion/svn/commit-cmd.c
  (svn_cl__commit): Update caller.

* subversion/tests/cmdline/copy_tests.py
  (changed_dir_data_should_match_checkout): Remove XFail marker.

* subversion/tests/libsvn_wc/op-depth-test.c
  (wc_commit): Update caller.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/libsvn_client/deprecated.c
    subversion/trunk/subversion/svn/commit-cmd.c
    subversion/trunk/subversion/tests/cmdline/copy_tests.py
    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=1099429&r1=1099428&r2=1099429&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Wed May  4 
12:30:56 2011
@@ -375,7 +375,7 @@ void SVNClient::commit(Targets &targets,
         return;
 
     SVN_JNI_ERR(svn_client_commit5(targets2, depth,
-                                   noUnlock, keepChangelist,
+                                   noUnlock, keepChangelist, TRUE,
                                    changelists.array(requestPool),
                                    revprops.hash(requestPool),
                                    CommitCallback::callback, callback,

Modified: subversion/trunk/subversion/include/svn_client.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1099429&r1=1099428&r2=1099429&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Wed May  4 12:30:56 2011
@@ -1932,7 +1932,15 @@ svn_client_import(svn_client_commit_info
  * keep_changelists is set.  If @a changelists is
  * empty (or altogether @c NULL), no changelist filtering occurs.
  *
- * Use @a pool for any temporary allocations.
+ * If @a commit_as_operations is set to FALSE, when a copy is committed
+ * all changes below the copy are always committed at the same time
+ * (independent of the value of @a depth). If @a commit_as_operations is
+ * #TRUE, changes to descendants are only committed if they are itself
+ * included via @a depth and targets.
+ *
+ * When @a commit_as_operations is #TRUE it is possible to delete a node and
+ * all its descendants by selecting just the root of the deletion. If it is
+ * set to #FALSE this will raise an error.
  *
  * If @a commit_callback is non-NULL, then for each successful commit, call
  * @a commit_callback with @a commit_baton and a #svn_commit_info_t for
@@ -1941,6 +1949,8 @@ svn_client_import(svn_client_commit_info
  * @note #svn_depth_unknown and #svn_depth_exclude must not be passed
  * for @a depth.
  *
+ * Use @a pool for any temporary allocations.
+ *
  * @since New in 1.7.
  */
 svn_error_t *
@@ -1948,6 +1958,7 @@ svn_client_commit5(const apr_array_heade
                    svn_depth_t depth,
                    svn_boolean_t keep_locks,
                    svn_boolean_t keep_changelists,
+                   svn_boolean_t commit_as_operations,
                    const apr_array_header_t *changelists,
                    const apr_hash_t *revprop_table,
                    svn_commit_callback2_t commit_callback,
@@ -1966,6 +1977,8 @@ svn_client_commit5(const apr_array_heade
  * #SVN_INVALID_REVNUM, then the commit was a no-op; nothing needed to
  * be committed.
  *
+ * Sets @ commit_as_operations to FALSE to match Subversion 1.6's behavior.
+ *
  * @since New in 1.5.
  * @deprecated Provided for backward compatibility with the 1.6 API.
  */

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1099429&r1=1099428&r2=1099429&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Wed May  4 12:30:56 2011
@@ -918,16 +918,15 @@ post_process_commit_item(svn_wc_committe
                          svn_wc_context_t *wc_ctx,
                          svn_boolean_t keep_changelists,
                          svn_boolean_t keep_locks,
+                         svn_boolean_t commit_as_operations,
                          const svn_checksum_t *sha1_checksum,
                          apr_pool_t *scratch_pool)
 {
   svn_boolean_t loop_recurse = FALSE;
   svn_boolean_t remove_lock;
 
-  /* The following condition can be disabled (keeping loop_recurse FALSE), when
-     the SVN_WC__EXPERIMENTAL_DESCENDANT_COMMIT flag in libsvn_wc/wc.db is
-     enabled */
-  if ((item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)
+  if (! commit_as_operations
+      && (item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)
       && (item->kind == svn_node_dir)
       && (item->copyfrom_url))
     loop_recurse = TRUE;
@@ -1168,6 +1167,7 @@ svn_client_commit5(const apr_array_heade
                    svn_depth_t depth,
                    svn_boolean_t keep_locks,
                    svn_boolean_t keep_changelists,
+                   svn_boolean_t commit_as_operations,
                    const apr_array_header_t *changelists,
                    const apr_hash_t *revprop_table,
                    svn_commit_callback2_t commit_callback,
@@ -1257,14 +1257,8 @@ svn_client_commit5(const apr_array_heade
                                                   pool);
 
   /* If a non-recursive commit is desired, do not allow a deleted directory 
-     as one of the targets.
-
-     ### Why? With WC-NG there is no technical reason to deny this and the
-     ### caller explicitly send us the target?
-     ###
-     ### GJS: see my comment in check_nonrecursive_dir_delete(). I think
-     ###      there may be some confusion around the DEPTH param.  */
-  if (depth != svn_depth_infinity)
+     as one of the targets. */
+  if (depth != svn_depth_infinity && ! commit_as_operations)
     for (i = 0; i < rel_targets->nelts; i++)
       {
         const char *relpath = APR_ARRAY_IDX(rel_targets, i, const char *);
@@ -1305,6 +1299,8 @@ svn_client_commit5(const apr_array_heade
                                                     ctx,
                                                     pool,
                                                     iterpool));
+
+    svn_pool_clear(iterpool);
   }
 
   if (cmt_err)
@@ -1427,7 +1423,7 @@ svn_client_commit5(const apr_array_heade
           svn_pool_clear(iterpool);
           bump_err = post_process_commit_item(
                        queue, item, ctx->wc_ctx,
-                       keep_changelists, keep_locks,
+                       keep_changelists, keep_locks, commit_as_operations,
                        apr_hash_get(sha1_checksums,
                                     item->path,
                                     APR_HASH_KEY_STRING),

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1099429&r1=1099428&r2=1099429&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Wed May  4 12:30:56 
2011
@@ -494,7 +494,7 @@ svn_client_commit4(svn_commit_info_t **c
       ctx->notify_baton2 = &notify_baton;
     }
 
-  err = svn_client_commit5(targets, depth, keep_locks, keep_changelists,
+  err = svn_client_commit5(targets, depth, keep_locks, keep_changelists, FALSE,
                            changelists, revprop_table,
                            capture_commit_info, &cb, ctx, pool);
 

Modified: subversion/trunk/subversion/svn/commit-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/commit-cmd.c?rev=1099429&r1=1099428&r2=1099429&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/commit-cmd.c (original)
+++ subversion/trunk/subversion/svn/commit-cmd.c Wed May  4 12:30:56 2011
@@ -184,6 +184,7 @@ svn_cl__commit(apr_getopt_t *os,
                            opt_state->depth,
                            no_unlock,
                            opt_state->keep_changelists,
+                           TRUE /* commit_as_operations */,
                            opt_state->changelists,
                            opt_state->revprop_table,
                            ! opt_state->quiet

Modified: subversion/trunk/subversion/tests/cmdline/copy_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/copy_tests.py?rev=1099429&r1=1099428&r2=1099429&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/copy_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/copy_tests.py Wed May  4 12:30:56 
2011
@@ -4624,7 +4624,6 @@ def changed_data_should_match_checkout(s
   os.chdir(was_cwd)
 
 # Regression test for issue #3676 for copies including directories
-@XFail()
 @Issue(3676)
 def changed_dir_data_should_match_checkout(sbox):
   """changed dir after commit should match checkout"""

Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1099429&r1=1099428&r2=1099429&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Wed May  4 
12:30:56 2011
@@ -201,7 +201,7 @@ wc_commit(svn_test__sandbox_t *b, const 
   APR_ARRAY_PUSH(targets, const char *) = wc_path(b, path);
   SVN_ERR(svn_client_create_context(&ctx, b->pool));
   return svn_client_commit5(targets, svn_depth_infinity,
-                            FALSE, FALSE, /* keep locks/cl's */
+                            FALSE, FALSE, TRUE, /* keep locks/cl's/use_ops*/
                             NULL, NULL, NULL, NULL, ctx, b->pool);
 }
 


Reply via email to