You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2012/05/04 17:46:31 UTC
svn commit: r1334041 - in /subversion/trunk/subversion/libsvn_wc:
wc-queries.sql wc_db.c
Author: philip
Date: Fri May 4 15:46:31 2012
New Revision: 1334041
URL: http://svn.apache.org/viewvc?rev=1334041&view=rev
Log:
For the experimental follow-moved-to code: verify that the final
moved-here row points back at the moved-to node.
* subversion/libsvn_wc/wc_db.c
(follow_moved_to): Add repos_path and revision parameters, check
final moved-here points back.
(svn_wc__db_follow_moved_to): Pass new parameters.
* subversion/libsvn_wc/wc-queries.sql
(STMT_SELECT_OP_DEPTH_MOVED_TO): Select multiple rows.
(STMT_SELECT_MOVED_HERE): Select more columns.
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=1334041&r1=1334040&r2=1334041&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri May 4 15:46:31 2012
@@ -299,11 +299,12 @@ WHERE nodes_work.wc_id = ?1 AND nodes_wo
AND op_depth > 0)
-- STMT_SELECT_OP_DEPTH_MOVED_TO
-SELECT op_depth, moved_to
+SELECT op_depth, moved_to, repos_path, revision
FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2
- AND op_depth = (SELECT MIN(op_depth) FROM nodes
+ AND op_depth <= (SELECT MIN(op_depth) FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3)
+ORDER BY op_depth DESC
-- STMT_SELECT_MOVED_TO
SELECT moved_to
@@ -311,7 +312,7 @@ FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3
-- STMT_SELECT_MOVED_HERE
-SELECT moved_here, presence
+SELECT moved_here, presence, repos_path, revision
FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth >= ?3
ORDER BY op_depth
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1334041&r1=1334040&r2=1334041&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri May 4 15:46:31 2012
@@ -10183,6 +10183,8 @@ svn_wc__db_scan_addition(svn_wc__db_stat
static svn_error_t *
follow_moved_to(apr_array_header_t **moved_tos,
int op_depth,
+ const char *repos_path,
+ svn_revnum_t revision,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
apr_pool_t *result_pool,
@@ -10194,6 +10196,8 @@ follow_moved_to(apr_array_header_t **mov
const char *ancestor_relpath, *node_moved_to = NULL;
int i;
+ SVN_ERR_ASSERT((!op_depth && !repos_path) || (op_depth && repos_path));
+
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,
@@ -10203,6 +10207,19 @@ follow_moved_to(apr_array_header_t **mov
{
working_op_depth = svn_sqlite__column_int(stmt, 0);
node_moved_to = svn_sqlite__column_text(stmt, 1, result_pool);
+ if (!repos_path)
+ {
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ if (!have_row || svn_sqlite__column_revnum(stmt, 0))
+ return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND,
+ svn_sqlite__reset(stmt),
+ _("The base node '%s' was not found."),
+ path_for_error_message(wcroot,
+ local_relpath,
+ scratch_pool));
+ repos_path = svn_sqlite__column_text(stmt, 2, scratch_pool);
+ revision = svn_sqlite__column_revnum(stmt, 3);
+ }
}
SVN_ERR(svn_sqlite__reset(stmt));
@@ -10215,10 +10232,11 @@ follow_moved_to(apr_array_header_t **mov
SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, node_moved_to,
relpath_depth(node_moved_to)));
SVN_ERR(svn_sqlite__step(&have_row2, stmt));
- if (!have_row2 || !svn_sqlite__column_int(stmt, 0))
+ if (!have_row2 || !svn_sqlite__column_int(stmt, 0)
+ || revision != svn_sqlite__column_revnum(stmt, 3)
+ || strcmp(repos_path, svn_sqlite__column_text(stmt, 2, NULL)))
node_moved_to = NULL;
SVN_ERR(svn_sqlite__reset(stmt));
- /* verify repos_path points back? */
}
if (node_moved_to)
@@ -10294,7 +10312,7 @@ follow_moved_to(apr_array_header_t **mov
APR_ARRAY_PUSH(*moved_tos, struct svn_wc__db_moved_to_t *) = moved_to;
SVN_ERR(follow_moved_to(moved_tos, relpath_depth(ancestor_moved_to),
- wcroot, node_moved_to,
+ repos_path, revision, wcroot, node_moved_to,
result_pool, scratch_pool));
break;
}
@@ -10323,7 +10341,8 @@ svn_wc__db_follow_moved_to(apr_array_hea
sizeof(struct svn_wc__db_moved_to_t *));
/* ### Wrap in a transaction */
- SVN_ERR(follow_moved_to(moved_tos, 0, wcroot, local_relpath,
+ SVN_ERR(follow_moved_to(moved_tos, 0, NULL, SVN_INVALID_REVNUM,
+ wcroot, local_relpath,
result_pool, scratch_pool));
/* ### Convert moved_to to abspath */