Author: rhuijben
Date: Tue Apr 12 14:52:44 2011
New Revision: 1091438

URL: http://svn.apache.org/viewvc?rev=1091438&view=rev
Log:
Following up on r1091187, make the adds_as_modification switch available
to users of the libsvn_client api (like AnkhSVN, where I want to use this
switch to make our users explicitly handle this case).

At the same time remove it from the switch editor, as the boolean didn't do
anything there because a switch already turned this option off.

* subversion/bindings/javahl/native/SVNClient.cpp
  (SVNClient::update): Update caller.

* subversion/include/svn_client.h
  (svn_client_update4): Add argument.
  (svn_client_update3): Update comment.

* subversion/include/svn_wc.h
  (svn_wc_get_switch_editor4): Remove argument.
  (svn_wc_get_switch_editor3): Update comment.

* subversion/libsvn_client/checkout.c
  (svn_client__checkout_internal): Update caller.

* subversion/libsvn_client/client.h
  (svn_client__update_internal): Add argument.

* subversion/libsvn_client/deprecated.c
  (svn_client_update3): Update caller.

* subversion/libsvn_client/externals.c
  (switch_dir_external): Update caller.

* subversion/libsvn_client/switch.c
  (switch_internal): Update caller.

* subversion/libsvn_client/update.c
  (update_internal,
   svn_client__update_internal): Pass argument.
   svn_client_update4): Pass argument. Resolve error leak and only sleep
     if needed.

* subversion/libsvn_wc/deprecated.c
  (svn_wc_get_switch_editor3): Update caller.

* subversion/libsvn_wc/update_editor.c
  (add_directory, add_file): Simplify check.
  (svn_wc_get_switch_editor4): Remove argument and pass FALSE for
    adds_as_modification.

* subversion/svn/update-cmd.c
  (svn_cl__update): Update caller; keep current behavior.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/checkout.c
    subversion/trunk/subversion/libsvn_client/client.h
    subversion/trunk/subversion/libsvn_client/deprecated.c
    subversion/trunk/subversion/libsvn_client/externals.c
    subversion/trunk/subversion/libsvn_client/switch.c
    subversion/trunk/subversion/libsvn_client/update.c
    subversion/trunk/subversion/libsvn_wc/deprecated.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/svn/update-cmd.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=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Tue Apr 12 
14:52:44 2011
@@ -340,6 +340,7 @@ jlongArray SVNClient::update(Targets &ta
                                    depthIsSticky,
                                    ignoreExternals,
                                    allowUnverObstructions,
+                                   TRUE /* adds_as_modification */,
                                    makeParents,
                                    ctx, requestPool.pool()),
                 NULL);

