subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1353734 - in /subversion/trunk/subversion/libsvn_client: checkout.c client.h externals.c update.c
Date Mon, 25 Jun 2012 20:39:34 GMT
Author: stsp
Date: Mon Jun 25 20:39:33 2012
New Revision: 1353734

URL: http://svn.apache.org/viewvc?rev=1353734&view=rev
Log:
To force postponing of conflict resolution during update, we were setting
the caller-provided conflict callback pointers in the client context to NULL.
This approach is bad because the library isn't supposed to fiddle with the
client context passed in. Not to mention we failed to restore the context
upon return...

Instead, add separate conflict callback parameters to update_internal(),
which allows us to pass NULL for those parameters if conflict resolution is
to be postponed during updates.

Suggested by: gstein

* subversion/libsvn_client/client.h
  (svn_client__update_internal): Declare CONFLICT_FUNC2 and CONFLICT_BATON2
   parameters.

* subversion/libsvn_client/update.c
  (svn_client__update_internal, update_internal): Add CONFLICT_FUNC2 and
   CONFLICT_BATON2 parameters. Invoke the callback provided via parameters
   during update, instead of invoking callbacks provided in the client context.
  (svn_client_update4): As before, for 1.7 and above API users, do not invoke
   the conflict resolution callback during the update operation but invoke it
   during a separate conflict resolution step instead. Stop changing fields in
   the caller-provided client context.

* subversion/libsvn_client/checkout.c
  (svn_client__checkout_internal): Adjust svn_client__update_internal() caller,
   passing the conflict callbacks from the context itself (i.e. no behaviour
   change here).

Modified:
    subversion/trunk/subversion/libsvn_client/checkout.c
    subversion/trunk/subversion/libsvn_client/client.h
    subversion/trunk/subversion/libsvn_client/externals.c
    subversion/trunk/subversion/libsvn_client/update.c

