Discussion:
Unable to shelve changes when using custom diff-cmd
Csongor Pal
2018-06-26 10:19:48 UTC
Permalink
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
Branko Čibej
2018-06-26 10:37:07 UTC
Permalink
Post by Csongor Pal
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
Daniel Shahaf
2018-06-27 09:17:44 UTC
Permalink
Post by Branko Čibej
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
]]]
Philip Martin
2018-06-27 11:33:59 UTC
Permalink
Post by Csongor Pal
I ran into an issue with svn shelve on my setup. I use the following
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
Julian Foad
2018-06-28 20:34:59 UTC
Permalink
Post by Csongor Pal
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
[...]
Post by Csongor Pal
I'm using svn, version 1.10.0 (r1827917) on macOS 10.13.
[...] 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

Loading...