Modified: subversion/trunk/subversion/include/svn_client.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Tue Apr 12 14:52:44 2011
@@ -1193,6 +1193,10 @@ svn_client_checkout(svn_revnum_t *result
  * If @a allow_unver_obstructions is FALSE then the update will abort
  * if there are any unversioned obstructing items.
  *
+ * If @a adds_as_modifications is TRUE, local additions that obstruct
+ * added files are handled as a modified version of the file instead of
+ * as a tree conflict.
+ *
  * If @a make_parents is TRUE, create any non-existent parent
  * directories also by checking them out at depth=empty.
  *
@@ -1224,13 +1228,14 @@ svn_client_update4(apr_array_header_t **
                    svn_boolean_t depth_is_sticky,
                    svn_boolean_t ignore_externals,
                    svn_boolean_t allow_unver_obstructions,
+                   svn_boolean_t adds_as_modification,
                    svn_boolean_t make_parents,
                    svn_client_ctx_t *ctx,
                    apr_pool_t *pool);
 
 /**
  * Similar to svn_client_update4() but with @a make_parents always set
- * to FALSE.
+ * to FALSE and @a adds_as_modification set to TRUE.
  *
  * @deprecated Provided for backward compatibility with the 1.6 API.
  * @since New in 1.5.

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Apr 12 14:52:44 2011
@@ -5467,7 +5467,6 @@ svn_wc_get_switch_editor4(const svn_delt
                           svn_depth_t depth,
                           svn_boolean_t depth_is_sticky,
                           svn_boolean_t allow_unver_obstructions,
-                          svn_boolean_t adds_as_modification,
                           svn_boolean_t server_performs_filtering,
                           const char *diff3_cmd,
                           const apr_array_header_t *preserved_exts,
@@ -5492,8 +5491,7 @@ svn_wc_get_switch_editor4(const svn_delt
  * All locks, both those in @a anchor and newly acquired ones, will be
  * released when the editor driver calls @c close_edit.
  *
- * Always sets @a adds_as_modification to TRUE and @a server_performs_filtering
- * to FALSE.
+ * Always sets @a server_performs_filtering to FALSE.
  *
  * @since New in 1.5.
  * @deprecated Provided for backward compatibility with the 1.6 API.

Modified: subversion/trunk/subversion/libsvn_client/checkout.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/checkout.c?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/checkout.c (original)
+++ subversion/trunk/subversion/libsvn_client/checkout.c Tue Apr 12 14:52:44 
2011
@@ -217,6 +217,7 @@ svn_client__checkout_internal(svn_revnum
                                         revision, depth, TRUE,
                                         ignore_externals,
                                         allow_unver_obstructions,
+                                        TRUE /* adds_as_modification */,
                                         use_sleep, innercheckout, FALSE,
                                         ctx, pool);
     }

Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Tue Apr 12 14:52:44 2011
@@ -473,6 +473,9 @@ svn_client__make_local_parents(const cha
    that obstruct items added from the repos are tolerated; if FALSE,
    these obstructions cause the update to fail.
 
+   If ADDS_AS_MODIFICATION is TRUE, local additions are handled as
+   modifications on added nodes.
+
    If INNERUPDATE is true, no anchor check is performed on the update target.
 
    If MAKE_PARENTS is true, allow the update to calculate and checkout
@@ -489,6 +492,7 @@ svn_client__update_internal(svn_revnum_t
                             svn_boolean_t depth_is_sticky,
                             svn_boolean_t ignore_externals,
                             svn_boolean_t allow_unver_obstructions,
+                            svn_boolean_t adds_as_modification,
                             svn_boolean_t *timestamp_sleep,
                             svn_boolean_t innerupdate,
                             svn_boolean_t make_parents,

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Tue Apr 12 14:52:44 
2011
@@ -1865,7 +1865,7 @@ svn_client_update3(apr_array_header_t **
 {
   return svn_client_update4(result_revs, paths, revision,
                             depth, depth_is_sticky, ignore_externals,
-                            allow_unver_obstructions, FALSE, ctx, pool);
+                            allow_unver_obstructions, TRUE, FALSE, ctx, pool);
 }
 
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Tue Apr 12 14:52:44 
2011
@@ -204,7 +204,7 @@ switch_dir_external(const char *path,
             {
               SVN_ERR(svn_client__update_internal(NULL, local_abspath,
                                                   revision, svn_depth_unknown,
-                                                  FALSE, FALSE, FALSE,
+                                                  FALSE, FALSE, FALSE, TRUE,
                                                   timestamp_sleep, TRUE, FALSE,
                                                   ctx, subpool));
               svn_pool_destroy(subpool);

Modified: subversion/trunk/subversion/libsvn_client/switch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/switch.c?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/switch.c (original)
+++ subversion/trunk/subversion/libsvn_client/switch.c Tue Apr 12 14:52:44 2011
@@ -218,7 +218,6 @@ switch_internal(svn_revnum_t *result_rev
                                     target, switch_rev_url, use_commit_times,
                                     depth,
                                     depth_is_sticky, allow_unver_obstructions,
-                                    TRUE,
                                     server_supports_depth
                                         && (depth == svn_depth_unknown),
                                     diff3_cmd, preserved_exts,

Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Tue Apr 12 14:52:44 2011
@@ -65,6 +65,7 @@ update_internal(svn_revnum_t *result_rev
                 svn_boolean_t depth_is_sticky,
                 svn_boolean_t ignore_externals,
                 svn_boolean_t allow_unver_obstructions,
+                svn_boolean_t adds_as_modification,
                 svn_boolean_t *timestamp_sleep,
                 svn_boolean_t innerupdate,
                 svn_boolean_t notify_summary,
@@ -233,7 +234,7 @@ update_internal(svn_revnum_t *result_rev
                                     &revnum, ctx->wc_ctx, anchor_abspath,
                                     target, use_commit_times, depth,
                                     depth_is_sticky, allow_unver_obstructions,
-                                    TRUE,
+                                    adds_as_modification,
                                     server_supports_depth
                                         && (depth == svn_depth_unknown),
                                     diff3_cmd, preserved_exts,
@@ -322,6 +323,7 @@ svn_client__update_internal(svn_revnum_t
                             svn_boolean_t depth_is_sticky,
                             svn_boolean_t ignore_externals,
                             svn_boolean_t allow_unver_obstructions,
+                            svn_boolean_t adds_as_modification,
                             svn_boolean_t *timestamp_sleep,
                             svn_boolean_t innerupdate,
                             svn_boolean_t make_parents,
@@ -374,8 +376,8 @@ svn_client__update_internal(svn_revnum_t
           err = update_internal(result_rev, missing_parent, anchor_abspath,
                                 &peg_revision, svn_depth_empty, FALSE,
                                 ignore_externals, allow_unver_obstructions,
-                                timestamp_sleep, innerupdate, FALSE,
-                                ctx, pool);
+                                adds_as_modification, timestamp_sleep,
+                                innerupdate, FALSE, ctx, pool);
           if (err)
             goto cleanup;
           anchor_abspath = missing_parent;
@@ -398,6 +400,7 @@ svn_client__update_internal(svn_revnum_t
   err = update_internal(result_rev, local_abspath, anchor_abspath,
                         &peg_revision, depth, depth_is_sticky,
                         ignore_externals, allow_unver_obstructions,
+                        adds_as_modification,
                         timestamp_sleep, innerupdate, TRUE, ctx, pool);
  cleanup:
   err = svn_error_compose_create(
@@ -416,6 +419,7 @@ svn_client_update4(apr_array_header_t **
                    svn_boolean_t depth_is_sticky,
                    svn_boolean_t ignore_externals,
                    svn_boolean_t allow_unver_obstructions,
+                   svn_boolean_t adds_as_modification,
                    svn_boolean_t make_parents,
                    svn_client_ctx_t *ctx,
                    apr_pool_t *pool)
@@ -423,6 +427,7 @@ svn_client_update4(apr_array_header_t **
   int i;
   apr_pool_t *subpool = svn_pool_create(pool);
   const char *path = NULL;
+  svn_boolean_t sleep = FALSE;
 
   if (result_revs)
     *result_revs = apr_array_make(pool, paths->nelts, sizeof(svn_revnum_t));
@@ -438,7 +443,6 @@ svn_client_update4(apr_array_header_t **
 
   for (i = 0; i < paths->nelts; ++i)
     {
-      svn_boolean_t sleep;
       svn_error_t *err = SVN_NO_ERROR;
       svn_revnum_t result_rev;
       const char *local_abspath;
@@ -446,26 +450,27 @@ svn_client_update4(apr_array_header_t **
 
       svn_pool_clear(subpool);
 
-      if (ctx->cancel_func && (err = ctx->cancel_func(ctx->cancel_baton)))
-        break;
+      if (ctx->cancel_func)
+        SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
 
       SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, subpool));
       err = svn_client__update_internal(&result_rev, local_abspath,
                                         revision, depth, depth_is_sticky,
                                         ignore_externals,
                                         allow_unver_obstructions,
+                                        adds_as_modification,
                                         &sleep, FALSE, make_parents,
                                         ctx, subpool);
 
-      if (err && err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
-        {
-          return svn_error_return(err);
-        }
-
       if (err)
         {
-          /* SVN_ERR_WC_NOT_WORKING_COPY: it's not versioned */
+          if(err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
+            return svn_error_return(err);
+
           svn_error_clear(err);
+
+          /* SVN_ERR_WC_NOT_WORKING_COPY: it's not versioned */
+          
           result_rev = SVN_INVALID_REVNUM;
           if (ctx->notify_func2)
             {
@@ -481,7 +486,8 @@ svn_client_update4(apr_array_header_t **
     }
 
   svn_pool_destroy(subpool);
-  svn_io_sleep_for_timestamps((paths->nelts == 1) ? path : NULL, pool);
+  if (sleep)
+    svn_io_sleep_for_timestamps((paths->nelts == 1) ? path : NULL, pool);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Tue Apr 12 14:52:44 2011
@@ -3068,7 +3068,6 @@ svn_wc_get_switch_editor3(svn_revnum_t *
                                     use_commit_times,
                                     depth, depth_is_sticky,
                                     allow_unver_obstructions,
-                                    TRUE /* adds_as_modification */,
                                     FALSE /* server_performs_filtering */,
                                     diff3_cmd,
                                     preserved_exts,

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue Apr 12 14:52:44 
2011
@@ -2172,10 +2172,9 @@ add_directory(const char *path,
        * During switch, local adds at the same path as incoming adds get
        * "lost" in that switching back to the original will no longer have the
        * local add. So switch always alerts the user with a tree conflict. */
-      if (eb->switch_relpath != NULL
+      if (!eb->adds_as_modification
           || local_is_non_dir
-          || add_status != svn_wc__db_status_added
-          || !eb->adds_as_modification)
+          || add_status != svn_wc__db_status_added)
         {
           SVN_ERR(check_tree_conflict(&tree_conflict, eb,
                                       db->local_abspath,
@@ -3026,10 +3025,9 @@ add_file(const char *path,
        * During switch, local adds at the same path as incoming adds get
        * "lost" in that switching back to the original will no longer have the
        * local add. So switch always alerts the user with a tree conflict. */
-      if (eb->switch_relpath != NULL
+      if (!eb->adds_as_modification
           || !local_is_file
-          || status != svn_wc__db_status_added
-          || !eb->adds_as_modification)
+          || status != svn_wc__db_status_added)
         {
           SVN_ERR(check_tree_conflict(&tree_conflict, eb,
                                       fb->local_abspath,
@@ -4451,7 +4449,6 @@ svn_wc_get_switch_editor4(const svn_delt
                           svn_depth_t depth,
                           svn_boolean_t depth_is_sticky,
                           svn_boolean_t allow_unver_obstructions,
-                          svn_boolean_t adds_as_modification,
                           svn_boolean_t server_performs_filtering,
                           const char *diff3_cmd,
                           const apr_array_header_t *preserved_exts,
@@ -4472,7 +4469,8 @@ svn_wc_get_switch_editor4(const svn_delt
                      target_basename, use_commit_times,
                      switch_url,
                      depth, depth_is_sticky, allow_unver_obstructions,
-                     adds_as_modification, server_performs_filtering,
+                     FALSE /* adds_as_modification */,
+                     server_performs_filtering,
                      notify_func, notify_baton,
                      cancel_func, cancel_baton,
                      conflict_func, conflict_baton,

Modified: subversion/trunk/subversion/svn/update-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/update-cmd.c?rev=1091438&r1=1091437&r2=1091438&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/update-cmd.c (original)
+++ subversion/trunk/subversion/svn/update-cmd.c Tue Apr 12 14:52:44 2011
@@ -166,7 +166,8 @@ svn_cl__update(apr_getopt_t *os,
                              &(opt_state->start_revision),
                              depth, depth_is_sticky,
                              opt_state->ignore_externals,
-                             opt_state->force, opt_state->parents,
+                             opt_state->force, TRUE /* adds_as_modification */,
+                             opt_state->parents,
                              ctx, scratch_pool));
 
   if (! opt_state->quiet)


Reply via email to