[prev in list] [next in list] [prev in thread] [next in thread]
List: subversion-commits
Subject: svn commit: r1809291 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_clie
From: stsp () apache ! org
Date: 2017-09-22 10:08:57
Message-ID: 20170922100859.D44AA3A00E9 () svn01-us-west ! apache ! org
[Download RAW message or body]
Author: stsp
Date: Fri Sep 22 10:08:56 2017
New Revision: 1809291
URL: http://svn.apache.org/viewvc?rev=1809291&view=rev
Log:
In the conflict resolver, fix the locating of move targets in the
working copy during merges. The previous implementation only worked
for update/switch, because it assumed that a move target's revision
would always match the incoming-new revision of the conflict victim.
This was a design mistake, since this condition won't hold for merges.
Found by: brane
* subversion/include/private/svn_wc_private.h
(svn_wc__guess_incoming_move_target_nodes): Remove 'rev' parameter.
* subversion/libsvn_client/conflicts.c
(follow_move_chains): Move target candidates from libsvn_wc are now
identified only by URL. So check ancestry between the conflict victim
and each move target candiate in case their revisions do not match.
Add 'victim_repos_relpath' parameter.
(init_wc_move_targets, configure_option_local_move_file_merg): Pass the
victim's repos relpath to follow_move_chains().
* subversion/libsvn_wc/conflicts.c
(svn_wc__guess_incoming_move_target_nodes): Remove 'rev' parameter.
* subversion/libsvn_wc/wc-queries.sql
(STMT_FIND_REPOS_PATH_IN_WC): Ignore the revision column.
* subversion/libsvn_wc/wc_db.c
(svn_wc__find_repos_node_in_wc): Remove 'rev' parameter.
* subversion/libsvn_wc/wc_db.h
(svn_wc__find_repos_node_in_wc): Remove 'rev' parameter.
Modified:
subversion/trunk/subversion/include/private/svn_wc_private.h
subversion/trunk/subversion/libsvn_client/conflicts.c
subversion/trunk/subversion/libsvn_wc/conflicts.c
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1809291&r1=1809290&r2=1809291&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Fri Sep 22 10:08:56 \
2017 @@ -1946,7 +1946,6 @@ svn_wc__guess_incoming_move_target_nodes
const char *victim_abspath,
svn_node_kind_t victim_node_kind,
const char *moved_to_repos_relpath,
- svn_revnum_t rev,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1809291&r1=1809290&r2=1809291&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Fri Sep 22 10:08:56 2017
@@ -4643,7 +4643,8 @@ get_incoming_delete_details_for_reverse_
}
/* Follow each move chain starting a MOVE all the way to the end to find
- * the possible working copy locations for VICTIM_ABSPATH at PEG_REVISION.
+ * the possible working copy locations for VICTIM_ABSPATH which corresponds
+ * to VICTIM_REPOS_REPLATH@VICTIM_REVISION.
* Add each such location to the WC_MOVE_TARGETS hash table, keyed on the
* repos_relpath which is the corresponding move destination in the repository.
* This function is recursive. */
@@ -4653,7 +4654,8 @@ follow_move_chains(apr_hash_t *wc_move_t
svn_client_ctx_t *ctx,
const char *victim_abspath,
svn_node_kind_t victim_node_kind,
- svn_revnum_t peg_revision,
+ const char *victim_repos_relpath,
+ svn_revnum_t victim_revision,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -4661,17 +4663,85 @@ follow_move_chains(apr_hash_t *wc_move_t
* the working copy and add them to our collection if found. */
if (move->next == NULL)
{
- apr_array_header_t *moved_to_abspaths;
+ apr_array_header_t *candidate_abspaths;
- /* Gather nodes which represent this moved_to_repos_relpath. */
+ /* Gather candidate nodes which represent this moved_to_repos_relpath. */
SVN_ERR(svn_wc__guess_incoming_move_target_nodes(
- &moved_to_abspaths, ctx->wc_ctx,
+ &candidate_abspaths, ctx->wc_ctx,
victim_abspath, victim_node_kind,
move->moved_to_repos_relpath,
- peg_revision, result_pool, scratch_pool));
- if (moved_to_abspaths->nelts > 0)
- svn_hash_sets(wc_move_targets, move->moved_to_repos_relpath,
- moved_to_abspaths);
+ scratch_pool, scratch_pool));
+ if (candidate_abspaths->nelts > 0)
+ {
+ apr_array_header_t *moved_to_abspaths;
+ int i;
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+
+ moved_to_abspaths = apr_array_make(result_pool, 1,
+ sizeof (const char *));
+
+ for (i = 0; i < candidate_abspaths->nelts; i++)
+ {
+ const char *candidate_abspath;
+ const char *repos_root_url;
+ const char *repos_uuid;
+ const char *candidate_repos_relpath;
+ svn_revnum_t candidate_revision;
+
+ svn_pool_clear(iterpool);
+
+ candidate_abspath = APR_ARRAY_IDX(candidate_abspaths, i,
+ const char *);
+ SVN_ERR(svn_wc__node_get_origin(NULL, &candidate_revision,
+ &candidate_repos_relpath,
+ &repos_root_url,
+ &repos_uuid,
+ NULL, NULL,
+ ctx->wc_ctx,
+ candidate_abspath,
+ FALSE,
+ iterpool, iterpool));
+
+ if (candidate_revision == SVN_INVALID_REVNUM)
+ continue;
+
+ /* If the conflict victim and the move target candidate
+ * are not from the same revision we must ensure that
+ * they are related. */
+ if (candidate_revision != victim_revision)
+ {
+ svn_client__pathrev_t *yca_loc;
+ svn_error_t *err;
+
+ err = find_yca(&yca_loc, victim_repos_relpath,
+ victim_revision,
+ candidate_repos_relpath,
+ candidate_revision,
+ repos_root_url, repos_uuid,
+ NULL, ctx, scratch_pool, scratch_pool);
+ if (err)
+ {
+ if (err->apr_err == SVN_ERR_FS_NOT_FOUND)
+ {
+ svn_error_clear(err);
+ yca_loc = NULL;
+ }
+ else
+ return svn_error_trace(err);
+ }
+
+ if (yca_loc == NULL)
+ continue;
+ }
+
+ APR_ARRAY_PUSH(moved_to_abspaths, const char *) =
+ apr_pstrdup(result_pool, candidate_abspath);
+ }
+ svn_pool_destroy(iterpool);
+
+ svn_hash_sets(wc_move_targets, move->moved_to_repos_relpath,
+ moved_to_abspaths);
+ }
}
else
{
@@ -4689,7 +4759,8 @@ follow_move_chains(apr_hash_t *wc_move_t
next_move = APR_ARRAY_IDX(move->next, i, struct repos_move_info *);
SVN_ERR(follow_move_chains(wc_move_targets, next_move,
ctx, victim_abspath, victim_node_kind,
- peg_revision, result_pool, iterpool));
+ victim_repos_relpath, victim_revision,
+ result_pool, iterpool));
}
svn_pool_destroy(iterpool);
@@ -4707,14 +4778,17 @@ init_wc_move_targets(struct conflict_tre
int i;
const char *victim_abspath;
svn_node_kind_t victim_node_kind;
+ const char *incoming_new_repos_relpath;
svn_revnum_t incoming_new_pegrev;
svn_wc_operation_t operation;
victim_abspath = svn_client_conflict_get_local_abspath(conflict);
victim_node_kind = svn_client_conflict_tree_get_victim_node_kind(conflict);
operation = svn_client_conflict_get_operation(conflict);
+ /* ### Should we get the old location in case of reverse-merges? */
SVN_ERR(svn_client_conflict_get_incoming_new_repos_location(
- NULL, &incoming_new_pegrev, NULL, conflict,
+ &incoming_new_repos_relpath, &incoming_new_pegrev,
+ NULL, conflict,
scratch_pool, scratch_pool));
details->wc_move_targets = apr_hash_make(conflict->pool);
for (i = 0; i < details->moves->nelts; i++)
@@ -4725,6 +4799,7 @@ init_wc_move_targets(struct conflict_tre
SVN_ERR(follow_move_chains(details->wc_move_targets, move,
ctx, victim_abspath,
victim_node_kind,
+ incoming_new_repos_relpath,
incoming_new_pegrev,
conflict->pool, scratch_pool));
}
@@ -9913,6 +9988,7 @@ configure_option_local_move_file_merge(s
SVN_ERR(follow_move_chains(wc_move_targets, move, ctx,
conflict->local_abspath,
svn_node_file,
+ incoming_new_repos_relpath,
incoming_new_pegrev,
scratch_pool, iterpool));
}
Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1809291&r1=1809290&r2=1809291&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Fri Sep 22 10:08:56 2017
@@ -3844,7 +3844,6 @@ svn_wc__guess_incoming_move_target_nodes
const char *victim_abspath,
svn_node_kind_t victim_node_kind,
const char *moved_to_repos_relpath,
- svn_revnum_t rev,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -3855,7 +3854,7 @@ svn_wc__guess_incoming_move_target_nodes
*possible_targets = apr_array_make(result_pool, 1, sizeof(const char *));
SVN_ERR(svn_wc__find_repos_node_in_wc(&candidates, wc_ctx->db, victim_abspath,
- moved_to_repos_relpath, rev,
+ moved_to_repos_relpath,
scratch_pool, scratch_pool));
/* Find a "useful move target" node in our set of candidates.
Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1809291&r1=1809290&r2=1809291&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Sep 22 10:08:56 2017
@@ -1293,7 +1293,7 @@ PRAGMA journal_mode = DELETE
-- STMT_FIND_REPOS_PATH_IN_WC
SELECT local_relpath FROM nodes_current
- WHERE wc_id = ?1 AND repos_path = ?2 AND revision = ?3
+ WHERE wc_id = ?1 AND repos_path = ?2
/* ------------------------------------------------------------------------- */
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1809291&r1=1809290&r2=1809291&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Sep 22 10:08:56 2017
@@ -16582,7 +16582,6 @@ svn_wc__find_repos_node_in_wc(apr_array_
svn_wc__db_t *db,
const char *wri_abspath,
const char *repos_relpath,
- svn_revnum_t rev,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -16600,7 +16599,7 @@ svn_wc__find_repos_node_in_wc(apr_array_
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_FIND_REPOS_PATH_IN_WC));
- SVN_ERR(svn_sqlite__bindf(stmt, "isr", wcroot->wc_id, repos_relpath, rev));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, repos_relpath));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
*local_abspath_list = apr_array_make(result_pool, have_row ? 1 : 0,
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1809291&r1=1809290&r2=1809291&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri Sep 22 10:08:56 2017
@@ -3489,8 +3489,7 @@ svn_wc__required_lock_for_resolve(const
/* Return an array of const char * elements, which represent local absolute
* paths for nodes, within the working copy indicated by WRI_ABSPATH, which
- * correspond to REPOS_RELPATH@REV.
- * If no such nodes exist, return an empty array.
+ * correspond to REPOS_RELPATH. If no such nodes exist, return an empty array.
*
* Note that this function returns each and every such node that is known
* in the WC, including, for example, nodes that were children of a directory
@@ -3501,7 +3500,6 @@ svn_wc__find_repos_node_in_wc(apr_array_
svn_wc__db_t *db,
const char *wri_abspath,
const char *repos_relpath,
- svn_revnum_t rev,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* @} */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic