From commits-return-48936-archive-asf-public=cust-asf.ponee.io@subversion.apache.org Tue Jun 19 15:05:41 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 570E1180634 for ; Tue, 19 Jun 2018 15:05:41 +0200 (CEST) Received: (qmail 14929 invoked by uid 500); 19 Jun 2018 13:05:40 -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 14919 invoked by uid 99); 19 Jun 2018 13:05:40 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Jun 2018 13:05:40 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id DE8AD3A0057 for ; Tue, 19 Jun 2018 13:05:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1833836 - /subversion/trunk/subversion/libsvn_client/conflicts.c Date: Tue, 19 Jun 2018 13:05:39 -0000 To: commits@subversion.apache.org From: stsp@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20180619130539.DE8AD3A0057@svn01-us-west.apache.org> Author: stsp Date: Tue Jun 19 13:05:39 2018 New Revision: 1833836 URL: http://svn.apache.org/viewvc?rev=1833836&view=rev Log: Fix issue #4740 "conflict resolver searches too far back with file edit vs move" In case of the reproduction script attached to issue #4740, traversal now stops at r2 instead of going back all the way back to r1. In real-life cases this change should avoid scanning back through all of history, which is a very expensive operation on repositories with a large amount of revisions. * subversion/libsvn_client/conflicts.c (conflict_tree_get_details_local_missing): Try to limit history traversal of the find_revision_for_suspected_deletion() helper function to a youngest common ancestor, instead of hard-coding the end revision to zero. Only traverse all of history as a fallback in case no YCA could be found. The YCA was already calculated later in this function, but it was only used to limit another traversal which attempts to find moves on the other side of the merge, in case no deleted revision can be determined for the victim. Calculating the same YCA earlier allows us to limit the history traversal process which looks for a revision which deleted the victim, too. Modified: subversion/trunk/subversion/libsvn_client/conflicts.c Modified: subversion/trunk/subversion/libsvn_client/conflicts.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1833836&r1=1833835&r2=1833836&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_client/conflicts.c (original) +++ subversion/trunk/subversion/libsvn_client/conflicts.c Tue Jun 19 13:05:39 2018 @@ -2624,6 +2624,10 @@ conflict_tree_get_details_local_missing( svn_revnum_t related_peg_rev; const char *repos_root_url; const char *repos_uuid; + const char *url, *corrected_url; + svn_ra_session_t *ra_session; + svn_client__pathrev_t *yca_loc; + svn_revnum_t end_rev; SVN_ERR(svn_client_conflict_get_incoming_old_repos_location( &old_repos_relpath, &old_rev, NULL, conflict, @@ -2660,51 +2664,50 @@ conflict_tree_get_details_local_missing( (old_rev < new_rev ? old_repos_relpath : new_repos_relpath), (old_rev < new_rev ? old_rev : new_rev), conflict, ctx, scratch_pool, scratch_pool)); - + + /* Set END_REV to our best guess of the nearest YCA revision. */ + url = svn_path_url_add_component2(repos_root_url, related_repos_relpath, + scratch_pool); + SVN_ERR(svn_client__open_ra_session_internal(&ra_session, + &corrected_url, + url, NULL, NULL, + FALSE, + FALSE, + ctx, + scratch_pool, + scratch_pool)); + SVN_ERR(find_nearest_yca(&yca_loc, related_repos_relpath, related_peg_rev, + parent_repos_relpath, parent_peg_rev, + repos_root_url, repos_uuid, ra_session, ctx, + scratch_pool, scratch_pool)); + if (yca_loc) + { + end_rev = yca_loc->rev; + + /* END_REV must be smaller than RELATED_PEG_REV, else the call + to find_moves_in_natural_history() below will error out. */ + if (end_rev >= related_peg_rev) + end_rev = related_peg_rev > 0 ? related_peg_rev - 1 : 0; + } + else + end_rev = 0; /* ### We might walk through all of history... */ + SVN_ERR(find_revision_for_suspected_deletion( &deleted_rev, &deleted_rev_author, &replacing_node_kind, &moves, conflict, deleted_basename, parent_repos_relpath, - parent_peg_rev, 0, related_repos_relpath, related_peg_rev, + parent_peg_rev, end_rev, related_repos_relpath, related_peg_rev, ctx, conflict->pool, scratch_pool)); /* If the victim was not deleted then check if the related path was moved. */ if (deleted_rev == SVN_INVALID_REVNUM) { const char *victim_abspath; - svn_ra_session_t *ra_session; - const char *url, *corrected_url; - svn_client__pathrev_t *yca_loc; - svn_revnum_t end_rev; svn_node_kind_t related_node_kind; /* ### The following describes all moves in terms of forward-merges, * should do we something else for reverse-merges? */ victim_abspath = svn_client_conflict_get_local_abspath(conflict); - url = svn_path_url_add_component2(repos_root_url, related_repos_relpath, - scratch_pool); - SVN_ERR(svn_client__open_ra_session_internal(&ra_session, - &corrected_url, - url, NULL, NULL, - FALSE, - FALSE, - ctx, - scratch_pool, - scratch_pool)); - - /* Set END_REV to our best guess of the nearest YCA revision. */ - SVN_ERR(find_nearest_yca(&yca_loc, related_repos_relpath, related_peg_rev, - parent_repos_relpath, parent_peg_rev, - repos_root_url, repos_uuid, ra_session, ctx, - scratch_pool, scratch_pool)); - if (yca_loc == NULL) - return SVN_NO_ERROR; - end_rev = yca_loc->rev; - - /* END_REV must be smaller than RELATED_PEG_REV, else the call - to find_moves_in_natural_history() below will error out. */ - if (end_rev >= related_peg_rev) - end_rev = related_peg_rev > 0 ? related_peg_rev - 1 : 0; SVN_ERR(svn_ra_check_path(ra_session, "", related_peg_rev, &related_node_kind, scratch_pool));