Author: svn-role
Date: Wed Nov 26 04:00:34 2014
New Revision: 1641761
URL: http://svn.apache.org/r1641761
Log:
Merge the r1628431 group from trunk:
* r1628431, r1628536, r1628540
Fix issue #4085, "external can shadow a versioned directory".
Justification:
Bug that can lead to a working copy which cannot be updated
until a directory shadowing an external, which was switched
to the external's location by the externals handling code,
is switched back to its original path.
Notes:
r1628536 is the fix, r1628431 and r1628540 correct the test.
Votes:
+1: stsp, philip, rhuijben
Modified:
subversion/branches/1.8.x/ (props changed)
subversion/branches/1.8.x/STATUS
subversion/branches/1.8.x/subversion/libsvn_client/externals.c
subversion/branches/1.8.x/subversion/tests/cmdline/externals_tests.py
Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1628431,1628536,1628540
Modified: subversion/branches/1.8.x/STATUS
URL:
http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1641761&r1=1641760&r2=1641761&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Wed Nov 26 04:00:34 2014
@@ -142,15 +142,3 @@ Veto-blocked changes:
Approved changes:
=================
-
- * r1628431, r1628536, r1628540
- Fix issue #4085, "external can shadow a versioned directory".
- Justification:
- Bug that can lead to a working copy which cannot be updated
- until a directory shadowing an external, which was switched
- to the external's location by the externals handling code,
- is switched back to its original path.
- Notes:
- r1628536 is the fix, r1628431 and r1628540 correct the test.
- Votes:
- +1: stsp, philip, rhuijben
Modified: subversion/branches/1.8.x/subversion/libsvn_client/externals.c
URL:
http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_client/externals.c?rev=1641761&r1=1641760&r2=1641761&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_client/externals.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_client/externals.c Wed Nov 26
04:00:34 2014
@@ -169,6 +169,37 @@ switch_dir_external(const char *local_ab
if (revision->kind == svn_opt_revision_number)
external_rev = revision->value.number;
+ /*
+ * The code below assumes existing versioned paths are *not* part of
+ * the external's defining working copy.
+ * The working copy library does not support registering externals
+ * on top of existing BASE nodes and will error out if we try.
+ * So if the external target is part of the defining working copy's
+ * BASE tree, don't attempt to create the external. Doing so would
+ * leave behind a switched path instead of an external (since the
+ * switch succeeds but registration of the external in the DB fails).
+ * The working copy then cannot be updated until the path is switched back.
+ * See issue #4085.
+ */
+ SVN_ERR(svn_wc__node_get_base(&kind, NULL, NULL,
+ &repos_root_url, &repos_uuid,
+ NULL, ctx->wc_ctx, local_abspath,
+ TRUE, /* ignore_enoent */
+ TRUE, /* show hidden */
+ pool, pool));
+ if (kind != svn_node_unknown)
+ {
+ const char *wcroot_abspath;
+ const char *defining_wcroot_abspath;
+
+ SVN_ERR(svn_wc__get_wcroot(&wcroot_abspath, ctx->wc_ctx,
+ local_abspath, pool, pool));
+ SVN_ERR(svn_wc__get_wcroot(&defining_wcroot_abspath, ctx->wc_ctx,
+ defining_abspath, pool, pool));
+ if (strcmp(wcroot_abspath, defining_wcroot_abspath) == 0)
+ return svn_error_create(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL, NULL);
+ }
+
/* If path is a directory, try to update/switch to the correct URL
and revision. */
SVN_ERR(svn_io_check_path(local_abspath, &kind, pool));
Modified: subversion/branches/1.8.x/subversion/tests/cmdline/externals_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/cmdline/externals_tests.py?rev=1641761&r1=1641760&r2=1641761&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/tests/cmdline/externals_tests.py
(original)
+++ subversion/branches/1.8.x/subversion/tests/cmdline/externals_tests.py Wed
Nov 26 04:00:34 2014
@@ -2794,23 +2794,26 @@ def include_immediate_dir_externals(sbox
@Issue(4085)
-@XFail()
def shadowing(sbox):
"external shadows an existing dir"
- sbox.build(read_only=True)
+ sbox.build()
wc_dir = sbox.wc_dir
# Setup external: /A/B/F as 'C' child of /A
externals_prop = "^/A/B/F C\n"
+ change_external(sbox.ospath('A'), externals_prop, commit=False)
+
+ # An update errors out because the external is shadowed by an existing dir
+ svntest.main.run_svn("W205011: Error handling externals definition for '%s'"
+ % (sbox.wc_dir) + "/A/C", 'update', wc_dir)
+
+ # Remove the shadowed directory to unblock the external
+ svntest.main.run_svn(None, 'rm', sbox.repo_url + '/A/C', '-m', 'remove A/C')
+
+ # The next update should fetch the external and not error out
+ sbox.simple_update()
- raised = False
- try:
- change_external(sbox.ospath('A'), externals_prop, commit=False)
- except:
- raised = True
- if not raised:
- raise svntest.Failure("Creating conflicting child 'C' of 'A' didn't error")
# Test for issue #4093 'remapping a file external can segfault due to
# "deleted" props'.