On the 1.7.x-issue3741 branch, merge r1445753, resolving minor text conflicts.
git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/1.7.x-issue3741@1445758 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/libsvn_client/update.c b/subversion/libsvn_client/update.c
index c045bbe..6e76dae 100644
--- a/subversion/libsvn_client/update.c
+++ b/subversion/libsvn_client/update.c
@@ -209,6 +209,7 @@
struct svn_client__dirent_fetcher_baton_t dfb;
svn_boolean_t server_supports_depth;
svn_boolean_t tree_conflicted;
+ svn_boolean_t cropping_target;
svn_config_t *cfg = ctx->config ? apr_hash_get(ctx->config,
SVN_CONFIG_CATEGORY_CONFIG,
APR_HASH_KEY_STRING) : NULL;
@@ -268,7 +269,8 @@
}
/* We may need to crop the tree if the depth is sticky */
- if (depth_is_sticky && depth < svn_depth_infinity)
+ cropping_target = (depth_is_sticky && depth < svn_depth_infinity);
+ if (cropping_target)
{
svn_node_kind_t target_kind;
@@ -421,7 +423,8 @@
/* We handle externals after the update is complete, so that
handling external items (and any errors therefrom) doesn't delay
the primary operation. */
- if (SVN_DEPTH_IS_RECURSIVE(depth) && (! ignore_externals))
+ if ((SVN_DEPTH_IS_RECURSIVE(depth) || cropping_target)
+ && (! ignore_externals))
{
apr_hash_t *new_externals;
apr_hash_t *new_depths;
diff --git a/subversion/tests/cmdline/externals_tests.py b/subversion/tests/cmdline/externals_tests.py
index cea6933..721ee07 100755
--- a/subversion/tests/cmdline/externals_tests.py
+++ b/subversion/tests/cmdline/externals_tests.py
@@ -2309,6 +2309,45 @@
"OUTPUT", expected_stdout, [], 0, 'copy', repo_url + '/A/C',
os.path.join(wc_dir, 'External-WC-to-URL-Copy'))
+# Test for issue #3741 'externals not removed when working copy is made shallow'
+@Issue(3741)
+def update_dir_external_shallow(sbox):
+ "shallow update should remove externals"
+
+ sbox.build()
+
+ # Create an external in r2
+ sbox.simple_propset('svn:externals', '^/A/D/H X', 'A/B/E')
+ sbox.simple_commit()
+ sbox.simple_update()
+
+ # Now make A/B/E shallow by updating with "--set-depth empty"
+ expected_output = svntest.wc.State(sbox.wc_dir, {
+ 'A/B/E/alpha' : Item(status='D '),
+ 'A/B/E/X' : Item(verb='Removed external'),
+ 'A/B/E/beta' : Item(status='D '),
+ })
+ svntest.actions.run_and_verify_update(sbox.wc_dir,
+ expected_output, None, None,
+ None, None, None, None, None, False,
+ '--set-depth=empty',
+ sbox.ospath('A/B/E'))
+
+ # And bring the external back by updating with "--set-depth infinity"
+ expected_output = svntest.wc.State(sbox.wc_dir, {
+ 'A/B/E/X/psi' : Item(status='A '),
+ 'A/B/E/X/chi' : Item(status='A '),
+ 'A/B/E/X/omega' : Item(status='A '),
+ 'A/B/E/alpha' : Item(status='A '),
+ 'A/B/E/beta' : Item(status='A '),
+ })
+ svntest.actions.run_and_verify_update(sbox.wc_dir,
+ expected_output, None, None,
+ None, None, None, None, None, False,
+ '--set-depth=infinity',
+ sbox.ospath('A/B/E'))
+
+
########################################################################
# Run the tests
@@ -2353,6 +2392,7 @@
remap_file_external_with_prop_del,
dir_external_with_dash_r_only,
url_to_wc_copy_of_externals,
+ update_dir_external_shallow,
]
if __name__ == '__main__':