Author: rhuijben
Date: Mon Apr 11 19:58:27 2011
New Revision: 1091187
URL: http://svn.apache.org/viewvc?rev=1091187&view=rev
Log:
Update the svn_wc_get_update_editor3() and svn_wc_get_switch_editor3() apis
to accept two new booleans: One to allow disabling the automatic conversion
of local additions into modifications and one to allow disabling the depth
filter (Which is only needed when talking to pre 1.5 servers).
Disabling the depth filter allows avoiding many db operations (should be set by
libsvn_client when it knows the server understands depth), while the local
additions filter is for clients that prefer to explicitly handle tree
conflicts over the update editor magic.
* subversion/include/svn_wc.h
(svn_wc_get_update_editor4): Update prototype and documentation
(svn_wc_get_update_editor3): Update documentation.
(svn_wc_get_update_switch4): Update prototype and documentation
(svn_wc_get_update_switch3): Update documentation.
* subversion/libsvn_client/switch.c
(switch_internal): Update caller. Report that the server handles depth when
depth is unknown.
* subversion/libsvn_client/update.c
(update_internal): Update caller. Report that the server handles depth when
depth is unknown.
* subversion/libsvn_wc/deprecated.c
(svn_wc_get_update_editor3,
svn_wc_get_switch_editor3): Update callers.
* subversion/libsvn_wc/update_editor.c
(edit_baton): Add field.
(add_directory, add_file): Disable the local addition exception
when !adds_as_modification.
(make_editor): Add two arguments and handle server_performs_filtering.
(svn_wc_get_update_editor4): Pass arguments.
(svn_wc_get_update_switch4): Pass arguments.
Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/switch.c
subversion/trunk/subversion/libsvn_client/update.c
subversion/trunk/subversion/libsvn_wc/deprecated.c
subversion/trunk/subversion/libsvn_wc/update_editor.c
Modified: subversion/trunk/subversion/include/svn_wc.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1091187&r1=1091186&r2=1091187&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Mon Apr 11 19:58:27 2011
@@ -5302,6 +5302,9 @@ typedef svn_error_t *(*svn_wc_get_file_t
* If @a allow_unver_obstructions is TRUE, then allow unversioned
* obstructions when adding a path.
*
+ * If @a adds_as_modification is TRUE, local additions are seen as a local
+ * modification of added nodes when the node kind matches.
+ *
* If @a depth is #svn_depth_infinity, update fully recursively.
* Else if it is #svn_depth_immediates, update the uppermost
* directory, its file entries, and the presence or absence of
@@ -5315,6 +5318,10 @@ typedef svn_error_t *(*svn_wc_get_file_t
* #svn_depth_unknown, then in addition to updating PATHS, also set
* their sticky ambient depth value to @a depth.
*
+ * If @a repository_performs_filtering is TRUE, assume that the server handles
+ * the ambient depth filtering, so this doesn't have to be handled in the
+ * editor.
+ *
* @since New in 1.7.
*/
svn_error_t *
@@ -5328,6 +5335,8 @@ svn_wc_get_update_editor4(const svn_delt
svn_depth_t depth,
svn_boolean_t depth_is_sticky,
svn_boolean_t allow_unver_obstructions,
+ svn_boolean_t adds_as_modification,
+ svn_boolean_t server_performs_filtering,
const char *diff3_cmd,
const apr_array_header_t *preserved_exts,
svn_wc_conflict_resolver_func_t conflict_func,
@@ -5344,7 +5353,8 @@ svn_wc_get_update_editor4(const svn_delt
/** Similar to svn_wc_get_update_editor4, but uses access batons and relative
* path instead of a working copy context-abspath pair and
* svn_wc_traversal_info_t instead of an externals callback. Also,
- * @a fetch_func and @a fetch_baton are ignored.
+ * @a fetch_func and @a fetch_baton are ignored. Always sets
+ * server_performs_filtering to FALSE.
*
* If @a ti is non-NULL, record traversal info in @a ti, for use by
* post-traversal accessors such as svn_wc_edited_externals().
@@ -5352,6 +5362,9 @@ svn_wc_get_update_editor4(const svn_delt
* All locks, both those in @a anchor and newly acquired ones, will be
* released when the editor driver calls @c close_edit.
*
+ * Always sets @a adds_as_modification to TRUE and @a server_performs_filtering
+ * to FALSE.
+ *
* @since New in 1.5.
* @deprecated Provided for backward compatibility with the 1.6 API.
*/
@@ -5454,6 +5467,8 @@ svn_wc_get_switch_editor4(const svn_delt
svn_depth_t depth,
svn_boolean_t depth_is_sticky,
svn_boolean_t allow_unver_obstructions,
+ svn_boolean_t adds_as_modification,
+ svn_boolean_t server_performs_filtering,
const char *diff3_cmd,
const apr_array_header_t *preserved_exts,
svn_wc_conflict_resolver_func_t conflict_func,
@@ -5477,6 +5492,9 @@ svn_wc_get_switch_editor4(const svn_delt
* All locks, both those in @a anchor and newly acquired ones, will be
* released when the editor driver calls @c close_edit.
*
+ * Always sets @a adds_as_modification to TRUE and @a server_performs_filtering
+ * to FALSE.
+ *
* @since New in 1.5.
* @deprecated Provided for backward compatibility with the 1.6 API.
*/
Modified: subversion/trunk/subversion/libsvn_client/switch.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/switch.c?rev=1091187&r1=1091186&r2=1091187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/switch.c (original)
+++ subversion/trunk/subversion/libsvn_client/switch.c Mon Apr 11 19:58:27 2011
@@ -209,11 +209,18 @@ switch_internal(svn_revnum_t *result_rev
efb.externals_old = apr_hash_make(pool);
efb.ambient_depths = apr_hash_make(pool);
efb.result_pool = pool;
+
+ SVN_ERR(svn_ra_has_capability(ra_session, &server_supports_depth,
+ SVN_RA_CAPABILITY_DEPTH, pool));
+
SVN_ERR(svn_wc_get_switch_editor4(&switch_editor, &switch_edit_baton,
&revnum, ctx->wc_ctx, anchor_abspath,
target, switch_rev_url, use_commit_times,
depth,
depth_is_sticky, allow_unver_obstructions,
+ TRUE,
+ server_supports_depth
+ && (depth == svn_depth_unknown),
diff3_cmd, preserved_exts,
ctx->conflict_func, ctx->conflict_baton,
svn_client__external_info_gatherer, &efb,
@@ -227,9 +234,6 @@ switch_internal(svn_revnum_t *result_rev
target, depth, switch_rev_url,
switch_editor, switch_edit_baton, pool));
- SVN_ERR(svn_ra_has_capability(ra_session, &server_supports_depth,
- SVN_RA_CAPABILITY_DEPTH, pool));
-
/* Drive the reporter structure, describing the revisions within
PATH. When we call reporter->finish_report, the update_editor
will be driven by svn_repos_dir_delta2.
Modified: subversion/trunk/subversion/libsvn_client/update.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=1091187&r1=1091186&r2=1091187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Mon Apr 11 19:58:27 2011
@@ -224,12 +224,18 @@ update_internal(svn_revnum_t *result_rev
efb.ambient_depths = apr_hash_make(pool);
efb.result_pool = pool;
+ SVN_ERR(svn_ra_has_capability(ra_session, &server_supports_depth,
+ SVN_RA_CAPABILITY_DEPTH, pool));
+
/* Fetch the update editor. If REVISION is invalid, that's okay;
the RA driver will call editor->set_target_revision later on. */
SVN_ERR(svn_wc_get_update_editor4(&update_editor, &update_edit_baton,
&revnum, ctx->wc_ctx, anchor_abspath,
target, use_commit_times, depth,
depth_is_sticky, allow_unver_obstructions,
+ TRUE,
+ server_supports_depth
+ && (depth == svn_depth_unknown),
diff3_cmd, preserved_exts,
ctx->conflict_func, ctx->conflict_baton,
ignore_externals
@@ -246,9 +252,6 @@ update_internal(svn_revnum_t *result_rev
revnum, target, depth, FALSE,
update_editor, update_edit_baton, pool));
- SVN_ERR(svn_ra_has_capability(ra_session, &server_supports_depth,
- SVN_RA_CAPABILITY_DEPTH, pool));
-
/* Drive the reporter structure, describing the revisions within
PATH. When we call reporter->finish_report, the
update_editor will be driven by svn_repos_dir_delta2. */
Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1091187&r1=1091186&r2=1091187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Mon Apr 11 19:58:27 2011
@@ -2950,6 +2950,8 @@ svn_wc_get_update_editor3(svn_revnum_t *
use_commit_times,
depth, depth_is_sticky,
allow_unver_obstructions,
+ TRUE /* adds_as_modification */,
+ FALSE /* server_performs_filtering */,
diff3_cmd,
preserved_exts,
conflict_func, conflict_baton,
@@ -3066,6 +3068,8 @@ svn_wc_get_switch_editor3(svn_revnum_t *
use_commit_times,
depth, depth_is_sticky,
allow_unver_obstructions,
+ TRUE /* adds_as_modification */,
+ FALSE /* server_performs_filtering */,
diff3_cmd,
preserved_exts,
conflict_func, conflict_baton,
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1091187&r1=1091186&r2=1091187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Mon Apr 11 19:58:27
2011
@@ -190,6 +190,9 @@ struct edit_baton
/* Allow unversioned obstructions when adding a path. */
svn_boolean_t allow_unver_obstructions;
+ /* Handle local additions as modifications of new nodes */
+ svn_boolean_t adds_as_modification;
+
/* If this is a 'switch' operation, the new relpath of target_abspath,
else NULL. */
const char *switch_relpath;
@@ -2168,7 +2171,8 @@ add_directory(const char *path,
* local add. So switch always alerts the user with a tree conflict. */
if (eb->switch_relpath != NULL
|| local_is_non_dir
- || add_status != svn_wc__db_status_added)
+ || add_status != svn_wc__db_status_added
+ || !eb->adds_as_modification)
{
SVN_ERR(check_tree_conflict(&tree_conflict, eb,
db->local_abspath,
@@ -3021,7 +3025,8 @@ add_file(const char *path,
* local add. So switch always alerts the user with a tree conflict. */
if (eb->switch_relpath != NULL
|| !local_is_file
- || status != svn_wc__db_status_added)
+ || status != svn_wc__db_status_added
+ || !eb->adds_as_modification)
{
SVN_ERR(check_tree_conflict(&tree_conflict, eb,
fb->local_abspath,
@@ -4246,6 +4251,8 @@ make_editor(svn_revnum_t *target_revisio
svn_depth_t depth,
svn_boolean_t depth_is_sticky,
svn_boolean_t allow_unver_obstructions,
+ svn_boolean_t adds_as_modification,
+ svn_boolean_t server_performs_filtering,
svn_wc_notify_func2_t notify_func,
void *notify_baton,
svn_cancel_func_t cancel_func,
@@ -4336,6 +4343,7 @@ make_editor(svn_revnum_t *target_revisio
eb->conflict_func = conflict_func;
eb->conflict_baton = conflict_baton;
eb->allow_unver_obstructions = allow_unver_obstructions;
+ eb->adds_as_modification = adds_as_modification;
eb->skipped_trees = apr_hash_make(edit_pool);
eb->ext_patterns = preserved_exts;
@@ -4368,9 +4376,9 @@ make_editor(svn_revnum_t *target_revisio
But even what we do so might extend beyond the scope of our
ambient depth. So we use another filtering editor to avoid
modifying the ambient working copy depth when not asked to do so.
- (This can also be skipped if the server understands depth; consider
- letting the depth RA capability percolate down to this level.) */
- if (!depth_is_sticky)
+ (This can also be skipped if the server understands depth.) */
+ if (!server_performs_filtering
+ && !depth_is_sticky)
SVN_ERR(svn_wc__ambient_depth_filter_editor(&inner_editor,
&inner_baton,
wc_ctx->db,
@@ -4402,6 +4410,8 @@ svn_wc_get_update_editor4(const svn_delt
svn_depth_t depth,
svn_boolean_t depth_is_sticky,
svn_boolean_t allow_unver_obstructions,
+ svn_boolean_t adds_as_modification,
+ svn_boolean_t server_performs_filtering,
const char *diff3_cmd,
const apr_array_header_t *preserved_exts,
svn_wc_conflict_resolver_func_t conflict_func,
@@ -4418,6 +4428,7 @@ svn_wc_get_update_editor4(const svn_delt
return make_editor(target_revision, wc_ctx, anchor_abspath,
target_basename, use_commit_times,
NULL, depth, depth_is_sticky, allow_unver_obstructions,
+ adds_as_modification, server_performs_filtering,
notify_func, notify_baton,
cancel_func, cancel_baton,
conflict_func, conflict_baton,
@@ -4438,6 +4449,8 @@ svn_wc_get_switch_editor4(const svn_delt
svn_depth_t depth,
svn_boolean_t depth_is_sticky,
svn_boolean_t allow_unver_obstructions,
+ svn_boolean_t adds_as_modification,
+ svn_boolean_t server_performs_filtering,
const char *diff3_cmd,
const apr_array_header_t *preserved_exts,
svn_wc_conflict_resolver_func_t conflict_func,
@@ -4457,6 +4470,7 @@ svn_wc_get_switch_editor4(const svn_delt
target_basename, use_commit_times,
switch_url,
depth, depth_is_sticky, allow_unver_obstructions,
+ adds_as_modification, server_performs_filtering,
notify_func, notify_baton,
cancel_func, cancel_baton,
conflict_func, conflict_baton,