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

Re: Unable to shelve changes when using custom diff-cmd

From: Philip Martin <philip_at_codematters.co.uk>
Date: Wed, 27 Jun 2018 12:33:59 +0100

Csongor Pal <cpal_at_feralinteractive.com> writes:

> I ran into an issue with svn shelve on my setup. I use the following
> script as my diff-cmd to open diffs with FileMerge on macOS:
> svn-diffwrap.sh
> <https://gist.github.com/dtjm/523243/6975de552166beb08943fe8a44f8b5ddbb29a875#file-svn-diffwrap-sh>
>
> When running an svn shelve command I get the diffs opened up in
> FileMerge and the command fails with: svn: E200009: No changes were
> shelved
>
> When I remove the diff-cmd setting from the config file svn shelve
> works as expected, but is there a way to have both features work at
> the same time?
>
> I'm using svn, version 1.10.0 (r1827917) on macOS 10.13.

The shelve feature in 1.10 relies on a valid diff being written to
standard output. If the configured diff_cmd invokes a GUI and doesn't
write a diff to stdout then attempts to shelve will fail.

Trunk/1.11 doesn't have this problem because the shelve code no longer
relies on diff writing to stdout. The long term fix for 1.10 might be
to change the Subversion code so that shelve always runs the internal
diff.

In the short term, a 1.10 user might be able to fix the problem by
making the configured diff_cmd detect when output to stdout is required.
In this case diff_cmd is a shell script so perhaps using test's -t to
determine whether stdout is a terminal would work:

if [ -t 1 ] ; then
   # original script to invoke custom diff
   ...
else
   # write standard diff to stdout
   diff "$1" "$2" "$3" "$4" "$5" "$6" "$7"
fi

That may not work if using some sort of GUI Subversion client which
always redirects stdout. In that case a solution might be to make the
configured diff_cmd always write a diff to stdout in addition to
whatever else it does.

-- 
Philip
Received on 2018-06-27 13:34:20 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.