[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [Issue 2950] New - Weird prompting to resolve conflicts when EDITOR is not defined

From: Eric Gillespie <epg_at_google.com>
Date: 2007-10-03 17:22:16 CEST

Eric Gillespie <epg@google.com> writes:

> "Mark Phippard" <markphip@gmail.com> writes:
>
> > On 10/3/07, Ben Collins-Sussman <sussman@red-bean.com> wrote:
> > > On 10/3/07, Mark Phippard <markphip@gmail.com> wrote:
> > > > On 10/3/07, Erik Huelsmann <ehuels@gmail.com> wrote:
> > > > > On 10/3/07, Ben Collins-Sussman <sussman@red-bean.com> wrote:
> > > > > > On 10/2/07, Mark Phippard <markphip@gmail.com> wrote:
> > > > > > > Did you try this on your Mac? I get the same behavior as Augie when I
> > > > > > > try this on OSX. I'll be happy to try it again after the patch is
> > > > > > > committed.
> > > > > >
> > > > > > Yes, this is a transcript from my Mac.
> > > > >
> > > > > Are you all using recent/current trunk versions? Could anything have
> > > > > happened in the mean time?
> > > >
> > > > Did a HEAD build last night and I still get it on OSX.
> > >
> > > I still can't reproduce on my Mac, using HEAD. Can you apply dlr's
> > > proposed patch, see if it fixes the problem?
> >
> > I applied Dan's patch and I still have the problem. Other than
> > changing the colors, I am just using the default OSX terminal.
>
> We still need Dan's patch for other reasons, but it has nothing
> to do with the problem. I updated the issue yesterday with an
> explanation of the problem, and how to fix it.
>
> ------- Additional comments from Eric Gillespie Tue Oct 2 17:20:15 -0700 2007 -------
>
> This happens because the prompt goes to stderr while the error message
> goes to stdout (bogus). We need to change the rest of the prompt
> callback to use svn_cmdline_fprintf(stderr).
>
> As an aside, I don't see why this fails on Mac (isn't that where you
> guys said you see this). On sane systems, stdout is line-buffered
> when connected to a tty, so the error message should have gone through
> anyway (as it does on Linux). I don't know why it's not, but that's
> why adding the flush calls helped. We have a separate change in
> progress (from dlr) to force stderr/stdout to buffer the way we like,
> though, so it doesn't really matter.
>

Try this patch (I haven't even compiled it):

Index: conflict-callbacks.c
===================================================================
--- conflict-callbacks.c (revision 26905)
+++ conflict-callbacks.c (working copy)
@@ -154,9 +154,9 @@
       char *prompt;
       svn_boolean_t performed_edit = FALSE;
 
- SVN_ERR(svn_cmdline_printf(subpool,
- _("Conflict discovered in '%s'.\n"),
- desc->path));
+ SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
+ _("Conflict discovered in '%s'.\n"),
+ desc->path));
       while (TRUE)
         {
           svn_pool_clear(subpool);
@@ -173,7 +173,7 @@
 
           if ((strcmp(answer, "h") == 0) || (strcmp(answer, "?") == 0))
             {
- SVN_ERR(svn_cmdline_printf(subpool,
+ SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
               _(" (p)ostpone - mark the conflict to be resolved later\n"
                 " (d)iff - show all changes made to merged file\n"
                 " (e)dit - change merged file in an editor\n"
@@ -221,7 +221,8 @@
                   performed_edit = TRUE;
                 }
               else
- SVN_ERR(svn_cmdline_printf(subpool, _("Invalid option.\n\n")));
+ SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
+ _("Invalid option.\n\n")));
             }
           if (strcmp(answer, "e") == 0)
             {
@@ -232,16 +233,18 @@
                                                       NULL, NULL, subpool);
                   if (eerr && (eerr->apr_err == SVN_ERR_CL_NO_EXTERNAL_EDITOR))
                     {
- SVN_ERR(svn_cmdline_printf(subpool,
- eerr->message ? eerr->message :
- _("No editor found.\n")));
+ SVN_ERR(svn_cmdline_fprintf(
+ stderr, subpool,
+ eerr->message ? eerr->message :
+ _("No editor found.\n")));
                       svn_error_clear(eerr);
                     }
                   else if (eerr && (eerr->apr_err == SVN_ERR_EXTERNAL_PROGRAM))
                     {
- SVN_ERR(svn_cmdline_printf(subpool,
- eerr->message ? eerr->message :
- _("Error running editor.\n")));
+ SVN_ERR(svn_cmdline_fprintf(
+ stderr, subpool,
+ eerr->message ? eerr->message :
+ _("Error running editor.\n")));
                       svn_error_clear(eerr);
                     }
                   else if (eerr)
@@ -250,19 +253,21 @@
                     performed_edit = TRUE;
                 }
               else
- SVN_ERR(svn_cmdline_printf(subpool, _("Invalid option.\n\n")));
+ SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
+ _("Invalid option.\n\n")));
             }
           if (strcmp(answer, "l") == 0)
             {
               if (desc->base_file && desc->repos_file && desc->user_file)
                 {
                   /* ### TODO: launch $SVNMERGE tool here with 3 fulltexts. */
- SVN_ERR(svn_cmdline_printf(
- subpool, _("Feature not yet implemented.\n\n")));
+ SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
+ _("Feature not yet implemented.\n\n")));
                   performed_edit = TRUE;
                 }
               else
- SVN_ERR(svn_cmdline_printf(subpool, _("Invalid option.\n\n")));
+ SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
+ _("Invalid option.\n\n")));
             }
           if (strcmp(answer, "r") == 0)
             {
@@ -275,7 +280,8 @@
                   break;
                 }
               else
- SVN_ERR(svn_cmdline_printf(subpool, _("Invalid option.\n\n")));
+ SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
+ _("Invalid option.\n\n")));
             }
         }
     }
@@ -303,10 +309,11 @@
       const char *answer;
       const char *prompt;
 
- SVN_ERR(svn_cmdline_printf(subpool,
- _("Conflict discovered when trying to add '%s'.\n"
- "An object of the same name already exists.\n"),
- desc->path));
+ SVN_ERR(svn_cmdline_fprintf(
+ stderr, subpool,
+ _("Conflict discovered when trying to add '%s'.\n"
+ "An object of the same name already exists.\n"),
+ desc->path));
       prompt = _("Select: (p)ostpone, (m)ine, (t)heirs, (h)elp :");
 
       while (1)
@@ -317,7 +324,7 @@
 
           if ((strcmp(answer, "h") == 0) || (strcmp(answer, "?") == 0))
             {
- SVN_ERR(svn_cmdline_printf(subpool,
+ SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
               _(" (p)ostpone - resolve the conflict later\n"
                 " (m)ine - accept pre-existing item \n"
                 " (t)heirs - accept incoming item\n"

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 3 17:23:19 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.