Author: svn-role
Date: Tue Oct 2 04:00:08 2018
New Revision: 1842579
URL: http://svn.apache.org/viewvc?rev=1842579&view=rev
Log:
Merge the 1.10.x-issue4758 branch:
* r1834612, r1834835
On the '1.10.x-issue4758' branch: Fix SVN-4758 "Unable to shelve changes
when using custom diff-cmd".
Justification:
User-reported breakage of 'svn shelve'.
Branch: ^/subversion/branches/1.10.x-issue4758
Votes:
+1: julianfoad, jamessan, stsp
Modified:
subversion/branches/1.10.x/ (props changed)
subversion/branches/1.10.x/STATUS
subversion/branches/1.10.x/subversion/libsvn_client/shelve.c
subversion/branches/1.10.x/subversion/tests/cmdline/shelve_tests.py
Propchange: subversion/branches/1.10.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 2 04:00:08 2018
@@ -1,5 +1,6 @@
/subversion/branches/1.10-cache-improvements:1669168-1694487
/subversion/branches/1.10.x-issue4686:1823212-1823727
+/subversion/branches/1.10.x-issue4758:1834611-1842578
/subversion/branches/1.10.x-x-shelve:1827566-1827916
/subversion/branches/1.5.x-r30215:870312
/subversion/branches/1.7.x-fs-verify:1146708,1161180
Modified: subversion/branches/1.10.x/STATUS
URL:
http://svn.apache.org/viewvc/subversion/branches/1.10.x/STATUS?rev=1842579&r1=1842578&r2=1842579&view=diff
==============================================================================
--- subversion/branches/1.10.x/STATUS (original)
+++ subversion/branches/1.10.x/STATUS Tue Oct 2 04:00:08 2018
@@ -21,15 +21,6 @@ Veto-blocked changes:
Approved changes:
=================
- * r1834612, r1834835
- On the '1.10.x-issue4758' branch: Fix SVN-4758 "Unable to shelve changes
- when using custom diff-cmd".
- Justification:
- User-reported breakage of 'svn shelve'.
- Branch: ^/subversion/branches/1.10.x-issue4758
- Votes:
- +1: julianfoad, jamessan, stsp
-
* r1840991
Prevent an out-of-bounds array access in the conflict resolver.
Justification:
Modified: subversion/branches/1.10.x/subversion/libsvn_client/shelve.c
URL:
http://svn.apache.org/viewvc/subversion/branches/1.10.x/subversion/libsvn_client/shelve.c?rev=1842579&r1=1842578&r2=1842579&view=diff
==============================================================================
--- subversion/branches/1.10.x/subversion/libsvn_client/shelve.c (original)
+++ subversion/branches/1.10.x/subversion/libsvn_client/shelve.c Tue Oct 2
04:00:08 2018
@@ -188,13 +188,18 @@ shelf_write_patch(const char *name,
for (i = 0; i < paths->nelts; i++)
{
const char *path = APR_ARRAY_IDX(paths, i, const char *);
+ apr_hash_t *old_config;
+ svn_error_t *err;
if (svn_path_is_url(path))
return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
_("'%s' is not a local path"), path);
SVN_ERR(svn_dirent_get_absolute(&path, path, scratch_pool));
- SVN_ERR(svn_client_diff_peg6(
+ /* Ensure we use internal diff, not any configured external diff-cmd. */
+ old_config = ctx->config;
+ ctx->config = NULL;
+ err = svn_client_diff_peg6(
NULL /*options*/,
path,
&peg_revision,
@@ -214,8 +219,11 @@ shelf_write_patch(const char *name,
outstream,
errstream,
changelists,
- ctx, iterpool));
+ ctx, iterpool);
+ ctx->config = old_config;
+ SVN_ERR(err);
}
+
SVN_ERR(svn_stream_close(outstream));
SVN_ERR(svn_stream_close(errstream));
Modified: subversion/branches/1.10.x/subversion/tests/cmdline/shelve_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.10.x/subversion/tests/cmdline/shelve_tests.py?rev=1842579&r1=1842578&r2=1842579&view=diff
==============================================================================
--- subversion/branches/1.10.x/subversion/tests/cmdline/shelve_tests.py
(original)
+++ subversion/branches/1.10.x/subversion/tests/cmdline/shelve_tests.py Tue Oct
2 04:00:08 2018
@@ -25,7 +25,7 @@
######################################################################
# General modules
-import shutil, stat, re, os, logging
+import shutil, stat, re, os, sys, logging
logger = logging.getLogger()
@@ -44,7 +44,7 @@ Item = wc.StateItem
#----------------------------------------------------------------------
-def shelve_unshelve_verify(sbox):
+def shelve_unshelve_verify(sbox, global_opts=()):
"""Round-trip: shelve; verify all changes are reverted;
unshelve; verify all changes are restored.
"""
@@ -58,18 +58,18 @@ def shelve_unshelve_verify(sbox):
# Shelve; check there are no longer any modifications
svntest.actions.run_and_verify_svn(None, [],
- 'shelve', 'foo')
+ 'shelve', 'foo', *global_opts)
virginal_state = svntest.actions.get_virginal_state(wc_dir, 1)
svntest.actions.run_and_verify_status(wc_dir, virginal_state)
# Unshelve; check the original modifications are here again
svntest.actions.run_and_verify_svn(None, [],
- 'unshelve', 'foo')
+ 'unshelve', 'foo', *global_opts)
svntest.actions.run_and_verify_status(wc_dir, modified_state)
#----------------------------------------------------------------------
-def shelve_unshelve(sbox, modifier):
+def shelve_unshelve(sbox, modifier, global_opts=()):
"""Round-trip: build 'sbox'; apply changes by calling 'modifier(sbox)';
shelve and unshelve; verify changes are fully reverted and restored.
"""
@@ -82,7 +82,7 @@ def shelve_unshelve(sbox, modifier):
# Make some changes to the working copy
modifier(sbox)
- shelve_unshelve_verify(sbox)
+ shelve_unshelve_verify(sbox, global_opts)
os.chdir(was_cwd)
@@ -156,6 +156,35 @@ def shelve_from_inner_path(sbox):
#----------------------------------------------------------------------
+def shelve_ignores_external_diff(sbox):
+ "shelve ignores external diff"
+
+ def modifier(sbox):
+ sbox.simple_append('A/mu', 'appended mu text')
+
+ sbox.build()
+ was_cwd = os.getcwd()
+ os.chdir(sbox.ospath('A'))
+ sbox.wc_dir = '..'
+
+ # Configure an external 'diff-cmd' that doesn't print a diff to stdout.
+ # (This path needs an explicit directory component to avoid searching.)
+ diff_script_path = os.path.join('.', 'diff')
+ svntest.main.create_python_hook_script(diff_script_path, 'import sys\n'
+ 'for arg in sys.argv[1:]:\n print(arg)\n')
+ if sys.platform == 'win32':
+ diff_script_path = "%s.bat" % diff_script_path
+ config_dir_path = sbox.get_tempname(prefix="config-dir")
+ os.mkdir(config_dir_path)
+ with open(os.path.join(config_dir_path, "config"), "w") as config_file:
+ config_file.write("[helpers]\n"
+ "diff-cmd = %s\n" % diff_script_path)
+
+ modifier(sbox)
+ shelve_unshelve_verify(sbox, global_opts=("--config-dir", config_dir_path))
+
+ os.chdir(was_cwd)
+
########################################################################
# Run the tests
@@ -166,6 +195,7 @@ test_list = [ None,
shelve_adds,
shelve_deletes,
shelve_from_inner_path,
+ shelve_ignores_external_diff,
]
if __name__ == '__main__':