You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Csongor Pal <cp...@feralinteractive.com> on 2018/06/26 10:19:48 UTC

Unable to shelve changes when using custom diff-cmd

Hi,

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.


Thanks,
Csongor

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

Posted by Julian Foad <ju...@apache.org>.
> Csongor Pal <cp...@feralinteractive.com> writes:
>> 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
> [...]
>> I'm using svn, version 1.10.0 (r1827917) on macOS 10.13.

Philip Martin wrote: 
> [...]  The long term fix for 1.10 might be to change the Subversion code
> so that shelve always runs the internal diff.

I have filed this issue as https://issues.apache.org/jira/browse/SVN-4758 and committed a fix in http://svn.apache.org/r1834612 which is nominated for backport to 1.10.x.

Thanks for the report.
- Julian



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

Posted by Philip Martin <ph...@codematters.co.uk>.
Csongor Pal <cp...@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

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

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Branko Čibej wrote on Tue, 26 Jun 2018 12:37 +0200:
> It would be helpful if the wrapper script returned the exit code from
> the diff program. Something like 'exit $?' at the end would do it.

Come again?  Appending 'exit $?' to a shell script is a no-op; a script
returns the exit code of its last command.

[[[
% echo '(exit 42)' | sh; echo $?
42
]]]

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

Posted by Branko Čibej <br...@apache.org>.
On 26.06.2018 12:19, Csongor Pal wrote:
> Hi,
>
> 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?

It would be helpful if the wrapper script returned the exit code from
the diff program. Something like 'exit $?' at the end would do it.

-- Brane