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 30DD41758A for ; Wed, 4 Feb 2015 14:32:11 +0000 (UTC) Received: (qmail 49938 invoked by uid 500); 4 Feb 2015 14:31:56 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 49903 invoked by uid 500); 4 Feb 2015 14:31:56 -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 49891 invoked by uid 99); 4 Feb 2015 14:31:56 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Feb 2015 14:31:56 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id BBB01AC006D; Wed, 4 Feb 2015 14:31:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1657253 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c Date: Wed, 04 Feb 2015 14:31:55 -0000 To: commits@subversion.apache.org From: rhuijben@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150204143155.BBB01AC006D@hades.apache.org> Author: rhuijben Date: Wed Feb 4 14:31:55 2015 New Revision: 1657253 URL: http://svn.apache.org/r1657253 Log: Make some op-depth diagnostics code in wc_db capable of handling moves that don't copy the exact whole layer. (Which is possible during conflict handling and when the root of a mixed revision move is represented as move) * subversion/libsvn_wc/wc-queries.sql (STMT_SELECT_OP_DEPTH_MOVED_TO): Simplify query to avoid the case where values might be NULL. * subversion/libsvn_wc/wc_db.c (follow_moved_to): Update query usage. Add some comments. Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql subversion/trunk/subversion/libsvn_wc/wc_db.c Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1657253&r1=1657252&r2=1657253&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original) +++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Wed Feb 4 14:31:55 2015 @@ -452,16 +452,12 @@ WHERE wc_id = ?1 AND local_relpath = ?2 ORDER BY op_depth DESC -- STMT_SELECT_OP_DEPTH_MOVED_TO -SELECT n.op_depth, n.moved_to, p.repos_path, p.revision -FROM nodes p -LEFT JOIN nodes n - ON p.wc_id=n.wc_id AND p.local_relpath = n.local_relpath - AND n.op_depth = (SELECT MIN(d.op_depth) - FROM nodes d - WHERE d.wc_id = ?1 - AND d.local_relpath = n.local_relpath - AND d.op_depth > ?3) -WHERE p.wc_id = ?1 AND p.local_relpath = ?2 AND p.op_depth = ?3 +SELECT op_depth, moved_to +FROM nodes +WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3 + AND EXISTS(SELECT * from nodes + WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3) +ORDER BY op_depth ASC LIMIT 1 -- STMT_SELECT_MOVED_TO Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1657253&r1=1657252&r2=1657253&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original) +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Feb 4 14:31:55 2015 @@ -12518,7 +12518,7 @@ svn_wc__db_scan_moved(const char **moved return SVN_NO_ERROR; } -/* ### +/* ### Recursive helper for svn_wc__db_follow_moved_to() */ static svn_error_t * follow_moved_to(svn_wc__db_wcroot_t *wcroot, @@ -12530,11 +12530,13 @@ follow_moved_to(svn_wc__db_wcroot_t *wcr { svn_sqlite__stmt_t *stmt; svn_boolean_t have_row; - int working_op_depth; + int shadowing_op_depth; const char *ancestor_relpath; const char *node_moved_to = NULL; int i; + /* Obtain the depth of the node directly shadowing local_relpath + as it exists at OP_DEPTH, and perhaps moved to info */ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_SELECT_OP_DEPTH_MOVED_TO)); SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath, @@ -12542,7 +12544,7 @@ follow_moved_to(svn_wc__db_wcroot_t *wcr SVN_ERR(svn_sqlite__step(&have_row, stmt)); if (have_row) { - working_op_depth = svn_sqlite__column_int(stmt, 0); + shadowing_op_depth = svn_sqlite__column_int(stmt, 0); node_moved_to = svn_sqlite__column_text(stmt, 1, result_pool); if (node_moved_to) @@ -12550,7 +12552,7 @@ follow_moved_to(svn_wc__db_wcroot_t *wcr struct svn_wc__db_moved_to_t *moved_to; moved_to = apr_palloc(result_pool, sizeof(*moved_to)); - moved_to->op_depth = working_op_depth; + moved_to->op_depth = shadowing_op_depth; moved_to->local_relpath = node_moved_to; APR_ARRAY_PUSH(*moved_tos, struct svn_wc__db_moved_to_t *) = moved_to; } @@ -12559,25 +12561,28 @@ follow_moved_to(svn_wc__db_wcroot_t *wcr SVN_ERR(svn_sqlite__reset(stmt)); if (!have_row) - return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL, - _("The node '%s' was not found."), - path_for_error_message(wcroot, local_relpath, - scratch_pool)); + { + /* Node is not shadowed, so not moved */ + return SVN_NO_ERROR; + } else if (node_moved_to) - return SVN_NO_ERROR; - + { + /* Moved directly, so we have the final location */ + return SVN_NO_ERROR; + } /* Need to handle being moved via an ancestor. */ ancestor_relpath = local_relpath; - for (i = relpath_depth(local_relpath); i > working_op_depth; --i) + for (i = relpath_depth(local_relpath); i > shadowing_op_depth; --i) { const char *ancestor_moved_to; + svn_boolean_t have_row; ancestor_relpath = svn_relpath_dirname(ancestor_relpath, scratch_pool); SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_SELECT_MOVED_TO)); SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, ancestor_relpath, - working_op_depth)); + shadowing_op_depth)); SVN_ERR(svn_sqlite__step_row(stmt)); ancestor_moved_to = svn_sqlite__column_text(stmt, 0, scratch_pool); @@ -12593,7 +12598,7 @@ follow_moved_to(svn_wc__db_wcroot_t *wcr result_pool); moved_to = apr_palloc(result_pool, sizeof(*moved_to)); - moved_to->op_depth = working_op_depth; + moved_to->op_depth = shadowing_op_depth; moved_to->local_relpath = node_moved_to; APR_ARRAY_PUSH(*moved_tos, struct svn_wc__db_moved_to_t *) = moved_to;