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

Stdout buffering issue

From: Stefan Haller <haller_at_ableton.com>
Date: 2006-02-09 14:34:03 CET

I'm writing a simple wrapper script for the svn command line client that
colorizes the status, update, and merge output. It is extremely
valuable to easily spot conflicts if they stand out in red.

Trouble is, it doesn't work well with the stock svn client, because
stdout is only line buffered if output goes to a terminal; if it goes to
a pipe, it is block-buffered, which means in practice that first the
entire operation completes and then I see the colorized output all at
once. This sucks for large updates or merges that can easily take
minutes to complete.

So I think that the output of co, st, up, switch, and merge should be
line-buffered always. (Diff and blame output shouldn't, of course.)

As a hack for my personal use, I just put

  if (subcommand->cmd_func == svn_cl__checkout
      || subcommand->cmd_func == svn_cl__update
      || subcommand->cmd_func == svn_cl__merge
      || subcommand->cmd_func == svn_cl__switch
      || subcommand->cmd_func == svn_cl__status)

in subversion/clients/cmdline/main.c, right before cmd_func is called;
for a real solution, one would probably have to insert calls to
svn_cmdline_fflush in all subcommands as appropriate.

Before I go about making a patch, I'd like to know if people think this
is a good idea at all.

Stefan Haller
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Feb 9 16:29:30 2006

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