Author: stsp Date: Mon Nov 28 09:42:20 2011 New Revision: 1207041 URL: http://svn.apache.org/viewvc?rev=1207041&view=rev Log: On the moves-scan-log branch, introduce the new 'incoming move away' tree conflict action and start using it. Also, tweak semantics of the svn_wc_conflict_choose_incoming_move choice and implement support for it in libsvn_wc.
* subversion/include/svn_wc.h (svn_wc_conflict_action_t): Add svn_wc_conflict_action_move_away. (svn_wc_conflict_description2_t): Add 'incoming move', to be used together with svn_wc_conflict_choose_incoming_move. (svn_wc_conflict_choice_t): The 'incoming move' choice doesn't resolve anything. Rather, it makes the nature of an 'incoming delete' conflict more specific. Tweak the documentation accordingly. Add a new choice svn_wc_conflict_choose_new_incoming_move_target which allows users to divert an incoming move (this choice was previously muddled with svn_wc_conflict_choose_incoming_move). (svn_wc_conflict_result_t): Tweak description of incoming_move, rename choose_incoming_move_target to new_incoming_move_target for consistency, and add new_local_move_target. * subversion/svn/tree-conflicts.c, subversion/libsvn_wc/tree_conflicts.c (map_conflict_action_h, map_conflict_action_x, svn_wc__conflict_action_map): Add move-away action to maps. * subversion/libsvn_wc/update_editor.c (delete_entry): If the conflict callback returns 'choose incoming move', tweak the tree conflict description accordingly and invoke the callback again. Add a place-holder if-block for the new_incoming_move_target choice, to be implemented later. Modified: subversion/branches/moves-scan-log/subversion/include/svn_wc.h subversion/branches/moves-scan-log/subversion/libsvn_wc/tree_conflicts.c subversion/branches/moves-scan-log/subversion/libsvn_wc/update_editor.c subversion/branches/moves-scan-log/subversion/svn/tree-conflicts.c Modified: subversion/branches/moves-scan-log/subversion/include/svn_wc.h URL: http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/include/svn_wc.h?rev=1207041&r1=1207040&r2=1207041&view=diff ============================================================================== --- subversion/branches/moves-scan-log/subversion/include/svn_wc.h (original) +++ subversion/branches/moves-scan-log/subversion/include/svn_wc.h Mon Nov 28 09:42:20 2011 @@ -1560,8 +1560,10 @@ typedef enum svn_wc_conflict_action_t svn_wc_conflict_action_edit, /**< attempting to change text or props */ svn_wc_conflict_action_add, /**< attempting to add object */ svn_wc_conflict_action_delete, /**< attempting to delete object */ - svn_wc_conflict_action_replace /**< attempting to replace object, + svn_wc_conflict_action_replace, /**< attempting to replace object, @since New in 1.7 */ + svn_wc_conflict_action_move_away /**< attempting to move object away, + @since New in 1.8 */ } svn_wc_conflict_action_t; @@ -1854,6 +1856,11 @@ typedef struct svn_wc_conflict_descripti * @since New in 1.8. */ apr_array_header_t *suggested_moves; + /** The incoming move in case of an incoming move vs. local move tree + * conflict. + * @since New in 1.8. */ + svn_wc_repos_move_info_t *incoming_move; + /* Remember to adjust svn_wc__conflict_description2_dup() * if you add new fields to this struct. */ } svn_wc_conflict_description2_t; @@ -2117,12 +2124,21 @@ typedef enum svn_wc_conflict_choice_t svn_wc_conflict_choose_copy_is_copy, /** The user has chosen to map an incoming delete or copy to a - * server-side move. This move is described by svn_wc_conflict_result_t. + * server-side move. The incoming move is described by + * svn_wc_conflict_result_t and must not be NULL. + * This choice causes the conflict callback to be invoked again with a + * more specific conflict description. + * @see svn_wc_conflict_result_t + * @since New in 1.8. */ + svn_wc_conflict_choose_incoming_move, + + /** The user has chosen a new target for an incoming move to resolve an + * "incoming move vs. local move" tree conflict. * This allows users to divert incoming moves to a different target * location during "incoming move vs. local move" tree conflicts. * @see svn_wc_conflict_result_t * @since New in 1.8. */ - svn_wc_conflict_choose_incoming_move, + svn_wc_conflict_choose_new_incoming_move_target, /** The user has chosen a new target for a local move to resolve an * "incoming move vs. local move" tree conflict. This allows users to @@ -2169,14 +2185,19 @@ typedef struct svn_wc_conflict_result_t * The revision fields may be @c SVN_INVALID_REVNUM in case they are * unknown, and the prev/next pointers may both be NULL. * The idea is to allow users to describe an arbitrary incoming move - * by naming the source and the target. If the user's chosen incoming - * move is not applicable, the conflict callback will be invoked again. + * by naming the source and the target. * @see svn_wc_conflict_choice_t * @since New in 1.8. */ svn_wc_repos_move_info_t *incoming_move; - /** The absolute path of a new target of a local move in case the - * choice is svn_wc_conflict_choose_incoming_move_target. + /** The repos-relpath of a new target of a move in case the + * choice is svn_wc_conflict_choose_new_incoming_move_target. + * @see svn_wc_conflict_choice_t + * @since New in 1.8. */ + const char *new_incoming_move_target; + + /** The absolute path of a new target of a move in case the + * choice is svn_wc_conflict_choose_new_local_move_target. * @see svn_wc_conflict_choice_t * @since New in 1.8. */ const char *new_local_move_target; Modified: subversion/branches/moves-scan-log/subversion/libsvn_wc/tree_conflicts.c URL: http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/libsvn_wc/tree_conflicts.c?rev=1207041&r1=1207040&r2=1207041&view=diff ============================================================================== --- subversion/branches/moves-scan-log/subversion/libsvn_wc/tree_conflicts.c (original) +++ subversion/branches/moves-scan-log/subversion/libsvn_wc/tree_conflicts.c Mon Nov 28 09:42:20 2011 @@ -63,6 +63,7 @@ const svn_token_map_t svn_wc__conflict_a { "deleted", svn_wc_conflict_action_delete }, { "added", svn_wc_conflict_action_add }, { "replaced", svn_wc_conflict_action_replace }, + { "moved-away", svn_wc_conflict_action_move_away }, { NULL } }; Modified: subversion/branches/moves-scan-log/subversion/libsvn_wc/update_editor.c URL: http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/libsvn_wc/update_editor.c?rev=1207041&r1=1207040&r2=1207041&view=diff ============================================================================== --- subversion/branches/moves-scan-log/subversion/libsvn_wc/update_editor.c (original) +++ subversion/branches/moves-scan-log/subversion/libsvn_wc/update_editor.c Mon Nov 28 09:42:20 2011 @@ -2139,6 +2139,7 @@ delete_entry(const char *path, return svn_error_create(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL, _("Conflict callback violated API:" " returned no results")); + if (result->choice == svn_wc_conflict_choose_scan_log_for_moves) { /* Scan revision log for server-side moves */ @@ -2153,6 +2154,52 @@ delete_entry(const char *path, if (result->choice == svn_wc_conflict_choose_incoming_move) { + if (result->incoming_move == NULL) + return svn_error_create(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, + NULL, + _("Conflict callback violated API: " + "returned no incoming move")); + + if (tree_conflict->reason == svn_wc_conflict_reason_moved_away) + { + const char *moved_to_repos_relpath; + + /* If the incoming move agrees with the local move, do not + * flag a tree conflict. */ + SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, + &moved_to_repos_relpath, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + eb->db, + moved_to_abspath, + scratch_pool, + scratch_pool)); + if (strcmp(result->incoming_move->moved_to_repos_relpath, + moved_to_repos_relpath) == 0) + { + tree_conflict = NULL; + break; + } + + /* Incoming move vs. local move tree conflict. */ + tree_conflict->action = svn_wc_conflict_action_move_away; + tree_conflict->incoming_move = result->incoming_move; + } + else if (tree_conflict->reason == svn_wc_conflict_reason_deleted) + { + /* Incoming move vs. local delete tree conflict. */ + tree_conflict->action = svn_wc_conflict_action_move_away; + tree_conflict->incoming_move = result->incoming_move; + } + + /* Now that the precise nature of the conflict is known, invoke + * the conflict callback again to give the user a chance to + * resolve the conflict. */ + continue; + } + + if (result->choice == svn_wc_conflict_choose_new_incoming_move_target) + { /* ### TODO */ } Modified: subversion/branches/moves-scan-log/subversion/svn/tree-conflicts.c URL: http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/svn/tree-conflicts.c?rev=1207041&r1=1207040&r2=1207041&view=diff ============================================================================== --- subversion/branches/moves-scan-log/subversion/svn/tree-conflicts.c (original) +++ subversion/branches/moves-scan-log/subversion/svn/tree-conflicts.c Mon Nov 28 09:42:20 2011 @@ -39,6 +39,7 @@ static const svn_token_map_t map_conflic { N_("delete"), svn_wc_conflict_action_delete }, { N_("add"), svn_wc_conflict_action_add }, { N_("replace"), svn_wc_conflict_action_replace }, + { N_("move away"), svn_wc_conflict_action_move_away }, { NULL, 0 } }; @@ -49,6 +50,7 @@ static const svn_token_map_t map_conflic { "delete", svn_wc_conflict_action_delete }, { "add", svn_wc_conflict_action_add }, { "replace", svn_wc_conflict_action_replace }, + { "move-away", svn_wc_conflict_action_move_away }, { NULL, 0 } };