subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1446794 - in /subversion/trunk/subversion/svn: cl.h conflict-callbacks.c merge-cmd.c notify.c patch-cmd.c switch-cmd.c update-cmd.c
Date Fri, 15 Feb 2013 22:39:45 GMT
Author: julianfoad
Date: Fri Feb 15 22:39:45 2013
New Revision: 1446794

URL: http://svn.apache.org/r1446794
Log:
Let svn_cl__resolve_postponed_conflicts() tell the caller whether it
resolved all the conflicts.  We don't use that yet, but we will soon.  And
some other small tweaks the 'svn' conflict notification code.

* subversion/svn/cl.h,
  (svn_cl__resolve_postponed_conflicts): Return a flag indicating whether
    all conflicts were resolved.
  (svn_cl__notifier_reset_conflict_stats): New function.
  (svn_cl__print_conflict_stats): Rename to
    svn_cl__notifier_print_conflict_stats() and s/pool/scratch_pool/ and
    s/notify_baton/baton/ (the last being a follow-up to r1446746.

* subversion/svn/conflict-callbacks.c
  (get_postponed_conflicted_paths): Simplify: remove a special-case return.
  (svn_cl__resolve_postponed_conflicts): Implement the extra parameter, and
    remove the special-case return.

* subversion/svn/notify.c
  (svn_cl__notifier_reset_conflict_stats): New function.
  (svn_cl__print_conflict_stats): Rename to
    svn_cl__notifier_print_conflict_stats() and s/pool/scratch_pool/.

* subversion/svn/merge-cmd.c
  (svn_cl__merge): Update calls to svn_cl__print_conflict_stats().

* subversion/svn/patch-cmd.c
  (svn_cl__patch): Same.

* subversion/svn/switch-cmd.c
  (svn_cl__switch): Same.

* subversion/svn/update-cmd.c
  (svn_cl__update): Same.

Modified:
    subversion/trunk/subversion/svn/cl.h
    subversion/trunk/subversion/svn/conflict-callbacks.c
    subversion/trunk/subversion/svn/merge-cmd.c
    subversion/trunk/subversion/svn/notify.c
    subversion/trunk/subversion/svn/patch-cmd.c
    subversion/trunk/subversion/svn/switch-cmd.c
    subversion/trunk/subversion/svn/update-cmd.c

Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1446794&r1=1446793&r2=1446794&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Fri Feb 15 22:39:45 2013
@@ -374,14 +374,20 @@ svn_cl__conflict_func_postpone(svn_wc_co
                                apr_pool_t *result_pool,
                                apr_pool_t *scratch_pool);
 
-/* Perform conflict resolver on any conflicted paths stored in the BATON
+/* Perform conflict resolution on any conflicted paths stored in the BATON
  * which was obtained from svn_cl__get_conflict_func_postpone_baton().
  *
+ * If CONFLICTS_ALL_RESOLVED is not null, set *CONFLICTS_ALL_RESOLVED to
+ * true if this resolves all the conflicts on the paths that were
+ * recorded (or if none were recorded); or to false if some conflicts
+ * remain.
+ *
  * The conflict resolution will be interactive if ACCEPT_WHICH is
  * svn_cl__accept_unspecified.
  */
 svn_error_t *
-svn_cl__resolve_postponed_conflicts(void *baton,
+svn_cl__resolve_postponed_conflicts(svn_boolean_t *conflicts_all_resolved,
+                                    void *baton,
                                     svn_cl__accept_t accept_which,
                                     const char *editor_cmd,
                                     svn_client_ctx_t *ctx,
@@ -577,13 +583,20 @@ svn_cl__check_externals_failed_notify_wr
                                               const svn_wc_notify_t *n,
                                               apr_pool_t *pool);
 
-/* Print conflict stats accumulated in NOTIFY_BATON.
+/* Reset to zero the conflict stats accumulated in BATON, which is the
+ * notifier baton from svn_cl__get_notifier().
+ */
+svn_error_t *
+svn_cl__notifier_reset_conflict_stats(void *baton);
+
+/* Print the conflict stats accumulated in BATON, which is the
+ * notifier baton from svn_cl__get_notifier().
  * Return any error encountered during printing.
- * Do all allocations in POOL.*/
+ */
 svn_error_t *
-svn_cl__print_conflict_stats(void *notify_baton, apr_pool_t *pool);
+svn_cl__notifier_print_conflict_stats(void *baton, apr_pool_t *scratch_pool);
+
 
-
 /*** Log message callback stuffs. ***/
 
 /* Allocate in POOL a baton for use with svn_cl__get_log_message().

Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1446794&r1=1446793&r2=1446794&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Fri Feb 15 22:39:45 2013
@@ -1137,9 +1137,6 @@ get_postponed_conflicted_paths(void *bat
   apr_array_header_t *result_array;
   int i;
 
-  if (apr_hash_count(conflicted_paths) == 0)
-    return NULL;
-
   sorted_array = svn_sort__hash(conflicted_paths,
                                 svn_sort_compare_items_as_paths,
                                 apr_hash_pool_get(conflicted_paths));
@@ -1158,7 +1155,8 @@ get_postponed_conflicted_paths(void *bat
 }
 
 svn_error_t *
-svn_cl__resolve_postponed_conflicts(void *baton,
+svn_cl__resolve_postponed_conflicts(svn_boolean_t *conflicts_all_resolved,
+                                    void *baton,
                                     svn_cl__accept_t accept_which,
                                     const char *editor_cmd,
                                     svn_client_ctx_t *ctx,
@@ -1169,8 +1167,9 @@ svn_cl__resolve_postponed_conflicts(void
   apr_pool_t *iterpool;
 
   targets = get_postponed_conflicted_paths(baton, scratch_pool);
-  if (targets == NULL)
-    return SVN_NO_ERROR;
+
+  if (conflicts_all_resolved != NULL)
+    *conflicts_all_resolved = TRUE;
 
   iterpool = svn_pool_create(scratch_pool);
   for (i = 0; i < targets->nelts; i++)
@@ -1181,6 +1180,7 @@ svn_cl__resolve_postponed_conflicts(void
       svn_wc_conflict_resolver_func2_t conflict_func2;
       void *conflict_baton2;
       svn_cl__interactive_conflict_baton_t *b;
+      svn_boolean_t text_c, prop_c, tree_c;
 
       svn_pool_clear(iterpool);
 
@@ -1216,6 +1216,16 @@ svn_cl__resolve_postponed_conflicts(void
 
           svn_error_clear(err);
         }
+
+      /* Report if we left any of the conflicts unresolved */
+      if (conflicts_all_resolved != NULL)
+        {
+          SVN_ERR(svn_wc_conflicted_p3(&text_c, &prop_c, &tree_c,
+                                       ctx->wc_ctx, local_abspath,
+                                       scratch_pool));
+          if (text_c || prop_c || tree_c)
+            *conflicts_all_resolved = FALSE;
+        }
     }
   svn_pool_destroy(iterpool);
 

Modified: subversion/trunk/subversion/svn/merge-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/merge-cmd.c?rev=1446794&r1=1446793&r2=1446794&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/merge-cmd.c (original)
+++ subversion/trunk/subversion/svn/merge-cmd.c Fri Feb 15 22:39:45 2013
@@ -586,12 +586,14 @@ svn_cl__merge(apr_getopt_t *os,
       svn_error_t *err = SVN_NO_ERROR;
 
       if (! opt_state->quiet)
-        err = svn_cl__print_conflict_stats(ctx->notify_baton2, pool);
+        err = svn_cl__notifier_print_conflict_stats(ctx->notify_baton2,
+                                                        pool);
 
       /* Resolve any postponed conflicts.  (Only if we've been using the
        * default 'postpone' resolver which remembers what was postponed.) */
       if (!err && ctx->conflict_func2 == svn_cl__conflict_func_postpone)
-        err = svn_cl__resolve_postponed_conflicts(ctx->conflict_baton2,
+        err = svn_cl__resolve_postponed_conflicts(NULL,
+                                                  ctx->conflict_baton2,
                                                   opt_state->accept_which,
                                                   opt_state->editor_cmd,
                                                   ctx, pool);

Modified: subversion/trunk/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=1446794&r1=1446793&r2=1446794&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Fri Feb 15 22:39:45 2013
@@ -65,29 +65,43 @@ struct notify_baton
 
 
 svn_error_t *
-svn_cl__print_conflict_stats(void *baton, apr_pool_t *pool)
+svn_cl__notifier_reset_conflict_stats(void *baton)
+{
+  struct notify_baton *nb = baton;
+
+  nb->text_conflicts = 0;
+  nb->prop_conflicts = 0;
+  nb->tree_conflicts = 0;
+  nb->skipped_paths = 0;
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_cl__notifier_print_conflict_stats(void *baton, apr_pool_t *scratch_pool)
 {
   struct notify_baton *nb = baton;
 
   if (nb->text_conflicts > 0 || nb->prop_conflicts > 0
       || nb->tree_conflicts > 0 || nb->skipped_paths > 0)
-      SVN_ERR(svn_cmdline_printf(pool, "%s", _("Summary of conflicts:\n")));
+    SVN_ERR(svn_cmdline_printf(scratch_pool,
+                               _("Summary of conflicts:\n")));
 
   if (nb->text_conflicts > 0)
-    SVN_ERR(svn_cmdline_printf(
-              pool, _("  Text conflicts: %d\n"), nb->text_conflicts));
-
+    SVN_ERR(svn_cmdline_printf(scratch_pool,
+                               _("  Text conflicts: %d\n"),
+                               nb->text_conflicts));
   if (nb->prop_conflicts > 0)
-    SVN_ERR(svn_cmdline_printf(
-              pool, _("  Property conflicts: %d\n"), nb->prop_conflicts));
-
+    SVN_ERR(svn_cmdline_printf(scratch_pool,
+                               _("  Property conflicts: %d\n"),
+                               nb->prop_conflicts));
   if (nb->tree_conflicts > 0)
-    SVN_ERR(svn_cmdline_printf(
-              pool, _("  Tree conflicts: %d\n"), nb->tree_conflicts));
-
+    SVN_ERR(svn_cmdline_printf(scratch_pool,
+                               _("  Tree conflicts: %d\n"),
+                               nb->tree_conflicts));
   if (nb->skipped_paths > 0)
-    SVN_ERR(svn_cmdline_printf(
-              pool, _("  Skipped paths: %d\n"), nb->skipped_paths));
+    SVN_ERR(svn_cmdline_printf(scratch_pool,
+                               _("  Skipped paths: %d\n"),
+                               nb->skipped_paths));
 
   return SVN_NO_ERROR;
 }
@@ -988,7 +1002,8 @@ notify(void *baton, const svn_wc_notify_
 
     case svn_wc_notify_conflict_resolver_starting:
       /* Once all operations invoke the interactive conflict resolution after
-       * they've completed, we can run svn_cl__print_conflict_stats() here. */
+       * they've completed, we can run svn_cl__notifier_print_conflict_stats()
+       * here. */
       break;
 
     case svn_wc_notify_conflict_resolver_done:

Modified: subversion/trunk/subversion/svn/patch-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/patch-cmd.c?rev=1446794&r1=1446793&r2=1446794&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/patch-cmd.c (original)
+++ subversion/trunk/subversion/svn/patch-cmd.c Fri Feb 15 22:39:45 2013
@@ -92,7 +92,7 @@ svn_cl__patch(apr_getopt_t *os,
 
 
   if (! opt_state->quiet)
-    SVN_ERR(svn_cl__print_conflict_stats(ctx->notify_baton2, pool));
+    SVN_ERR(svn_cl__notifier_print_conflict_stats(ctx->notify_baton2, pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/svn/switch-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/switch-cmd.c?rev=1446794&r1=1446793&r2=1446794&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/switch-cmd.c (original)
+++ subversion/trunk/subversion/svn/switch-cmd.c Fri Feb 15 22:39:45 2013
@@ -193,12 +193,13 @@ svn_cl__switch(apr_getopt_t *os,
 
   if (! opt_state->quiet)
     {
-      err = svn_cl__print_conflict_stats(nwb.wrapped_baton, scratch_pool);
+      err = svn_cl__notifier_print_conflict_stats(nwb.wrapped_baton, scratch_pool);
       if (err)
         return svn_error_compose_create(externals_err, err);
     }
 
-  err = svn_cl__resolve_postponed_conflicts(ctx->conflict_baton2,
+  err = svn_cl__resolve_postponed_conflicts(NULL,
+                                            ctx->conflict_baton2,
                                             opt_state->accept_which,
                                             opt_state->editor_cmd,
                                             ctx, scratch_pool);

Modified: subversion/trunk/subversion/svn/update-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/update-cmd.c?rev=1446794&r1=1446793&r2=1446794&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/update-cmd.c (original)
+++ subversion/trunk/subversion/svn/update-cmd.c Fri Feb 15 22:39:45 2013
@@ -189,12 +189,14 @@ svn_cl__update(apr_getopt_t *os,
       /* ### Layering problem: This call assumes that the baton we're
        * passing is the one that was originally provided by
        * svn_cl__get_notifier(), but that isn't promised. */
-      err = svn_cl__print_conflict_stats(nwb.wrapped_baton, scratch_pool);
+      err = svn_cl__notifier_print_conflict_stats(nwb.wrapped_baton,
+                                                  scratch_pool);
       if (err)
         return svn_error_compose_create(externals_err, err);
     }
 
-  err = svn_cl__resolve_postponed_conflicts(ctx->conflict_baton2,
+  err = svn_cl__resolve_postponed_conflicts(NULL,
+                                            ctx->conflict_baton2,
                                             opt_state->accept_which,
                                             opt_state->editor_cmd,
                                             ctx, scratch_pool);



Mime
View raw message