Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D56B7116E9 for ; Wed, 10 Sep 2014 16:21:16 +0000 (UTC) Received: (qmail 81863 invoked by uid 500); 10 Sep 2014 16:21:16 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 81833 invoked by uid 500); 10 Sep 2014 16:21:16 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 81823 invoked by uid 99); 10 Sep 2014 16:21:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Sep 2014 16:21:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Sep 2014 16:21:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D5ACE23888FE; Wed, 10 Sep 2014 16:20:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1624054 - in /subversion/branches/move-tracking-2/subversion: include/private/ libsvn_client/ libsvn_delta/ libsvn_ra/ libsvn_ra_local/ libsvn_ra_serf/ libsvn_ra_svn/ libsvn_wc/ Date: Wed, 10 Sep 2014 16:20:52 -0000 To: commits@subversion.apache.org From: julianfoad@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140910162052.D5ACE23888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: julianfoad Date: Wed Sep 10 16:20:51 2014 New Revision: 1624054 URL: http://svn.apache.org/r1624054 Log: On the 'move-tracking-2' branch: Implement update-editor shims, but don't yet try to use them. * subversion/include/private/svn_editor3.h (svn_editor3__set_target_revision_func_t, svn_update_editor3_t, svn_delta__ev3_from_delta_for_update, svn_delta__delta_from_ev3_for_update): New. * subversion/include/private/svn_ra_private.h (svn_ra_do_update4, svn_ra_do_switch4): New. * subversion/include/private/svn_wc_private.h (svn_wc__get_update_editor_ev3, svn_wc__get_switch_editor_ev3): New. * subversion/libsvn_client/switch.c (switch_internal): Implement use of Ev3 switch editor, but ifdef'd out as some tests fail. * subversion/libsvn_client/update.c (update_internal): Implement use of Ev3 update editor, but ifdef'd out as some tests fail. * subversion/libsvn_delta/compat3.c (svn_delta__delta_from_ev3_for_update, svn_delta__ev3_from_delta_for_update): New. * subversion/libsvn_ra_local/ra_plugin.c (fetch_baton_t, fetch_func, svn_ra_local__do_update_ev3, svn_ra_local__do_switch_ev3): New. (ra_local_vtable): Add the two new methods. * subversion/libsvn_ra/ra_loader.c (svn_ra_do_update4, svn_ra_do_switch4): New, simple wrappers calling the new vtable methods. * subversion/libsvn_ra/ra_loader.h (svn_ra__vtable_t): Add the two new methods. * subversion/libsvn_ra_serf/serf.c (serf_vtable): Add place-holder null entries for the two new methods; no fall-back is implemented for this RA layer yet. * subversion/libsvn_ra_svn/client.c (ra_svn_vtable): Same. * subversion/libsvn_wc/deprecated.c (svn_wc_get_update_editor4): Wrap the new Ev3 implementation, inserting an Ev1/Ev3 shim. * subversion/libsvn_wc/update_editor.c (make_editor3, svn_wc__get_update_editor_ev3, svn_wc__get_switch_editor_ev3): New. (svn_wc__get_switch_editor): Add backward compatibility code, wrapping the new make_editor3(), but ifdef'd out. * subversion/libsvn_wc/util.c (svn_wc__fetch_func): New. * subversion/libsvn_wc/wc.h (svn_wc__shim_fetch_baton_t): Add a member and a comment. (svn_wc__fetch_func): Declare. Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h subversion/branches/move-tracking-2/subversion/include/private/svn_ra_private.h subversion/branches/move-tracking-2/subversion/include/private/svn_wc_private.h subversion/branches/move-tracking-2/subversion/libsvn_client/switch.c subversion/branches/move-tracking-2/subversion/libsvn_client/update.c subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.h subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/serf.c subversion/branches/move-tracking-2/subversion/libsvn_ra_svn/client.c subversion/branches/move-tracking-2/subversion/libsvn_wc/deprecated.c subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c subversion/branches/move-tracking-2/subversion/libsvn_wc/util.c subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h (original) +++ subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h Wed Sep 10 16:20:51 2014 @@ -1571,6 +1571,60 @@ svn_editor3__insert_shims( apr_pool_t *result_pool, apr_pool_t *scratch_pool); +/* A callback for declaring the target revision of an update or switch. + */ +typedef svn_error_t *(*svn_editor3__set_target_revision_func_t)( + void *baton, + svn_revnum_t target_revision, + apr_pool_t *scratch_pool); + +/* An update (or switch) editor. + * + * This consists of a plain Ev3 editor and the additional methods or + * resources needed for use as an update or switch editor. + */ +typedef struct svn_update_editor3_t { + /* The basic editor. */ + svn_editor3_t *editor; + + /* A method to communicate the target revision of the update (or switch), + * to be called before driving the editor. It has its own baton, rather + * than using the editor's baton, so that the editor can be replaced (by + * a wrapper editor, typically) without having to wrap this callback. */ + svn_editor3__set_target_revision_func_t set_target_revision_func; + void *set_target_revision_baton; +} svn_update_editor3_t; + +/* Like svn_delta__ev3_from_delta_for_commit() but for an update editor. + */ +svn_error_t * +svn_delta__ev3_from_delta_for_update( + svn_update_editor3_t **editor_p, + const svn_delta_editor_t *deditor, + void *dedit_baton, + const char *repos_root_url, + const char *base_repos_relpath, + svn_editor3__shim_fetch_func_t fetch_func, + void *fetch_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/* Like svn_delta__delta_from_ev3_for_commit() but for an update editor. + */ +svn_error_t * +svn_delta__delta_from_ev3_for_update( + const svn_delta_editor_t **deditor, + void **dedit_baton, + svn_update_editor3_t *update_editor, + const char *repos_root_url, + const char *base_repos_relpath, + svn_editor3__shim_fetch_func_t fetch_func, + void *fetch_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + #ifdef __cplusplus } Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_ra_private.h URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_ra_private.h?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/include/private/svn_ra_private.h (original) +++ subversion/branches/move-tracking-2/subversion/include/private/svn_ra_private.h Wed Sep 10 16:20:51 2014 @@ -281,6 +281,7 @@ svn_ra__replay_ev2(svn_ra_session_t *ses svn_editor_t *editor, apr_pool_t *scratch_pool); +/* Ev3 version of svn_ra_get_commit_editor(). */ svn_error_t * svn_ra_get_commit_editor_ev3(svn_ra_session_t *session, svn_editor3_t **editor, @@ -291,6 +292,35 @@ svn_ra_get_commit_editor_ev3(svn_ra_sess svn_boolean_t keep_locks, apr_pool_t *pool); +/* Ev3 version of svn_ra_do_update3(). */ +svn_error_t * +svn_ra_do_update4(svn_ra_session_t *session, + const svn_ra_reporter3_t **reporter, + void **report_baton, + svn_revnum_t revision_to_update_to, + const char *update_target, + svn_depth_t depth, + svn_boolean_t send_copyfrom_args, + svn_boolean_t ignore_ancestry, + svn_update_editor3_t *update_editor, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/* Ev3 version of svn_ra_do_switch3(). */ +svn_error_t * +svn_ra_do_switch4(svn_ra_session_t *session, + const svn_ra_reporter3_t **reporter, + void **report_baton, + svn_revnum_t revision_to_switch_to, + const char *switch_target, + svn_depth_t depth, + const char *switch_url, + svn_boolean_t send_copyfrom_args, + svn_boolean_t ignore_ancestry, + svn_update_editor3_t *switch_editor, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + #ifdef __cplusplus } Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_wc_private.h URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_wc_private.h?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/include/private/svn_wc_private.h (original) +++ subversion/branches/move-tracking-2/subversion/include/private/svn_wc_private.h Wed Sep 10 16:20:51 2014 @@ -40,6 +40,7 @@ #include "svn_types.h" #include "svn_wc.h" #include "private/svn_diff_tree.h" +#include "private/svn_editor3.h" #ifdef __cplusplus extern "C" { @@ -1439,6 +1440,34 @@ svn_wc__get_status_editor(const svn_delt * @since New in 1.8. */ svn_error_t * +svn_wc__get_update_editor_ev3(svn_update_editor3_t **update_editor, + svn_revnum_t *target_revision, + svn_wc_context_t *wc_ctx, + const char *anchor_abspath, + const char *target_basename, + apr_hash_t *wcroot_iprops, + svn_boolean_t use_commit_times, + 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_boolean_t clean_checkout, + const char *diff3_cmd, + const apr_array_header_t *preserved_exts, + svn_wc_dirents_func_t fetch_dirents_func, + void *fetch_dirents_baton, + svn_wc_conflict_resolver_func2_t conflict_func, + void *conflict_baton, + svn_wc_external_update_t external_func, + void *external_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + svn_wc_notify_func2_t notify_func, + void *notify_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); +svn_error_t * svn_wc__get_update_editor(const svn_delta_editor_t **editor, void **edit_baton, svn_revnum_t *target_revision, @@ -1482,6 +1511,33 @@ svn_wc__get_update_editor(const svn_delt * @since New in 1.8. */ svn_error_t * +svn_wc__get_switch_editor_ev3(svn_update_editor3_t **update_editor, + svn_revnum_t *target_revision, + svn_wc_context_t *wc_ctx, + const char *anchor_abspath, + const char *target_basename, + const char *switch_url, + apr_hash_t *wcroot_iprops, + svn_boolean_t use_commit_times, + svn_depth_t depth, + svn_boolean_t depth_is_sticky, + svn_boolean_t allow_unver_obstructions, + svn_boolean_t server_performs_filtering, + const char *diff3_cmd, + const apr_array_header_t *preserved_exts, + svn_wc_dirents_func_t fetch_dirents_func, + void *fetch_dirents_baton, + svn_wc_conflict_resolver_func2_t conflict_func, + void *conflict_baton, + svn_wc_external_update_t external_func, + void *external_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + svn_wc_notify_func2_t notify_func, + void *notify_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); +svn_error_t * svn_wc__get_switch_editor(const svn_delta_editor_t **editor, void **edit_baton, svn_revnum_t *target_revision, Modified: subversion/branches/move-tracking-2/subversion/libsvn_client/switch.c URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_client/switch.c?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_client/switch.c (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_client/switch.c Wed Sep 10 16:20:51 2014 @@ -39,6 +39,7 @@ #include "svn_private_config.h" #include "private/svn_wc_private.h" +#include "private/svn_ra_private.h" /*** Code. ***/ @@ -109,8 +110,12 @@ switch_internal(svn_revnum_t *result_rev apr_hash_t *wcroot_iprops; apr_array_header_t *inherited_props; svn_boolean_t use_commit_times; +#if 0 + svn_update_editor3_t *switch_editor; +#else const svn_delta_editor_t *switch_editor; void *switch_edit_baton; +#endif const char *preserved_exts_str; apr_array_header_t *preserved_exts; svn_boolean_t server_supports_depth; @@ -306,6 +311,42 @@ switch_internal(svn_revnum_t *result_rev dfb.anchor_url = anchor_url; dfb.target_revision = switch_loc->rev; +#if 0 + /* 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_switch_editor_ev3(&switch_editor, &revnum, + ctx->wc_ctx, anchor_abspath, target, + switch_loc->url, + wcroot_iprops, use_commit_times, + depth, depth_is_sticky, + allow_unver_obstructions, + server_supports_depth, + diff3_cmd, preserved_exts, + svn_client__dirent_fetcher, &dfb, + conflicted_paths ? record_conflict : NULL, + conflicted_paths, + NULL, NULL, + ctx->cancel_func, ctx->cancel_baton, + ctx->notify_func2, ctx->notify_baton2, + pool, pool)); + SVN_ERR(svn_editor3__get_debug_editor(&switch_editor->editor, + switch_editor->editor, + pool)); + + /* Tell RA to do an update of URL+TARGET to REVISION; if we pass an + invalid revnum, that means RA will use the latest revision. */ + SVN_ERR(svn_ra_do_switch4(ra_session, &reporter, &report_baton, + switch_loc->rev, + target, + (!server_supports_depth || depth_is_sticky + ? depth + : svn_depth_unknown), + switch_loc->url, + FALSE /* send_copyfrom_args */, + ignore_ancestry, + switch_editor, + pool, pool)); +#else SVN_ERR(svn_wc__get_switch_editor(&switch_editor, &switch_edit_baton, &revnum, ctx->wc_ctx, anchor_abspath, target, switch_loc->url, wcroot_iprops, @@ -332,6 +373,7 @@ switch_internal(svn_revnum_t *result_rev ignore_ancestry, switch_editor, switch_edit_baton, pool, pool)); +#endif /* Past this point, we assume the WC is going to be modified so we will * need to sleep for timestamps. */ Modified: subversion/branches/move-tracking-2/subversion/libsvn_client/update.c URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_client/update.c?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_client/update.c (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_client/update.c Wed Sep 10 16:20:51 2014 @@ -41,6 +41,7 @@ #include "svn_private_config.h" #include "private/svn_wc_private.h" +#include "private/svn_ra_private.h" /* Implements svn_wc_dirents_func_t for update and switch handling. Assumes a struct svn_client__dirent_fetcher_baton_t * baton */ @@ -218,8 +219,12 @@ update_internal(svn_revnum_t *result_rev svn_ra_session_t **ra_session_p, apr_pool_t *pool) { +#if 0 + svn_update_editor3_t *update_editor; +#else const svn_delta_editor_t *update_editor; void *update_edit_baton; +#endif const svn_ra_reporter3_t *reporter; void *report_baton; const char *corrected_url; @@ -456,6 +461,40 @@ update_internal(svn_revnum_t *result_rev revnum, depth, ra_session, ctx, pool, pool)); +#if 0 + /* 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_editor_ev3(&update_editor, + &revnum, ctx->wc_ctx, anchor_abspath, + target, wcroot_iprops, use_commit_times, + depth, depth_is_sticky, + allow_unver_obstructions, + adds_as_modification, + server_supports_depth, + clean_checkout, + diff3_cmd, preserved_exts, + svn_client__dirent_fetcher, &dfb, + conflicted_paths ? record_conflict : NULL, + conflicted_paths, + NULL, NULL, + ctx->cancel_func, ctx->cancel_baton, + ctx->notify_func2, ctx->notify_baton2, + pool, pool)); + SVN_ERR(svn_editor3__get_debug_editor(&update_editor->editor, + update_editor->editor, + pool)); + + /* Tell RA to do an update of URL+TARGET to REVISION; if we pass an + invalid revnum, that means RA will use the latest revision. */ + SVN_ERR(svn_ra_do_update4(ra_session, &reporter, &report_baton, + revnum, target, + (!server_supports_depth || depth_is_sticky + ? depth + : svn_depth_unknown), + FALSE /* send_copyfrom_args */, + FALSE /* ignore_ancestry */, + update_editor, pool, pool)); +#else /* 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_editor(&update_editor, &update_edit_baton, @@ -485,6 +524,7 @@ update_internal(svn_revnum_t *result_rev FALSE /* send_copyfrom_args */, FALSE /* ignore_ancestry */, update_editor, update_edit_baton, pool, pool)); +#endif /* Past this point, we assume the WC is going to be modified so we will * need to sleep for timestamps. */ Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c Wed Sep 10 16:20:51 2014 @@ -88,7 +88,7 @@ struct svn_editor3__shim_connector_t * Otherwise, default calls will be used. * * (Possibly more useful for update editors than for commit editors?) */ - svn_delta__target_revision_func_t target_revision_func; + svn_editor3__set_target_revision_func_t target_revision_func; /* If not null, a callback that the Ev3 driver may call to * provide the "base revision" of the root directory, even if it is not @@ -1594,6 +1594,41 @@ svn_delta__delta_from_ev3_for_commit( return SVN_NO_ERROR; } +svn_error_t * +svn_delta__delta_from_ev3_for_update( + const svn_delta_editor_t **deditor, + void **dedit_baton, + svn_update_editor3_t *update_editor, + const char *repos_root_url, + const char *base_repos_relpath, + svn_editor3__shim_fetch_func_t fetch_func, + void *fetch_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + svn_editor3__shim_connector_t *shim_connector + = apr_pcalloc(result_pool, sizeof(*shim_connector)); + + shim_connector->target_revision_func = update_editor->set_target_revision_func; + shim_connector->baton = update_editor->set_target_revision_baton; +#ifdef SHIM_WITH_ABS_PATHS + shim_connector->ev1_absolute_paths /*...*/; +#endif + + SVN_ERR(svn_delta__delta_from_ev3_for_commit( + deditor, dedit_baton, + update_editor->editor, + repos_root_url, base_repos_relpath, + fetch_func, fetch_baton, + shim_connector, + result_pool, scratch_pool)); + SVN_ERR(svn_delta__get_debug_editor(deditor, dedit_baton, + *deditor, *dedit_baton, + "[UP>1] ", result_pool)); + + return SVN_NO_ERROR; +} + /* * =================================================================== @@ -2533,3 +2568,49 @@ svn_delta__ev3_from_delta_for_commit( return SVN_NO_ERROR; } +svn_error_t * +svn_delta__ev3_from_delta_for_update( + svn_update_editor3_t **update_editor_p, + const svn_delta_editor_t *deditor, + void *dedit_baton, + const char *repos_root_url, + const char *base_repos_relpath, + svn_editor3__shim_fetch_func_t fetch_func, + void *fetch_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + svn_update_editor3_t *update_editor + = apr_pcalloc(result_pool, sizeof(*update_editor)); + svn_editor3__shim_connector_t *shim_connector; + + SVN_DBG(("svn_delta__ev3_from_delta_for_update(base='%s')...", + base_repos_relpath)); + + SVN_ERR(svn_delta__get_debug_editor(&deditor, &dedit_baton, + deditor, dedit_baton, + "[1>UP] ", result_pool)); + SVN_ERR(svn_delta__ev3_from_delta_for_commit( + &update_editor->editor, + &shim_connector, + deditor, dedit_baton, + repos_root_url, base_repos_relpath, + fetch_func, fetch_baton, + cancel_func, cancel_baton, + result_pool, scratch_pool)); + + update_editor->set_target_revision_func = shim_connector->target_revision_func; + update_editor->set_target_revision_baton = shim_connector->baton; + /* shim_connector->start_edit_func = open_root_ev3; */ +#ifdef SHIM_WITH_ABS_PATHS + update_editor->ev1_absolute_paths /*...*/; +#endif +#ifdef SHIM_WITH_UNLOCK + update_editor->unlock_func = do_unlock; +#endif + + *update_editor_p = update_editor; + return SVN_NO_ERROR; +} Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c Wed Sep 10 16:20:51 2014 @@ -951,6 +951,30 @@ svn_error_t *svn_ra_get_mergeinfo(svn_ra } svn_error_t * +svn_ra_do_update4(svn_ra_session_t *session, + const svn_ra_reporter3_t **reporter, + void **report_baton, + svn_revnum_t revision_to_update_to, + const char *update_target, + svn_depth_t depth, + svn_boolean_t send_copyfrom_args, + svn_boolean_t ignore_ancestry, + svn_update_editor3_t *update_editor, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + SVN_ERR_ASSERT(svn_path_is_empty(update_target) + || svn_path_is_single_path_component(update_target)); + return session->vtable->do_update3(session, + reporter, report_baton, + revision_to_update_to, update_target, + depth, send_copyfrom_args, + ignore_ancestry, + update_editor, + result_pool, scratch_pool); +} + +svn_error_t * svn_ra_do_update3(svn_ra_session_t *session, const svn_ra_reporter3_t **reporter, void **report_baton, @@ -976,6 +1000,33 @@ svn_ra_do_update3(svn_ra_session_t *sess } svn_error_t * +svn_ra_do_switch4(svn_ra_session_t *session, + const svn_ra_reporter3_t **reporter, + void **report_baton, + svn_revnum_t revision_to_switch_to, + const char *switch_target, + svn_depth_t depth, + const char *switch_url, + svn_boolean_t send_copyfrom_args, + svn_boolean_t ignore_ancestry, + svn_update_editor3_t *switch_editor, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + SVN_ERR_ASSERT(svn_path_is_empty(switch_target) + || svn_path_is_single_path_component(switch_target)); + SVN_ERR_ASSERT(svn_path_is_url(switch_url)); + return session->vtable->do_switch3(session, + reporter, report_baton, + revision_to_switch_to, switch_target, + depth, switch_url, + send_copyfrom_args, + ignore_ancestry, + switch_editor, + result_pool, scratch_pool); +} + +svn_error_t * svn_ra_do_switch3(svn_ra_session_t *session, const svn_ra_reporter3_t **reporter, void **report_baton, Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.h URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.h?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.h (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.h Wed Sep 10 16:20:51 2014 @@ -141,6 +141,18 @@ typedef struct svn_ra__vtable_t { svn_mergeinfo_inheritance_t inherit, svn_boolean_t include_merged_revisions, apr_pool_t *pool); + /* See svn_ra_do_update4(). */ + svn_error_t *(*do_update3)(svn_ra_session_t *session, + const svn_ra_reporter3_t **reporter, + void **report_baton, + svn_revnum_t revision_to_update_to, + const char *update_target, + svn_depth_t depth, + svn_boolean_t send_copyfrom_args, + svn_boolean_t ignore_ancestry, + svn_update_editor3_t *update_editor, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /* See svn_ra_do_update3(). */ svn_error_t *(*do_update)(svn_ra_session_t *session, const svn_ra_reporter3_t **reporter, @@ -154,6 +166,19 @@ typedef struct svn_ra__vtable_t { void *update_baton, apr_pool_t *result_pool, apr_pool_t *scratch_pool); + /* See svn_ra_do_switch4(). */ + svn_error_t *(*do_switch3)(svn_ra_session_t *session, + const svn_ra_reporter3_t **reporter, + void **report_baton, + svn_revnum_t revision_to_switch_to, + const char *switch_target, + svn_depth_t depth, + const char *switch_url, + svn_boolean_t send_copyfrom_args, + svn_boolean_t ignore_ancestry, + svn_update_editor3_t *switch_editor, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /* See svn_ra_do_switch3(). */ svn_error_t *(*do_switch)(svn_ra_session_t *session, const svn_ra_reporter3_t **reporter, Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c Wed Sep 10 16:20:51 2014 @@ -877,6 +877,150 @@ svn_ra_local__get_mergeinfo(svn_ra_sessi static svn_error_t * +svn_ra_local__do_check_path(svn_ra_session_t *session, + const char *path, + svn_revnum_t revision, + svn_node_kind_t *kind, + apr_pool_t *pool); + +static svn_error_t * +svn_ra_local__get_file(svn_ra_session_t *session, + const char *path, + svn_revnum_t revision, + svn_stream_t *stream, + svn_revnum_t *fetched_rev, + apr_hash_t **props, + apr_pool_t *pool); + +static svn_error_t * +svn_ra_local__get_dir(svn_ra_session_t *session, + apr_hash_t **dirents, + svn_revnum_t *fetched_rev, + apr_hash_t **props, + const char *path, + svn_revnum_t revision, + apr_uint32_t dirent_fields, + apr_pool_t *pool); + +/* A baton for fetch_func(). */ +typedef struct fetch_baton_t +{ + svn_ra_session_t *session; +} fetch_baton_t; + +/* Fetch kind/props/text for REPOS_RELPATH@REVISION. + * + * In contrast to an update editor, here we can assume that REPOS_RELPATH + * will be within the session root path, as there should never be 'copy' + * instructions in an update. ### Is that really right? + */ +static svn_error_t * +fetch_func(svn_node_kind_t *kind_p, + apr_hash_t **props_p, + const char **filename_p, + void *baton, + const char *repos_relpath, + svn_revnum_t revision, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + fetch_baton_t *fb = baton; + svn_ra_local__session_baton_t *sess = fb->session->priv; + const char *session_root_path = sess->fs_path->data + 1; + const char *session_relpath = svn_relpath_skip_ancestor(session_root_path, + repos_relpath); + svn_node_kind_t kind; + + SVN_ERR_ASSERT(session_relpath); + SVN_ERR(svn_ra_local__do_check_path(fb->session, session_relpath, revision, &kind, + scratch_pool)); + if (kind_p) + { + *kind_p = kind; + } + + if (props_p || filename_p) + { + if (kind == svn_node_file) + { + svn_stream_t *fstream = NULL; + svn_error_t *err; + + if (filename_p) + { + SVN_ERR(svn_stream_open_unique(&fstream, filename_p, NULL, + svn_io_file_del_on_pool_cleanup, + result_pool, scratch_pool)); + } + err = svn_ra_local__get_file(fb->session, session_relpath, revision, + fstream, NULL /*fetched_rev*/, + props_p, result_pool); + /* ### Do we want to catch SVN_ERR_FS_NOT_FOUND and set props and + text to null in that case instead of erroring? For now, + we assume the caller will only request a node that exists. */ + if (fstream) + { + err = svn_error_compose_create(err, + svn_stream_close(fstream)); + } + SVN_ERR(err); + } + else if (kind == svn_node_dir && props_p) + { + SVN_ERR(svn_ra_local__get_dir(fb->session, + NULL /*dirents*/, NULL /*fetched_rev*/, + props_p, session_relpath, revision, + 0 /*dirent_fields*/, result_pool)); + } + } + if (props_p) + SVN_DBG(("ra-local-fetch-func(%s@%ld): fetched %d props", + session_relpath, revision, apr_hash_count(*props_p))); + return SVN_NO_ERROR; +} + +static svn_error_t * +svn_ra_local__do_update_ev3(svn_ra_session_t *session, + const svn_ra_reporter3_t **reporter, + void **report_baton, + svn_revnum_t update_revision, + const char *update_target, + svn_depth_t depth, + svn_boolean_t send_copyfrom_args, + svn_boolean_t ignore_ancestry, + svn_update_editor3_t *update_editor3, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + svn_ra_local__session_baton_t *sess = session->priv; + fetch_baton_t *fb = apr_palloc(result_pool, sizeof(*fb)); + const svn_delta_editor_t *update_editor; + void *update_baton; + + fb->session = session; + SVN_ERR(svn_delta__delta_from_ev3_for_update( + &update_editor, &update_baton, + update_editor3, + sess->repos_url, sess->fs_path->data + 1, + fetch_func, fb, + result_pool, scratch_pool)); + SVN_ERR(make_reporter(session, + reporter, + report_baton, + update_revision, + update_target, + NULL, + TRUE, + depth, + send_copyfrom_args, + ignore_ancestry, + update_editor, + update_baton, + result_pool, scratch_pool)); + return SVN_NO_ERROR; +} + +static svn_error_t * svn_ra_local__do_update(svn_ra_session_t *session, const svn_ra_reporter3_t **reporter, void **report_baton, @@ -907,6 +1051,48 @@ svn_ra_local__do_update(svn_ra_session_t static svn_error_t * +svn_ra_local__do_switch_ev3(svn_ra_session_t *session, + const svn_ra_reporter3_t **reporter, + void **report_baton, + svn_revnum_t update_revision, + const char *update_target, + svn_depth_t depth, + const char *switch_url, + svn_boolean_t send_copyfrom_args, + svn_boolean_t ignore_ancestry, + svn_update_editor3_t *switch_editor, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + svn_ra_local__session_baton_t *sess = session->priv; + fetch_baton_t *fb = apr_palloc(result_pool, sizeof(*fb)); + const svn_delta_editor_t *update_editor; + void *update_baton; + + fb->session = session; + SVN_ERR(svn_delta__delta_from_ev3_for_update( + &update_editor, &update_baton, + switch_editor, + sess->repos_url, sess->fs_path->data + 1, + fetch_func, fb, + result_pool, scratch_pool)); + SVN_ERR(make_reporter(session, + reporter, + report_baton, + update_revision, + update_target, + switch_url, + TRUE /* text_deltas */, + depth, + send_copyfrom_args, + ignore_ancestry, + update_editor, + update_baton, + result_pool, scratch_pool)); + return SVN_NO_ERROR; +} + +static svn_error_t * svn_ra_local__do_switch(svn_ra_session_t *session, const svn_ra_reporter3_t **reporter, void **report_baton, @@ -1757,7 +1943,9 @@ static const svn_ra__vtable_t ra_local_v svn_ra_local__get_file, svn_ra_local__get_dir, svn_ra_local__get_mergeinfo, + svn_ra_local__do_update_ev3, svn_ra_local__do_update, + svn_ra_local__do_switch_ev3, svn_ra_local__do_switch, svn_ra_local__do_status, svn_ra_local__do_diff, Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/serf.c URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/serf.c?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/serf.c (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/serf.c Wed Sep 10 16:20:51 2014 @@ -1035,7 +1035,9 @@ static const svn_ra__vtable_t serf_vtabl svn_ra_serf__get_file, svn_ra_serf__get_dir, svn_ra_serf__get_mergeinfo, + NULL, svn_ra_serf__do_update, + NULL, svn_ra_serf__do_switch, svn_ra_serf__do_status, svn_ra_serf__do_diff, Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra_svn/client.c URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra_svn/client.c?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_ra_svn/client.c (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_ra_svn/client.c Wed Sep 10 16:20:51 2014 @@ -2875,7 +2875,9 @@ static const svn_ra__vtable_t ra_svn_vta ra_svn_get_file, ra_svn_get_dir, ra_svn_get_mergeinfo, + NULL, ra_svn_update, + NULL, ra_svn_switch, ra_svn_status, ra_svn_diff, Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/deprecated.c URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/deprecated.c?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_wc/deprecated.c (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_wc/deprecated.c Wed Sep 10 16:20:51 2014 @@ -3535,26 +3535,52 @@ svn_wc_get_update_editor4(const svn_delt apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - return svn_error_trace( - svn_wc__get_update_editor(editor, edit_baton, - target_revision, - wc_ctx, - anchor_abspath, - target_basename, NULL, - use_commit_times, - depth, depth_is_sticky, - allow_unver_obstructions, - adds_as_modification, - server_performs_filtering, - clean_checkout, - diff3_cmd, - preserved_exts, - fetch_dirents_func, fetch_dirents_baton, - conflict_func, conflict_baton, - external_func, external_baton, - cancel_func, cancel_baton, - notify_func, notify_baton, - result_pool, scratch_pool)); + svn_update_editor3_t *editor3; + const char *repos_root_url; + const char *anchor_repos_relpath; + struct svn_wc__shim_fetch_baton_t *sfb; + + SVN_ERR(svn_wc__get_update_editor_ev3(&editor3, + target_revision, + wc_ctx, + anchor_abspath, + target_basename, NULL, + use_commit_times, + depth, depth_is_sticky, + allow_unver_obstructions, + adds_as_modification, + server_performs_filtering, + clean_checkout, + diff3_cmd, + preserved_exts, + fetch_dirents_func, fetch_dirents_baton, + conflict_func, conflict_baton, + external_func, external_baton, + cancel_func, cancel_baton, + notify_func, notify_baton, + result_pool, scratch_pool)); + + SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, + &anchor_repos_relpath, &repos_root_url, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + wc_ctx->db, anchor_abspath, + scratch_pool, scratch_pool)); + + sfb = apr_palloc(result_pool, sizeof(*sfb)); + sfb->db = wc_ctx->db; + sfb->base_abspath = anchor_abspath; + sfb->base_rrpath = anchor_repos_relpath; + sfb->fetch_base = TRUE; + + SVN_ERR(svn_delta__delta_from_ev3_for_update( + editor, edit_baton, + editor3, + repos_root_url, anchor_repos_relpath, + svn_wc__fetch_func, sfb, + result_pool, scratch_pool)); + + return SVN_NO_ERROR; } Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c Wed Sep 10 16:20:51 2014 @@ -4921,6 +4921,398 @@ close_edit(void *edit_baton, /* Helper for the three public editor-supplying functions. */ static svn_error_t * +make_editor3(svn_revnum_t *target_revision, + svn_wc__db_t *db, + const char *anchor_abspath, + const char *target_basename, + apr_hash_t *wcroot_iprops, + svn_boolean_t use_commit_times, + const char *switch_url, + 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_boolean_t clean_checkout, + svn_wc_notify_func2_t notify_func, + void *notify_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + svn_wc_dirents_func_t fetch_dirents_func, + void *fetch_dirents_baton, + svn_wc_conflict_resolver_func2_t conflict_func, + void *conflict_baton, + svn_wc_external_update_t external_func, + void *external_baton, + const char *diff3_cmd, + const apr_array_header_t *preserved_exts, + svn_update_editor3_t **editor, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + struct edit_baton *eb; + void *inner_baton; + apr_pool_t *edit_pool = svn_pool_create(result_pool); + svn_delta_editor_t *tree_editor = svn_delta_default_editor(edit_pool); + const svn_delta_editor_t *inner_editor; + const char *repos_root, *repos_uuid; + + /* An unknown depth can't be sticky. */ + if (depth == svn_depth_unknown) + depth_is_sticky = FALSE; + + /* Get the anchor's repository root and uuid. The anchor must already exist + in BASE. */ + SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, &repos_root, + &repos_uuid, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + db, anchor_abspath, + result_pool, scratch_pool)); + + /* With WC-NG we need a valid repository root */ + SVN_ERR_ASSERT(repos_root != NULL && repos_uuid != NULL); + + /* Disallow a switch operation to change the repository root of the target, + if that is known. */ + if (switch_url && !svn_uri__is_ancestor(repos_root, switch_url)) + return svn_error_createf(SVN_ERR_WC_INVALID_SWITCH, NULL, + _("'%s'\nis not the same repository as\n'%s'"), + switch_url, repos_root); + + /* Construct an edit baton. */ + eb = apr_pcalloc(edit_pool, sizeof(*eb)); + eb->pool = edit_pool; + eb->use_commit_times = use_commit_times; + eb->target_revision = target_revision; + eb->repos_root = repos_root; + eb->repos_uuid = repos_uuid; + eb->db = db; + eb->target_basename = target_basename; + eb->anchor_abspath = anchor_abspath; + eb->wcroot_iprops = wcroot_iprops; + + SVN_ERR(svn_wc__db_get_wcroot(&eb->wcroot_abspath, db, anchor_abspath, + edit_pool, scratch_pool)); + + if (switch_url) + eb->switch_repos_relpath = + svn_uri_skip_ancestor(repos_root, switch_url, scratch_pool); + else + eb->switch_repos_relpath = NULL; + + if (svn_path_is_empty(target_basename)) + eb->target_abspath = eb->anchor_abspath; + else + eb->target_abspath = svn_dirent_join(eb->anchor_abspath, target_basename, + edit_pool); + + eb->requested_depth = depth; + eb->depth_is_sticky = depth_is_sticky; + eb->notify_func = notify_func; + eb->notify_baton = notify_baton; + eb->external_func = external_func; + eb->external_baton = external_baton; + eb->diff3_cmd = diff3_cmd; + eb->cancel_func = cancel_func; + eb->cancel_baton = cancel_baton; + 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->clean_checkout = clean_checkout; + eb->skipped_trees = apr_hash_make(edit_pool); + eb->dir_dirents = apr_hash_make(edit_pool); + eb->ext_patterns = preserved_exts; + + apr_pool_cleanup_register(edit_pool, eb, cleanup_edit_baton, + apr_pool_cleanup_null); + + /* Construct an editor. */ + tree_editor->set_target_revision = set_target_revision; + tree_editor->open_root = open_root; + tree_editor->delete_entry = delete_entry; + tree_editor->add_directory = add_directory; + tree_editor->open_directory = open_directory; + tree_editor->change_dir_prop = change_dir_prop; + tree_editor->close_directory = close_directory; + tree_editor->absent_directory = absent_directory; + tree_editor->add_file = add_file; + tree_editor->open_file = open_file; + tree_editor->apply_textdelta = apply_textdelta; + tree_editor->change_file_prop = change_file_prop; + tree_editor->close_file = close_file; + tree_editor->absent_file = absent_file; + tree_editor->close_edit = close_edit; + + /* Fiddle with the type system. */ + inner_editor = tree_editor; + inner_baton = eb; + + if (!depth_is_sticky + && depth != svn_depth_unknown + && svn_depth_empty <= depth && depth < svn_depth_infinity + && fetch_dirents_func) + { + /* We are asked to perform an update at a depth less than the ambient + depth. In this case the update won't describe additions that would + have been reported if we updated at the ambient depth. */ + svn_error_t *err; + svn_node_kind_t dir_kind; + svn_wc__db_status_t dir_status; + const char *dir_repos_relpath; + svn_depth_t dir_depth; + + /* we have to do this on the target of the update, not the anchor */ + err = svn_wc__db_base_get_info(&dir_status, &dir_kind, NULL, + &dir_repos_relpath, NULL, NULL, NULL, + NULL, NULL, &dir_depth, NULL, NULL, NULL, + NULL, NULL, NULL, + db, eb->target_abspath, + scratch_pool, scratch_pool); + + if (!err + && dir_kind == svn_node_dir + && dir_status == svn_wc__db_status_normal) + { + if (dir_depth > depth) + { + apr_hash_t *dirents; + + /* If we switch, we should look at the new relpath */ + if (eb->switch_repos_relpath) + dir_repos_relpath = eb->switch_repos_relpath; + + SVN_ERR(fetch_dirents_func(fetch_dirents_baton, &dirents, + repos_root, dir_repos_relpath, + edit_pool, scratch_pool)); + + if (dirents != NULL && apr_hash_count(dirents)) + svn_hash_sets(eb->dir_dirents, + apr_pstrdup(edit_pool, dir_repos_relpath), + dirents); + } + + if (depth == svn_depth_immediates) + { + /* Worst case scenario of issue #3569 fix: We have to do the + same for all existing subdirs, but then we check for + svn_depth_empty. */ + const apr_array_header_t *children; + apr_pool_t *iterpool = svn_pool_create(scratch_pool); + int i; + SVN_ERR(svn_wc__db_base_get_children(&children, db, + eb->target_abspath, + scratch_pool, + iterpool)); + + for (i = 0; i < children->nelts; i++) + { + const char *child_abspath; + const char *child_name; + + svn_pool_clear(iterpool); + + child_name = APR_ARRAY_IDX(children, i, const char *); + + child_abspath = svn_dirent_join(eb->target_abspath, + child_name, iterpool); + + SVN_ERR(svn_wc__db_base_get_info(&dir_status, &dir_kind, + NULL, &dir_repos_relpath, + NULL, NULL, NULL, NULL, + NULL, &dir_depth, NULL, + NULL, NULL, NULL, NULL, + NULL, + db, child_abspath, + iterpool, iterpool)); + + if (dir_kind == svn_node_dir + && dir_status == svn_wc__db_status_normal + && dir_depth > svn_depth_empty) + { + apr_hash_t *dirents; + + /* If we switch, we should look at the new relpath */ + if (eb->switch_repos_relpath) + dir_repos_relpath = svn_relpath_join( + eb->switch_repos_relpath, + child_name, iterpool); + + SVN_ERR(fetch_dirents_func(fetch_dirents_baton, &dirents, + repos_root, dir_repos_relpath, + edit_pool, iterpool)); + + if (dirents != NULL && apr_hash_count(dirents)) + svn_hash_sets(eb->dir_dirents, + apr_pstrdup(edit_pool, + dir_repos_relpath), + dirents); + } + } + } + } + else if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND) + svn_error_clear(err); + else + SVN_ERR(err); + } + + /* We need to limit the scope of our operation to the ambient depths + present in the working copy already, but only if the requested + depth is not sticky. If a depth was explicitly requested, + libsvn_delta/depth_filter_editor.c will ensure that we never see + editor calls that extend beyond the scope of the requested depth. + 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.) */ + if (!server_performs_filtering + && !depth_is_sticky) + SVN_ERR(svn_wc__ambient_depth_filter_editor(&inner_editor, + &inner_baton, + db, + anchor_abspath, + target_basename, + inner_editor, + inner_baton, + result_pool)); + + /* Convert Ev1 to Ev3 */ + { + const char *anchor_repos_relpath; + struct svn_wc__shim_fetch_baton_t *sfb; + + SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, + &anchor_repos_relpath, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, + db, eb->anchor_abspath, + scratch_pool, scratch_pool)); + /* If we switch, we should look at the new relpath */ +/* if (eb->switch_repos_relpath) + anchor_repos_relpath = eb->switch_repos_relpath;*/ + /* ### Should that be an 'anchor' directory instead, when switching to a file? */ + /* ### Should that be the common ancestor of source and target repos-paths? */ + + sfb = apr_palloc(result_pool, sizeof(*sfb)); + sfb->db = db; + sfb->base_abspath = eb->anchor_abspath; + sfb->base_rrpath = anchor_repos_relpath; + sfb->fetch_base = TRUE; + SVN_DBG(("wc make up/sw editor: base_rrpath='%s'; base_abspath=%s", + sfb->base_rrpath, sfb->base_abspath)); + + SVN_ERR(svn_delta__ev3_from_delta_for_update( + editor, + inner_editor, inner_baton, + repos_root, anchor_repos_relpath, + svn_wc__fetch_func, sfb, + cancel_func, cancel_baton, + result_pool, scratch_pool)); + } + + return SVN_NO_ERROR; +} + + +/* This returns an editor that should then be driven. Also requires the + target revision to be supplied *by the edit driver*, later than now but + before the edit is driven. This editor will then also store that target + revision into @a *target_revision. + */ +svn_error_t * +svn_wc__get_update_editor_ev3(svn_update_editor3_t **update_editor, + svn_revnum_t *target_revision, + svn_wc_context_t *wc_ctx, + const char *anchor_abspath, + const char *target_basename, + apr_hash_t *wcroot_iprops, + svn_boolean_t use_commit_times, + 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_boolean_t clean_checkout, + const char *diff3_cmd, + const apr_array_header_t *preserved_exts, + svn_wc_dirents_func_t fetch_dirents_func, + void *fetch_dirents_baton, + svn_wc_conflict_resolver_func2_t conflict_func, + void *conflict_baton, + svn_wc_external_update_t external_func, + void *external_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + svn_wc_notify_func2_t notify_func, + void *notify_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + SVN_ERR(make_editor3(target_revision, wc_ctx->db, anchor_abspath, + target_basename, wcroot_iprops, use_commit_times, + NULL, depth, depth_is_sticky, allow_unver_obstructions, + adds_as_modification, server_performs_filtering, + clean_checkout, + notify_func, notify_baton, + cancel_func, cancel_baton, + fetch_dirents_func, fetch_dirents_baton, + conflict_func, conflict_baton, + external_func, external_baton, + diff3_cmd, preserved_exts, + update_editor, + result_pool, scratch_pool)); + return SVN_NO_ERROR; +} + +svn_error_t * +svn_wc__get_switch_editor_ev3(svn_update_editor3_t **update_editor, + svn_revnum_t *target_revision, + svn_wc_context_t *wc_ctx, + const char *anchor_abspath, + const char *target_basename, + const char *switch_url, + apr_hash_t *wcroot_iprops, + svn_boolean_t use_commit_times, + svn_depth_t depth, + svn_boolean_t depth_is_sticky, + svn_boolean_t allow_unver_obstructions, + svn_boolean_t server_performs_filtering, + const char *diff3_cmd, + const apr_array_header_t *preserved_exts, + svn_wc_dirents_func_t fetch_dirents_func, + void *fetch_dirents_baton, + svn_wc_conflict_resolver_func2_t conflict_func, + void *conflict_baton, + svn_wc_external_update_t external_func, + void *external_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + svn_wc_notify_func2_t notify_func, + void *notify_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + SVN_ERR(make_editor3(target_revision, wc_ctx->db, anchor_abspath, + target_basename, wcroot_iprops, use_commit_times, + switch_url, + depth, depth_is_sticky, allow_unver_obstructions, + FALSE /* adds_as_modification */, + server_performs_filtering, + FALSE /* clean_checkout */, + notify_func, notify_baton, + cancel_func, cancel_baton, + fetch_dirents_func, fetch_dirents_baton, + conflict_func, conflict_baton, + external_func, external_baton, + diff3_cmd, preserved_exts, + update_editor, + result_pool, scratch_pool)); + return SVN_NO_ERROR; +} + +/* Helper for the three public editor-supplying functions. */ +static svn_error_t * make_editor(svn_revnum_t *target_revision, svn_wc__db_t *db, const char *anchor_abspath, @@ -5280,6 +5672,7 @@ svn_wc__get_switch_editor(const svn_delt apr_pool_t *result_pool, apr_pool_t *scratch_pool) { +#if 1 SVN_ERR_ASSERT(switch_url && svn_uri_is_canonical(switch_url, scratch_pool)); return make_editor(target_revision, wc_ctx->db, anchor_abspath, @@ -5297,6 +5690,57 @@ svn_wc__get_switch_editor(const svn_delt diff3_cmd, preserved_exts, editor, edit_baton, result_pool, scratch_pool); +#else + svn_update_editor3_t *editor3; + const char *repos_root; + const char *anchor_repos_relpath; + struct svn_wc__shim_fetch_baton_t *sfb; + + SVN_ERR_ASSERT(switch_url && svn_uri_is_canonical(switch_url, scratch_pool)); + + SVN_ERR(make_editor3(target_revision, wc_ctx->db, anchor_abspath, + target_basename, wcroot_iprops, use_commit_times, + switch_url, + depth, depth_is_sticky, allow_unver_obstructions, + FALSE /* adds_as_modification */, + server_performs_filtering, + FALSE /* clean_checkout */, + notify_func, notify_baton, + cancel_func, cancel_baton, + fetch_dirents_func, fetch_dirents_baton, + conflict_func, conflict_baton, + external_func, external_baton, + diff3_cmd, preserved_exts, + &editor3, + result_pool, scratch_pool)); + + SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, + &anchor_repos_relpath, &repos_root, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, + wc_ctx->db, anchor_abspath, + scratch_pool, scratch_pool)); + /* If we switch, we should look at the new relpath */ + if (switch_url) + anchor_repos_relpath = svn_uri_skip_ancestor(repos_root, switch_url, + scratch_pool); + /* ### should that be an 'anchor' directory instead, when switching to a file? */ + + sfb = apr_palloc(result_pool, sizeof(*sfb)); + sfb->db = wc_ctx->db; + sfb->base_abspath = anchor_abspath; + sfb->base_rrpath = anchor_repos_relpath; + sfb->fetch_base = TRUE; + + SVN_ERR(svn_delta__delta_from_ev3_for_update( + editor, edit_baton, + editor3, + repos_root, anchor_repos_relpath, + svn_wc__fetch_func, sfb, + result_pool, scratch_pool)); + + return SVN_NO_ERROR; +#endif } Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/util.c URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/util.c?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_wc/util.c (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_wc/util.c Wed Sep 10 16:20:51 2014 @@ -418,6 +418,83 @@ svn_wc__cd2_to_cd(const svn_wc_conflict_ svn_error_t * +svn_wc__fetch_func(svn_node_kind_t *kind, + apr_hash_t **props, + const char **filename, + void *baton, + const char *repos_relpath, + svn_revnum_t revision, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + struct svn_wc__shim_fetch_baton_t *sfb = baton; + const char *path_rel_to_edit = svn_relpath_skip_ancestor(sfb->base_rrpath, + repos_relpath); + const char *local_abspath = svn_dirent_join(sfb->base_abspath, + path_rel_to_edit, scratch_pool); + svn_error_t *err; + + if (kind) + { + /* ### should get working kind or base kind depending on SFB->fetch_base */ + SVN_ERR(svn_wc__db_read_kind(kind, sfb->db, local_abspath, + FALSE /* allow_missing */, + TRUE /* show_deleted */, + FALSE /* show_hidden */, + scratch_pool)); + } + + if (props) + { + if (sfb->fetch_base) + err = svn_wc__db_base_get_props(props, sfb->db, local_abspath, result_pool, + scratch_pool); + else + err = svn_wc__db_read_props(props, sfb->db, local_abspath, + result_pool, scratch_pool); + + /* If the path doesn't exist, just return an empty set of props. */ + if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND) + { + svn_error_clear(err); + *props = apr_hash_make(result_pool); + } + else if (err) + return svn_error_trace(err); + } + + if (filename) + { + const svn_checksum_t *checksum; + + err = svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, &checksum, + NULL, NULL, NULL, NULL, NULL, + sfb->db, local_abspath, + scratch_pool, scratch_pool); + if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND) + { + svn_error_clear(err); + *filename = NULL; + return SVN_NO_ERROR; + } + else if (err) + return svn_error_trace(err); + + if (checksum == NULL) + { + *filename = NULL; + return SVN_NO_ERROR; + } + + SVN_ERR(svn_wc__db_pristine_get_path(filename, sfb->db, local_abspath, + checksum, scratch_pool, scratch_pool)); + } + + return SVN_NO_ERROR; +} + +svn_error_t * svn_wc__fetch_kind_func(svn_node_kind_t *kind, void *baton, const char *path, Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h?rev=1624054&r1=1624053&r2=1624054&view=diff ============================================================================== --- subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h (original) +++ subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h Wed Sep 10 16:20:51 2014 @@ -734,10 +734,27 @@ svn_wc__perform_file_merge(svn_skel_t ** struct svn_wc__shim_fetch_baton_t { svn_wc__db_t *db; + /* WC local abspath of base of the edit */ const char *base_abspath; + /* Repository-root-relative path of base of the edit */ + const char *base_rrpath; svn_boolean_t fetch_base; }; +/* Using a BATON of struct svn_wc__shim_fetch_baton_t, return + * KIND/PROPS/FILENAME for REPOS_RELPATH. REVISION is unused. + * + * Implements svn_editor3__shim_fetch_func_t. */ +svn_error_t * +svn_wc__fetch_func(svn_node_kind_t *kind, + apr_hash_t **props, + const char **filename, + void *baton, + const char *repos_relpath, + svn_revnum_t revision, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + /* Using a BATON of struct shim_fetch_baton, return KIND for PATH. */ svn_error_t * svn_wc__fetch_kind_func(svn_node_kind_t *kind,