Author: rhuijben
Date: Tue Apr 19 16:46:51 2011
New Revision: 1095130
URL: http://svn.apache.org/viewvc?rev=1095130&view=rev
Log:
Remove the 'apply svn:externals from added files' code we introduced during the
development of Subversion 1.7.0.
While nice to have in certain use cases like testing new externals
(see issue #2267), this quick and dirty hack introduses issues like
issue #3351, where externals are not properly removed.
This patch brings us back to the original behavior of only applying the
svn:externals as defined by the BASE tree (read: of committed nodes).
Which fixes the original automatic (but until recently mostly hidden)
removal of externals on update.
The removal/relegation of externals was made more visible in r1095122,
by updating the notification code.
* subversion/libsvn_client/client.h
(svn_client__gather_externals_in_locally_added_dirs): Remove function.
* subversion/libsvn_client/externals.c
(svn_client__gather_externals_in_locally_added_dirs): Remove function.
* subversion/libsvn_client/switch.c
(switch_internal): Remove walk of the WORKING tree for externals.
* subversion/libsvn_client/update.c
(update_internal): Remove walk of the WORKING tree for externals.
* subversion/libsvn_wc/adm_crawler.c
(read_externals_info): Read the BASE properties, not the ACTUAL ones.
(report_revisions_and_depths): Only call read_externals_info when we know
that we have BASE props.
* subversion/tests/cmdline/externals_tests.py
(modify_and_update_receive_new_external,
switch_relative_external,
relegate_external): Bring back to their old expectations by just
committing the svn:externals change before testing.
(update_external_on_locally_added_dir,
switch_external_on_locally_added_dir): Remove functions.
(test_list): Remove functions.
Modified:
subversion/trunk/subversion/libsvn_client/client.h
subversion/trunk/subversion/libsvn_client/externals.c
subversion/trunk/subversion/libsvn_client/switch.c
subversion/trunk/subversion/libsvn_client/update.c
subversion/trunk/subversion/libsvn_wc/adm_crawler.c
subversion/trunk/subversion/tests/cmdline/externals_tests.py
Modified: subversion/trunk/subversion/libsvn_client/client.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1095130&r1=1095129&r2=1095130&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Tue Apr 19 16:46:51 2011
@@ -909,9 +909,8 @@ svn_client__do_commit(const char *base_u
/* Handle changes to the svn:externals property described by EXTERNALS_OLD,
EXTERNALS_NEW, and AMBIENT_DEPTHS. The tree's top level directory
- is at TO_ABSPATH and corresponds to FROM_URL URL in the repository,
- which has a root URL of REPOS_ROOT_URL. A write lock should be
- held.
+ is at TO_ABSPATH which has a root URL of REPOS_ROOT_URL (optional).
+ A write lock should be held.
For each changed value of the property, discover the nature of the
change and behave appropriately -- either check a new "external"
@@ -931,10 +930,6 @@ svn_client__do_commit(const char *base_u
Pass NOTIFY_FUNC with NOTIFY_BATON along to svn_client_checkout().
- ### todo: AUTH_BATON may not be so useful. It's almost like we
- need access to the original auth-obtaining callbacks that
- produced auth baton in the first place. Hmmm. ###
-
*TIMESTAMP_SLEEP will be set TRUE if a sleep is required to ensure
timestamp integrity, *TIMESTAMP_SLEEP will be unchanged if no sleep
is required.
@@ -1012,24 +1007,6 @@ svn_client__crawl_for_externals(apr_hash
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
-/* Helper function to fix issue #2267,
- * "support svn:externals on locally added directories".
- *
- * Crawl all externals beneath ANCHOR_ABSPATH (this is cheap because we're
- * only crawling the WC DB itself). If there are externals within the
- * REQUESTED_DEPTH that weren't already picked up while we were crawling
- * the BASE tree, add them to the EXTERNALS_NEW hash with ambient depth
- * infinity. Facilitates populating externals in locally added directories.
- *
- * ### This is a bit of a hack. We should try to find a better solution
- * ### to this problem. */
-svn_error_t *
-svn_client__gather_externals_in_locally_added_dirs(apr_hash_t *externals_new,
- apr_hash_t *ambient_depths,
- const char *anchor_abspath,
- svn_depth_t requested_depth,
- svn_client_ctx_t *ctx,
- apr_pool_t *scratch_pool);
/* Baton type for svn_wc__external_info_gatherer(). */
typedef struct svn_client__external_func_baton_t
Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1095130&r1=1095129&r2=1095130&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Tue Apr 19 16:46:51
2011
@@ -1457,45 +1457,3 @@ svn_client__crawl_for_externals(apr_hash
*externals_p = externals_hash;
return SVN_NO_ERROR;
}
-
-svn_error_t *
-svn_client__gather_externals_in_locally_added_dirs(apr_hash_t *externals_new,
- apr_hash_t *ambient_depths,
- const char *anchor_abspath,
- svn_depth_t requested_depth,
- svn_client_ctx_t *ctx,
- apr_pool_t *scratch_pool)
-{
- apr_hash_t *all_externals;
- apr_hash_index_t *hi;
-
- /* If there was no requested depth for this operation, use infinity.
- * svn_client__crawl_for_externals() doesn't like depth 'unknown'. */
- if (requested_depth == svn_depth_unknown)
- requested_depth = svn_depth_infinity;
-
- SVN_ERR(svn_client__crawl_for_externals(&all_externals, anchor_abspath,
- requested_depth, ctx, scratch_pool,
- scratch_pool));
-
- for (hi = apr_hash_first(scratch_pool, all_externals);
- hi;
- hi = apr_hash_next(hi))
- {
- const char *local_abspath = svn__apr_hash_index_key(hi);
-
- if (! apr_hash_get(externals_new, local_abspath, APR_HASH_KEY_STRING))
- {
- apr_pool_t *hash_pool = apr_hash_pool_get(externals_new);
- svn_string_t *propval = svn__apr_hash_index_val(hi);
-
- apr_hash_set(externals_new, local_abspath, APR_HASH_KEY_STRING,
- apr_pstrdup(hash_pool, propval->data));
- apr_hash_set(ambient_depths, local_abspath, APR_HASH_KEY_STRING,
- svn_depth_to_word(svn_depth_infinity));
- }
- }
-
- return SVN_NO_ERROR;
-}
-
Modified: subversion/trunk/subversion/libsvn_client/switch.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/switch.c?rev=1095130&r1=1095129&r2=1095130&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/switch.c (original)
+++ subversion/trunk/subversion/libsvn_client/switch.c Tue Apr 19 16:46:51 2011
@@ -264,9 +264,6 @@ switch_internal(svn_revnum_t *result_rev
the primary operation. */
if (SVN_DEPTH_IS_RECURSIVE(depth) && (! ignore_externals))
{
- SVN_ERR(svn_client__gather_externals_in_locally_added_dirs(
- efb.externals_new, efb.ambient_depths, local_abspath,
- depth, ctx, pool));
err = svn_client__handle_externals(efb.externals_old,
efb.externals_new, efb.ambient_depths,
svn_dirent_join(anchor_abspath,
Modified: subversion/trunk/subversion/libsvn_client/update.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=1095130&r1=1095129&r2=1095130&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Tue Apr 19 16:46:51 2011
@@ -281,9 +281,6 @@ update_internal(svn_revnum_t *result_rev
the primary operation. */
if (SVN_DEPTH_IS_RECURSIVE(depth) && (! ignore_externals))
{
- SVN_ERR(svn_client__gather_externals_in_locally_added_dirs(
- efb.externals_new, efb.ambient_depths, anchor_abspath,
- depth, ctx, pool));
SVN_ERR(svn_client__handle_externals(efb.externals_old,
efb.externals_new,
efb.ambient_depths,
Modified: subversion/trunk/subversion/libsvn_wc/adm_crawler.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_crawler.c?rev=1095130&r1=1095129&r2=1095130&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_crawler.c Tue Apr 19 16:46:51 2011
@@ -213,8 +213,8 @@ read_externals_info(svn_wc__db_t *db,
/* Directly use a DB api here as this code path is extensively used on
update. On top of that we already know that this an existing directory. */
- SVN_ERR(svn_wc__db_read_props(&props, db, local_abspath,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__db_base_get_props(&props, db, local_abspath,
+ scratch_pool, scratch_pool));
if (!props)
return SVN_NO_ERROR;
@@ -332,7 +332,7 @@ report_revisions_and_depths(svn_wc__db_t
/* If "this dir" has "svn:externals" property set on it,
* call the external_func callback. */
- if (external_func)
+ if (external_func && had_props)
SVN_ERR(read_externals_info(db, dir_abspath, external_func,
external_baton, dir_depth, iterpool));
Modified: subversion/trunk/subversion/tests/cmdline/externals_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/externals_tests.py?rev=1095130&r1=1095129&r2=1095130&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/externals_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/externals_tests.py Tue Apr 19
16:46:51 2011
@@ -615,7 +615,7 @@ def modify_and_update_receive_new_extern
"exdir_Z " + external_url_for["A/D/exdir_A/H"] + \
"\n"
- change_external(B_path, externals_desc, commit=False)
+ change_external(B_path, externals_desc)
# Now cd into A/B and try updating
was_cwd = os.getcwd()
@@ -1273,7 +1273,7 @@ def switch_relative_external(sbox):
# Okay. We now want to switch A to A_copy, which *should* cause
# A/D/ext to point to the URL for A_copy/B (instead of A/B).
svntest.actions.run_and_verify_svn(None, None, [], 'sw',
- '--quiet', A_copy_url, A_path)
+ A_copy_url, A_path)
expected_infos = [
{ 'Path' : re.escape(D_path),
@@ -1347,7 +1347,7 @@ def relegate_external(sbox):
# point external to the other repository
externals_desc = other_repo_url + '/A/B/E external\n'
- change_external(A_path, externals_desc, commit=False)
+ change_external(A_path, externals_desc)
# Update "relegates", i.e. throws-away and recreates, the external
expected_output = svntest.wc.State(wc_dir, {
@@ -1362,8 +1362,7 @@ def relegate_external(sbox):
'A/external/alpha' : Item('This is the file \'alpha\'.\n'),
'A/external/beta' : Item('This is the file \'beta\'.\n'),
})
- expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
- expected_status.tweak('A', status=' M')
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
@@ -1371,9 +1370,6 @@ def relegate_external(sbox):
None, None, None, None, None,
True)
- ### TODO: Commit the propset and update a pristine working copy from
- ### r2 to r3.
-
#----------------------------------------------------------------------
# Issue #3552
@@ -1581,95 +1577,6 @@ def update_modify_file_external(sbox):
None, None, None, None, None,
True)
-# Test for issue #2267
-@Issue(2267)
-def update_external_on_locally_added_dir(sbox):
- "update an external on a locally added dir"
-
- external_url_for = externals_test_setup(sbox)
- wc_dir = sbox.wc_dir
-
- repo_url = sbox.repo_url
- other_repo_url = repo_url + ".other"
-
- # Checkout a working copy
- svntest.actions.run_and_verify_svn(None, None, [],
- 'checkout',
- repo_url, wc_dir)
-
- # Add one new external item to the property on A/foo. The new item is
- # "exdir_E", deliberately added in the middle not at the end.
- new_externals_desc = \
- external_url_for["A/D/exdir_A"] + " exdir_A" + \
- "\n" + \
- external_url_for["A/D/exdir_A/G/"] + " exdir_A/G/" + \
- "\n" + \
- "exdir_E " + other_repo_url + "/A/B/E" + \
- "\n" + \
- "exdir_A/H -r 1 " + external_url_for["A/D/exdir_A/H"] + \
- "\n" + \
- external_url_for["A/D/x/y/z/blah"] + " x/y/z/blah" + \
- "\n"
-
- # Add A/foo and set the property on it
- new_dir = sbox.ospath("A/foo")
- sbox.simple_mkdir("A/foo")
- change_external(new_dir, new_externals_desc, commit=False)
-
- # Update the working copy, see if we get the new item.
- svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
-
- probe_paths_exist([os.path.join(wc_dir, "A", "foo", "exdir_E")])
-
-# Test for issue #2267
-@Issue(2267)
-def switch_external_on_locally_added_dir(sbox):
- "switch an external on a locally added dir"
-
- external_url_for = externals_test_setup(sbox)
- wc_dir = sbox.wc_dir
-
- repo_url = sbox.repo_url
- other_repo_url = repo_url + ".other"
- A_path = repo_url + "/A"
- A_copy_path = repo_url + "/A_copy"
-
- # Create a branch of A
- # Checkout a working copy
- svntest.actions.run_and_verify_svn(None, None, [],
- 'copy',
- A_path, A_copy_path,
- '-m', 'Create branch of A')
-
- # Checkout a working copy
- svntest.actions.run_and_verify_svn(None, None, [],
- 'checkout',
- A_path, wc_dir)
-
- # Add one new external item to the property on A/foo. The new item is
- # "exdir_E", deliberately added in the middle not at the end.
- new_externals_desc = \
- external_url_for["A/D/exdir_A"] + " exdir_A" + \
- "\n" + \
- external_url_for["A/D/exdir_A/G/"] + " exdir_A/G/" + \
- "\n" + \
- "exdir_E " + other_repo_url + "/A/B/E" + \
- "\n" + \
- "exdir_A/H -r 1 " + external_url_for["A/D/exdir_A/H"] + \
- "\n" + \
- external_url_for["A/D/x/y/z/blah"] + " x/y/z/blah" + \
- "\n"
-
- # Add A/foo and set the property on it
- new_dir = sbox.ospath("foo")
- sbox.simple_mkdir("foo")
- change_external(new_dir, new_externals_desc, commit=False)
-
- # Switch the working copy to the branch, see if we get the new item.
- svntest.actions.run_and_verify_svn(None, None, [], 'sw', A_copy_path, wc_dir)
-
- probe_paths_exist([os.path.join(wc_dir, "foo", "exdir_E")])
-
@Issue(3819)
def file_external_in_sibling(sbox):
"update a file external in sibling dir"
@@ -1733,8 +1640,6 @@ test_list = [ None,
wc_repos_file_externals,
merge_target_with_externals,
update_modify_file_external,
- update_external_on_locally_added_dir,
- switch_external_on_locally_added_dir,
file_external_in_sibling,
file_external_update_without_commit,
]