[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-cvs
Subject:    
From:       glasser () tigris ! org
Date:       2007-09-28 23:30:41
Message-ID: 200709282330.l8SNUfZ6008539 () svn2 ! sjc ! collab ! net
[Download RAW message or body]

Author: glasser
Date: Fri Sep 28 16:30:41 2007
New Revision: 26847

Log:
Allow CTRL-C to work during interactive conflict resolution
prompt.

* subversion/include/svn_cmdline.h
  (svn_cmdline_prompt_user2): Rev API to take a
   svn_cmdline_prompt_baton_t.

* subversion/libsvn_subr/prompt.c
  (svn_cmdline_prompt_user2): New version of API, passing the baton
   through to prompt().
  (svn_cmdline_prompt_user): Deprecate.

* subversion/svn/conflict-callbacks.c
  (svn_cl__interactive_conflict_handler): Treat baton as a
   svn_cmdline_prompt_baton_t and pass it through to
   svn_cmdline_prompt_user2.

* subversion/svn/main.c
  (main): If using the interactive conflict handler, set up a
   cancellation baton for it.


Modified:
   trunk/subversion/include/svn_cmdline.h
   trunk/subversion/libsvn_subr/prompt.c
   trunk/subversion/svn/conflict-callbacks.c
   trunk/subversion/svn/main.c

Modified: trunk/subversion/include/svn_cmdline.h
URL: http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_cmdline.h?pathrev=26847&r1=26846&r2=26847
 ==============================================================================
--- trunk/subversion/include/svn_cmdline.h	(original)
+++ trunk/subversion/include/svn_cmdline.h	Fri Sep 28 16:30:41 2007
@@ -139,16 +139,6 @@
                                   apr_pool_t *pool,
                                   const char *prefix);
 
-/** Prompt the user for input, using @a prompt_str for the prompt and
- * returning the user's response in @a result, allocated in @a pool.
- *
- * @since New in 1.4.
- */
-svn_error_t *
-svn_cmdline_prompt_user(const char **result,
-                        const char *prompt_str,
-                        apr_pool_t *pool);
-
 /** A cancellation function/baton pair to be passed as the baton argument
  * to the @c svn_cmdline_*_prompt functions.
  *
@@ -159,6 +149,28 @@
   void *cancel_baton;
 } svn_cmdline_prompt_baton_t;
 
+/** Prompt the user for input, using @a prompt_str for the prompt and
+ * @a baton (which may be @c NULL) for cancellation, and returning the
+ * user's response in @a result, allocated in @a pool.
+ *
+ * @since New in 1.5.
+ */
+svn_error_t *
+svn_cmdline_prompt_user2(const char **result,
+                         const char *prompt_str,
+                         svn_cmdline_prompt_baton_t *baton,
+                         apr_pool_t *pool);
+
+/** Similar to svn_cmdline_prompt_user2, but without cancellation
+ * support.
+ *
+ * @deprecated Provided for backward compatibility with the 1.4 API.
+ */
+svn_error_t *
+svn_cmdline_prompt_user(const char **result,
+                        const char *prompt_str,
+                        apr_pool_t *pool);
+
 /** An implementation of @c svn_auth_simple_prompt_func_t that prompts
  * the user for keyboard input on the command line.
  *

Modified: trunk/subversion/libsvn_subr/prompt.c
URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/prompt.c?pathrev=26847&r1=26846&r2=26847
 ==============================================================================
--- trunk/subversion/libsvn_subr/prompt.c	(original)
+++ trunk/subversion/libsvn_subr/prompt.c	Fri Sep 28 16:30:41 2007
@@ -381,9 +381,19 @@
 /** Generic prompting. **/
 
 svn_error_t *
+svn_cmdline_prompt_user2(const char **result,
+                         const char *prompt_str,
+                         svn_cmdline_prompt_baton_t *baton,
+                         apr_pool_t *pool)
+{
+  return prompt(result, prompt_str, FALSE /* don't hide input */, baton, pool);
+}
+
+
+svn_error_t *
 svn_cmdline_prompt_user(const char **result,
                         const char *prompt_str,
                         apr_pool_t *pool)
 {
-  return prompt(result, prompt_str, FALSE /* don't hide input */, NULL, pool);
+  return svn_cmdline_prompt_user2(result, prompt_str, NULL, pool);
 }

Modified: trunk/subversion/svn/conflict-callbacks.c
URL: http://svn.collab.net/viewvc/svn/trunk/subversion/svn/conflict-callbacks.c?pathrev=26847&r1=26846&r2=26847
 ==============================================================================
--- trunk/subversion/svn/conflict-callbacks.c	(original)
+++ trunk/subversion/svn/conflict-callbacks.c	Fri Sep 28 16:30:41 2007
@@ -143,6 +143,7 @@
                                      apr_pool_t *pool)
 {
   apr_pool_t *subpool = svn_pool_create(pool);
+  svn_cmdline_prompt_baton_t *pb = baton;
 
   /* Handle conflicting file contents, which is the most common case. */
   if ((desc->node_kind == svn_node_file)
@@ -168,7 +169,7 @@
             prompt = apr_pstrcat(subpool, prompt, _(", (r)esolved"), NULL);
           prompt = apr_pstrcat(subpool, prompt, _(", (h)elp : "), NULL);
 
-          SVN_ERR(svn_cmdline_prompt_user(&answer, prompt, subpool));
+          SVN_ERR(svn_cmdline_prompt_user2(&answer, prompt, pb, subpool));
 
           if ((strcmp(answer, "h") == 0) || (strcmp(answer, "?") == 0))
             {
@@ -312,7 +313,7 @@
         {
           svn_pool_clear(subpool);
 
-          SVN_ERR(svn_cmdline_prompt_user(&answer, prompt, subpool));
+          SVN_ERR(svn_cmdline_prompt_user2(&answer, prompt, pb, subpool));
 
           if ((strcmp(answer, "h") == 0) || (strcmp(answer, "?") == 0))
             {

Modified: trunk/subversion/svn/main.c
URL: http://svn.collab.net/viewvc/svn/trunk/subversion/svn/main.c?pathrev=26847&r1=26846&r2=26847
 ==============================================================================
--- trunk/subversion/svn/main.c	(original)
+++ trunk/subversion/svn/main.c	Fri Sep 28 16:30:41 2007
@@ -1737,8 +1737,13 @@
   if (interactive_conflicts
       && (! opt_state.non_interactive ))
     {
+      svn_cmdline_prompt_baton_t *pb = apr_palloc(pool, sizeof(*pb));
+
+      pb->cancel_func = ctx->cancel_func;
+      pb->cancel_baton = ctx->cancel_baton;
+
       ctx->conflict_func = svn_cl__interactive_conflict_handler;
-      ctx->conflict_baton = NULL;
+      ctx->conflict_baton = pb;
     }
   else
     {

---------------------------------------------------------------------
To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
For additional commands, e-mail: svn-help@subversion.tigris.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic