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

Re: vimdiff wrapper for diff-cmd not working with 1.8

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Wed, 19 Jun 2013 00:58:32 +0100

[cc to dev]

Michael Schlottke <m.schlottke_at_aia.rwth-aachen.de> writes:

> I just installed svn 1.8 on our cluster. Before, we used svn 1.7.9 and
> a little vimdiff wrapper (taken, with a few changes, from
> http://svnbook.red-bean.com/nightly/en/svn.advanced.externaldifftools.html#svn.advanced.externaldifftools.diff),
> which worked like a charm when called as "svn diff
> --diff-cmd=diffwrap.py filename". However, with svn 1.8 something
> seems to have changed:
>
> The only lines I see after executing the command above are
>
>> Index: filename
>> ===================================================================
>
> and the terminal hangs. When I enter ":qa!", I get the following line
>
>> Vim: Warning: Output is not to a terminal
>
> and I am back in the terminal. I have not changed anything in the
> wrapper script, and indeed, when I manually use it with our old svn
> version (1.7.9), it still works. Does anyone have an idea what has
> changed in the way the diff-cmd is invoked? And, more importantly, how
> I can change the vimdiff wrapper so it works again?

I invoked vimdiff using a diff-cmd of:

    #!/bin/sh
    vimdiff $6 $7

this works with 1.7 but fails as you describe in 1.8.

The cause is the conversion of diff to the stream API. The code in
libsvn_client/diff.c:diff_content_changed now gets a Subversion stream
rather than an APR file for output so it does:

      /* We deal in streams, but svn_io_run_diff2() deals in file handles,
         unfortunately, so we need to make these temporary files, and then
         copy the contents to our stream. */
      SVN_ERR(svn_io_open_unique_file3(&outfile, &outfilename, NULL,
                                       svn_io_file_del_on_pool_cleanup,
                                       scratch_pool, scratch_pool));

and this use of a temporary file prevents the use of an external diff
that expects a terminal.

The only way I see to fix this is to stop using the stream API when the
external diff command wants a terminal. I don't think it is possible to
do this automatically, perhaps we need an --interactive-diff option?

-- 
Philip Martin | Subversion Committer
WANdisco | Non-Stop Data
www.wandisco.com
Received on 2013-06-19 01:59:08 CEST

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

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