Modified: subversion/trunk/subversion/libsvn_client/checkout.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/checkout.c?rev=1353734&r1=1353733&r2=1353734&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/checkout.c (original)
+++ subversion/trunk/subversion/libsvn_client/checkout.c Mon Jun 25 20:39:33 2012
@@ -168,7 +168,10 @@ svn_client__checkout_internal(svn_revnum
                                         allow_unver_obstructions,
                                         TRUE /* adds_as_modification */,
                                         FALSE, FALSE,
-                                        use_sleep, ctx, pool);
+                                        use_sleep, ctx,
+                                        ctx->conflict_func2,
+                                        ctx->conflict_baton2,
+                                        pool);
     }
 
   if (err)

Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1353734&r1=1353733&r2=1353734&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Mon Jun 25 20:39:33 2012
@@ -461,6 +461,10 @@ svn_client__make_local_parents(const cha
    target which are missing from the working copy.
 
    NOTE:  You may not specify both INNERUPDATE and MAKE_PARENTS as true.
+
+   Use CONFLICT_FUNC2 and CONFLICT_BATON2 instead of CTX->CONFLICT_FUNC2
+   and CTX->CONFLICT_BATON2. If CONFLICT_FUNC2 is NULL, postpone all conflicts
+   allowing the caller to perform post-update conflict resolution.
 */
 svn_error_t *
 svn_client__update_internal(svn_revnum_t *result_rev,
@@ -475,6 +479,8 @@ svn_client__update_internal(svn_revnum_t
                             svn_boolean_t innerupdate,
                             svn_boolean_t *timestamp_sleep,
                             svn_client_ctx_t *ctx,
+                            svn_wc_conflict_resolver_func2_t conflict_func2,
+                            void *conflict_baton2,
                             apr_pool_t *pool);
 
 /* Checkout into LOCAL_ABSPATH a working copy of URL at REVISION, and (if not

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1353734&r1=1353733&r2=1353734&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Mon Jun 25 20:39:33 2012
@@ -169,7 +169,10 @@ switch_dir_external(const char *local_ab
                                                   FALSE, FALSE, FALSE, TRUE,
                                                   FALSE, TRUE,
                                                   timestamp_sleep,
-                                                  ctx, subpool));
+                                                  ctx,
+                                                  ctx->conflict_func2,
+                                                  ctx->conflict_baton2,
+                                                  subpool));
               svn_pool_destroy(subpool);
               goto cleanup;
             }

Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=1353734&r1=1353733&r2=1353734&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Mon Jun 25 20:39:33 2012
@@ -185,6 +185,8 @@ update_internal(svn_revnum_t *result_rev
                 svn_boolean_t *timestamp_sleep,
                 svn_boolean_t notify_summary,
                 svn_client_ctx_t *ctx,
+                svn_wc_conflict_resolver_func2_t conflict_func2,
+                void *conflict_baton2,
                 apr_pool_t *pool)
 {
   const svn_delta_editor_t *update_editor;
@@ -374,7 +376,7 @@ update_internal(svn_revnum_t *result_rev
                                     clean_checkout,
                                     diff3_cmd, preserved_exts,
                                     svn_client__dirent_fetcher, &dfb,
-                                    ctx->conflict_func2, ctx->conflict_baton2,
+                                    conflict_func2, conflict_baton2,
                                     NULL, NULL,
                                     ctx->cancel_func, ctx->cancel_baton,
                                     ctx->notify_func2, ctx->notify_baton2,
@@ -465,6 +467,8 @@ svn_client__update_internal(svn_revnum_t
                             svn_boolean_t innerupdate,
                             svn_boolean_t *timestamp_sleep,
                             svn_client_ctx_t *ctx,
+                            svn_wc_conflict_resolver_func2_t conflict_func2,
+                            void *conflict_baton2,
                             apr_pool_t *pool)
 {
   const char *anchor_abspath, *lockroot_abspath;
@@ -514,7 +518,8 @@ svn_client__update_internal(svn_revnum_t
                                 &peg_revision, svn_depth_empty, FALSE,
                                 ignore_externals, allow_unver_obstructions,
                                 adds_as_modification, timestamp_sleep,
-                                FALSE, ctx, pool);
+                                FALSE, ctx, conflict_func2, conflict_baton2,
+                                pool);
           if (err)
             goto cleanup;
           anchor_abspath = missing_parent;
@@ -538,7 +543,7 @@ svn_client__update_internal(svn_revnum_t
                         &peg_revision, depth, depth_is_sticky,
                         ignore_externals, allow_unver_obstructions,
                         adds_as_modification, timestamp_sleep,
-                        TRUE, ctx, pool);
+                        TRUE, ctx, conflict_func2, conflict_baton2, pool);
  cleanup:
   err = svn_error_compose_create(
             err,
@@ -567,8 +572,6 @@ svn_client_update4(apr_array_header_t **
   svn_boolean_t sleep = FALSE;
   /* Resolve conflicts post-update for 1.7 and above API users. */
   svn_boolean_t resolve_conflicts_post_update = (ctx->conflict_func2 != NULL);
-  svn_wc_conflict_resolver_func2_t conflict_func2;
-  void *conflict_baton2;
 
   if (result_revs)
     *result_revs = apr_array_make(pool, paths->nelts, sizeof(svn_revnum_t));
@@ -582,16 +585,6 @@ svn_client_update4(apr_array_header_t **
                                  _("'%s' is not a local path"), path);
     }
 
-  if (resolve_conflicts_post_update)
-    {
-      /* Remove the conflict resolution callback from the client context.
-       * We invoke it after of the update instead of during the update. */
-      conflict_func2 = ctx->conflict_func2;
-      conflict_baton2 = ctx->conflict_baton2;
-      ctx->conflict_func2 = NULL;
-      ctx->conflict_baton2 = NULL;
-    }
-
   for (i = 0; i < paths->nelts; ++i)
     {
       svn_error_t *err = SVN_NO_ERROR;
@@ -612,7 +605,9 @@ svn_client_update4(apr_array_header_t **
                                         adds_as_modification,
                                         make_parents,
                                         FALSE, &sleep,
-                                        ctx, iterpool);
+                                        ctx,
+                                        NULL, NULL, /* postpone conflicts */
+                                        iterpool);
 
       if (err)
         {
@@ -657,7 +652,8 @@ svn_client_update4(apr_array_header_t **
                                           "" /* resolve_prop (ALL props) */,
                                           TRUE /* resolve_tree */,
                                           svn_wc_conflict_choose_unspecified,
-                                          conflict_func2, conflict_baton2,
+                                          ctx->conflict_func2,
+                                          ctx->conflict_baton2,
                                           ctx->cancel_func, ctx->cancel_baton,
                                           ctx->notify_func2, ctx->notify_baton2,
                                           iterpool);



Mime
View raw message