You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/05/21 16:53:08 UTC
svn commit: r1596591 - in /subversion/trunk/subversion:
libsvn_wc/update_editor.c tests/cmdline/switch_tests.py
Author: stsp
Date: Wed May 21 14:53:07 2014
New Revision: 1596591
URL: http://svn.apache.org/r1596591
Log:
Fix issue #1975, "svn switch does not update keywords".
* subversion/libsvn_wc/update_editor.c
(update_keywords_after_switch_cb): New helper function
which checks for the presence of an svn:keywords property
and queues an install_file work queue item if present.
Thus, when the work queue is run to complete the switch
operation, all files with keywords will go through the
translation process.
(close_edit): If this is a switch operation, run a recursive
proplist with the specified depth (infinity by default),
invocing update_keywords_after_switch_cb() for each node
with properties.
* subversion/tests/cmdline/switch_tests.py
(switch_keywords, test_list): New test. Fails without
the above change and passes with it.
Modified:
subversion/trunk/subversion/libsvn_wc/update_editor.c
subversion/trunk/subversion/tests/cmdline/switch_tests.py
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1596591&r1=1596590&r2=1596591&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Wed May 21 14:53:07 2014
@@ -4691,6 +4691,33 @@ close_file(void *file_baton,
}
+/* Implements svn_wc__proplist_receiver_t. */
+static svn_error_t *
+update_keywords_after_switch_cb(void *baton,
+ const char *local_abspath,
+ apr_hash_t *props,
+ apr_pool_t *scratch_pool)
+{
+ struct edit_baton *eb = baton;
+ svn_string_t *propval;
+ svn_skel_t *work_item;
+
+ propval = svn_hash_gets(props, SVN_PROP_KEYWORDS);
+ if (!propval)
+ return SVN_NO_ERROR;
+
+ SVN_ERR(svn_wc__wq_build_file_install(&work_item, eb->db,
+ local_abspath, NULL,
+ eb->use_commit_times,
+ TRUE, scratch_pool,
+ scratch_pool));
+ SVN_ERR(svn_wc__db_wq_add(eb->db, local_abspath, work_item,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+
/* An svn_delta_editor_t function. */
static svn_error_t *
close_edit(void *edit_baton,
@@ -4787,6 +4814,27 @@ close_edit(void *edit_baton,
}
}
+ /* Update keywords in switched files.
+ GOTO #1975 (the year of the Altair 8800). */
+ if (eb->switch_repos_relpath)
+ {
+ svn_depth_t depth;
+
+ depth = (eb->requested_depth == svn_depth_unknown
+ ? svn_depth_infinity
+ : eb->requested_depth);
+ SVN_ERR(svn_wc__db_read_props_streamily(eb->db,
+ eb->target_abspath,
+ depth,
+ FALSE, /* pristine */
+ NULL, /* changelists */
+ update_keywords_after_switch_cb,
+ eb,
+ eb->cancel_func,
+ eb->cancel_baton,
+ scratch_pool));
+ }
+
/* The edit is over: run the wq with proper cancel support,
but first kill the handler that would run it on the pool
cleanup at the end of this function. */
Modified: subversion/trunk/subversion/tests/cmdline/switch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/switch_tests.py?rev=1596591&r1=1596590&r2=1596591&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/switch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/switch_tests.py Wed May 21 14:53:07 2014
@@ -2766,6 +2766,49 @@ def switch_across_replacement(sbox):
None, None, None, None, None, False,
'-r1')
+@Issue(1975)
+def switch_keywords(sbox):
+ "switch and svn:keywords"
+ sbox.build()
+ gamma_path = sbox.ospath('A/D/gamma')
+
+ sbox.simple_propset('svn:keywords', 'URL', 'A/D/gamma')
+ svntest.main.file_write(gamma_path, "$URL$\n")
+ sbox.simple_commit()
+
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.tweak('A/D/gamma',
+ contents="$URL: %s/A/D/gamma $\n" % sbox.repo_url)
+
+ svntest.actions.run_and_verify_update(sbox.wc_dir,
+ None, expected_disk,
+ None, None, None, None, None, None)
+ sbox.simple_copy('A', 'A_copy')
+ sbox.simple_commit()
+
+ expected_disk.add({
+ 'A_copy/D/H/chi' : Item(contents="This is the file 'chi'.\n"),
+ 'A_copy/D/H/psi' : Item(contents="This is the file 'psi'.\n"),
+ 'A_copy/D/H/omega' : Item(contents="This is the file 'omega'.\n"),
+ 'A_copy/D/G/pi' : Item(contents="This is the file 'pi'.\n"),
+ 'A_copy/D/G/tau' : Item(contents="This is the file 'tau'.\n"),
+ 'A_copy/D/G/rho' : Item(contents="This is the file 'rho'.\n"),
+ 'A_copy/D/gamma' : Item(contents="$URL: %s/A_copy/D/gamma $\n"
+ % sbox.repo_url),
+ 'A_copy/B/F' : Item(),
+ 'A_copy/B/E/alpha' : Item(contents="This is the file 'alpha'.\n"),
+ 'A_copy/B/E/beta' : Item(contents="This is the file 'beta'.\n"),
+ 'A_copy/B/lambda' : Item(contents="This is the file 'lambda'.\n"),
+ 'A_copy/mu' : Item(contents="This is the file 'mu'.\n"),
+ 'A_copy/C' : Item(),
+ })
+ expected_disk.tweak('A/D/gamma',
+ contents="$URL: %s/A_copy/D/gamma $\n" % sbox.repo_url)
+
+ svntest.actions.run_and_verify_switch(sbox.wc_dir, sbox.ospath('A'), '^/A_copy',
+ None, expected_disk, None,
+ None, None, None, None, None)
+
########################################################################
# Run the tests
@@ -2808,6 +2851,7 @@ test_list = [ None,
different_node_kind,
switch_to_spaces,
switch_across_replacement,
+ switch_keywords,
]
if __name__ == '__main__':