You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/09/18 17:54:26 UTC

svn commit: r1703892 - in /subversion/trunk/subversion/svn: cl.h conflict-callbacks.c resolve-cmd.c svn.c

Author: stsp
Date: Fri Sep 18 15:54:26 2015
New Revision: 1703892

URL: http://svn.apache.org/viewvc?rev=1703892&view=rev
Log:
Continue removing svn_cl__interactive_conflict_baton_t from 'svn' conflict code.

Make svn_cl__resolve_conflict() accept new parameters instead of grabbing the
same data from the client context's conflict callback baton.

* subversion/svn/cl.h
  (svn_cl__conflict_stats_t): Move typedef upwards so svn_cl__cmd_baton_t
   can use it.
  (svn_cl__cmd_baton_t): Add 'conflict_stats' here so we can pass it to
   subcommands without relying on the conflict callback baton.
  (svn_cl__resolve_conflict): Update declaration.

* subversion/svn/conflict-callbacks.c
  (svn_cl__resolve_conflict): Add output arguments 'accept_which', 'quit',
   'external_failed', and 'printed_summary'. Add parameters 'editor_cmd',
   'config', 'path_prefix', 'pb', and 'conflict_stats'. Use these parameters
   instead of accessing the conflict callback baton in the client context.

* subversion/svn/resolve-cmd.c
  (conflict_status_walker_baton): Add new fields 'accept_which', 'quit',
   'external_failed', 'printed_summary', 'editor_cmd', 'config',
   'path_prefix', 'pb', and 'conflict_stats'.
  (conflict_status_walker): Update this caller of svn_cl__resolve_conflict().
  (walk_conflicts): Add new parameters 'accept_which', 'quit',
  'external_failed', 'printed_summary', 'editor_cmd', 'config',
   'path_prefix', 'pb', and 'conflict_stats'.
   Initialize the conflict walker baton with this data.
  (svn_cl__resolve): Get conflict stats from subcommand baton.
   Allocate and provide new arguments for svn_cl__resolve_conflict()
   and walk_conflicts().

* subversion/svn/svn.c
  (sub_main): Store a pointer to conflicts stats in command_baton.

Modified:
    subversion/trunk/subversion/svn/cl.h
    subversion/trunk/subversion/svn/conflict-callbacks.c
    subversion/trunk/subversion/svn/resolve-cmd.c
    subversion/trunk/subversion/svn/svn.c

Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1703892&r1=1703891&r2=1703892&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Fri Sep 18 15:54:26 2015
@@ -251,10 +251,13 @@ typedef struct svn_cl__opt_state_t
   const char *show_item;           /* print only the given item */
 } svn_cl__opt_state_t;
 
+/* Conflict stats for operations such as update and merge. */
+typedef struct svn_cl__conflict_stats_t svn_cl__conflict_stats_t;
 
 typedef struct svn_cl__cmd_baton_t
 {
   svn_cl__opt_state_t *opt_state;
+  svn_cl__conflict_stats_t *conflict_stats;
   svn_client_ctx_t *ctx;
 } svn_cl__cmd_baton_t;
 
@@ -346,9 +349,6 @@ svn_cl__check_cancel(void *baton);
 typedef struct svn_cl__interactive_conflict_baton_t
   svn_cl__interactive_conflict_baton_t;
 
-/* Conflict stats for operations such as update and merge. */
-typedef struct svn_cl__conflict_stats_t svn_cl__conflict_stats_t;
-
 /* Return a new, initialized, conflict stats structure, allocated in
  * POOL. */
 svn_cl__conflict_stats_t *
@@ -405,7 +405,16 @@ svn_cl__conflict_func_interactive(svn_wc
 
 svn_error_t *
 svn_cl__resolve_conflict(svn_boolean_t *resolved,
+                         svn_cl__accept_t *accept_which,
+                         svn_boolean_t *quit,
+                         svn_boolean_t *external_failed,
+                         svn_boolean_t *printed_summary,
                          svn_client_conflict_t *conflict,
+                         const char *editor_cmd,
+                         apr_hash_t *config,
+                         const char *path_prefix,
+                         svn_cmdline_prompt_baton_t *pb,
+                         svn_cl__conflict_stats_t *conflict_stats,
                          svn_client_conflict_option_id_t option_id,
                          svn_client_ctx_t *ctx,
                          apr_pool_t *scratch_pool);

Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1703892&r1=1703891&r2=1703892&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Fri Sep 18 15:54:26 2015
@@ -1542,19 +1542,26 @@ svn_cl__conflict_func_interactive(svn_wc
 
 svn_error_t *
 svn_cl__resolve_conflict(svn_boolean_t *resolved,
+                         svn_cl__accept_t *accept_which,
+                         svn_boolean_t *quit,
+                         svn_boolean_t *external_failed,
+                         svn_boolean_t *printed_summary,
                          svn_client_conflict_t *conflict,
+                         const char *editor_cmd,
+                         apr_hash_t *config,
+                         const char *path_prefix,
+                         svn_cmdline_prompt_baton_t *pb,
+                         svn_cl__conflict_stats_t *conflict_stats,
                          svn_client_conflict_option_id_t option_id,
                          svn_client_ctx_t *ctx,
                          apr_pool_t *scratch_pool)
 {
-  svn_cl__interactive_conflict_baton_t *b = ctx->conflict_baton2;
-
   if (option_id == svn_client_conflict_option_unspecified)
     SVN_ERR(conflict_func_interactive(&option_id, NULL, NULL,
-                                      &b->accept_which, &b->quit,
-                                      &b->external_failed, &b->printed_summary,
-                                      conflict, b->editor_cmd, b->config,
-                                      b->path_prefix, b->pb, b->conflict_stats,
+                                      accept_which, quit,
+                                      external_failed, printed_summary,
+                                      conflict, editor_cmd, config,
+                                      path_prefix, pb, conflict_stats,
                                       scratch_pool, scratch_pool));
 
   SVN_ERR_ASSERT(option_id != svn_client_conflict_option_unspecified);
@@ -1564,7 +1571,7 @@ svn_cl__resolve_conflict(svn_boolean_t *
     {
       const char *local_relpath
         = svn_cl__local_style_skip_ancestor(
-            b->path_prefix, svn_client_conflict_get_local_abspath(conflict),
+            path_prefix, svn_client_conflict_get_local_abspath(conflict),
             scratch_pool);
       svn_wc_conflict_kind_t conflict_kind;
       const char *local_abspath;
@@ -1598,7 +1605,7 @@ svn_cl__resolve_conflict(svn_boolean_t *
 
       SVN_ERR(err);
     
-      svn_cl__conflict_stats_resolved(b->conflict_stats, local_relpath,
+      svn_cl__conflict_stats_resolved(conflict_stats, local_relpath,
                                       svn_client_conflict_get_kind(conflict));
       *resolved = TRUE;
     }

Modified: subversion/trunk/subversion/svn/resolve-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/resolve-cmd.c?rev=1703892&r1=1703891&r2=1703892&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/resolve-cmd.c (original)
+++ subversion/trunk/subversion/svn/resolve-cmd.c Fri Sep 18 15:54:26 2015
@@ -48,6 +48,15 @@ struct conflict_status_walker_baton
   void *notify_baton;
   svn_boolean_t resolved_one;
   apr_hash_t *resolve_later;
+  svn_cl__accept_t *accept_which;
+  svn_boolean_t *quit;
+  svn_boolean_t *external_failed;
+  svn_boolean_t *printed_summary;
+  const char *editor_cmd;
+  apr_hash_t *config;
+  const char *path_prefix;
+  svn_cmdline_prompt_baton_t *pb;
+  svn_cl__conflict_stats_t *conflict_stats;
 };
 
 /* Implements svn_wc_notify_func2_t to collect new conflicts caused by
@@ -99,8 +108,14 @@ conflict_status_walker(void *baton,
 
   SVN_ERR(svn_client_conflict_get(&conflict, local_abspath, cswb->ctx,
                                   iterpool, iterpool));
-  SVN_ERR(svn_cl__resolve_conflict(&resolved, conflict, cswb->option_id,
-                                   cswb->ctx, scratch_pool));
+  SVN_ERR(svn_cl__resolve_conflict(&resolved, cswb->accept_which,
+                                   cswb->quit, cswb->external_failed,
+                                   cswb->printed_summary,
+                                   conflict, cswb->editor_cmd,
+                                   cswb->config, cswb->path_prefix,
+                                   cswb->pb, cswb->conflict_stats,
+                                   cswb->option_id, cswb->ctx,
+                                   scratch_pool));
   if (resolved)
     cswb->resolved_one = TRUE;
 
@@ -114,6 +129,15 @@ walk_conflicts(svn_client_ctx_t *ctx,
                const char *local_abspath,
                svn_depth_t depth,
                svn_client_conflict_option_id_t option_id,
+               svn_cl__accept_t *accept_which,
+               svn_boolean_t *quit,
+               svn_boolean_t *external_failed,
+               svn_boolean_t *printed_summary,
+               const char *editor_cmd,
+               apr_hash_t *config,
+               const char *path_prefix,
+               svn_cmdline_prompt_baton_t *pb,
+               svn_cl__conflict_stats_t *conflict_stats,
                apr_pool_t *scratch_pool)
 {
   struct conflict_status_walker_baton cswb;
@@ -131,6 +155,17 @@ walk_conflicts(svn_client_ctx_t *ctx,
                           ? apr_hash_make(scratch_pool)
                           : NULL;
 
+  cswb.accept_which = accept_which;
+  cswb.quit = quit;
+  cswb.external_failed = external_failed;
+  cswb.printed_summary = printed_summary;
+  cswb.editor_cmd = editor_cmd;
+  cswb.config = config;
+  cswb.path_prefix = path_prefix;
+  cswb.pb = pb;
+  cswb.conflict_stats = conflict_stats;
+
+
   /* ### call notify.c code */
   if (ctx->notify_func2)
     ctx->notify_func2(ctx->notify_baton2,
@@ -264,16 +299,28 @@ svn_cl__resolve(apr_getopt_t *os,
                 apr_pool_t *scratch_pool)
 {
   svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
+  svn_cl__conflict_stats_t *conflict_stats =
+    ((svn_cl__cmd_baton_t *) baton)->conflict_stats;
   svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
   svn_client_conflict_option_id_t option_id;
   svn_error_t *err;
   apr_array_header_t *targets;
+  const char *path_prefix;
   int i;
   apr_pool_t *iterpool;
   svn_boolean_t had_error = FALSE;
+  svn_boolean_t quit = FALSE;
+  svn_boolean_t external_failed = FALSE;
+  svn_boolean_t printed_summary = FALSE;
+  svn_cmdline_prompt_baton_t *pb = apr_palloc(scratch_pool, sizeof(*pb));
+
+  pb->cancel_func = ctx->cancel_func;
+  pb->cancel_baton = ctx->cancel_baton;
 
   option_id = svn_client_conflict_option_unspecified;
 
+  SVN_ERR(svn_dirent_get_absolute(&path_prefix, "", scratch_pool));
+
   switch (opt_state->accept_which)
     {
     case svn_cl__accept_working:
@@ -343,13 +390,23 @@ svn_cl__resolve(apr_getopt_t *os,
 
           SVN_ERR(svn_client_conflict_get(&conflict, local_abspath, ctx,
                                           iterpool, iterpool));
-          err = svn_cl__resolve_conflict(&resolved, conflict, option_id, ctx,
-                                         iterpool);
+          SVN_ERR(svn_cl__resolve_conflict(&resolved,
+                                           &opt_state->accept_which,
+                                           &quit, &external_failed,
+                                           &printed_summary,
+                                           conflict, opt_state->editor_cmd,
+                                           ctx->config, path_prefix,
+                                           pb, conflict_stats,
+                                           option_id, ctx,
+                                           iterpool));
         }
       else
         {
           err = walk_conflicts(ctx, local_abspath, opt_state->depth,
-                               option_id, iterpool);
+                               option_id, &opt_state->accept_which,
+                               &quit, &external_failed, &printed_summary,
+                               opt_state->editor_cmd, ctx->config,
+                               path_prefix, pb, conflict_stats, iterpool);
         }
 
       if (err)

Modified: subversion/trunk/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1703892&r1=1703891&r2=1703892&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Fri Sep 18 15:54:26 2015
@@ -2793,6 +2793,7 @@ sub_main(int *exit_code, int argc, const
 
   /* Create a client context object. */
   command_baton.opt_state = &opt_state;
+  command_baton.conflict_stats = conflict_stats;
   SVN_ERR(svn_client_create_context2(&ctx, cfg_hash, pool));
   command_baton.ctx = ctx;