Author: stsp
Date: Fri Feb 24 08:07:57 2012
New Revision: 1293124
URL: http://svn.apache.org/viewvc?rev=1293124&view=rev
Log:
On the multi-layer-move branch, add/tweak various comments and docstrings.
* subversion/libsvn_wc/wc-queries.sql
(STMT_SELECT_MOVED_PAIR, STMT_SELECT_MOVED_PAIR2): Add docstrings.
* subversion/libsvn_wc/wc_db.c
(moved_node_t): Put simple examples before more complicated ones.
(delete_node): Add/tweak comments to clarify the intentions behind this code.
Modified:
subversion/branches/multi-layer-moves/subversion/libsvn_wc/wc-queries.sql
subversion/branches/multi-layer-moves/subversion/libsvn_wc/wc_db.c
Modified:
subversion/branches/multi-layer-moves/subversion/libsvn_wc/wc-queries.sql
URL:
http://svn.apache.org/viewvc/subversion/branches/multi-layer-moves/subversion/libsvn_wc/wc-queries.sql?rev=1293124&r1=1293123&r2=1293124&view=diff
==============================================================================
--- subversion/branches/multi-layer-moves/subversion/libsvn_wc/wc-queries.sql
(original)
+++ subversion/branches/multi-layer-moves/subversion/libsvn_wc/wc-queries.sql
Fri Feb 24 08:07:57 2012
@@ -1404,6 +1404,11 @@ SELECT moved_to, local_relpath FROM node
WHERE wc_id = ?1 AND op_depth > 0
AND IS_STRICT_DESCENDANT_OF(moved_to, ?2)
+/* This statement returns pairs of move-roots below the path ?2 in WC_ID ?1,
+ * where the destination of the move is within the subtree rooted at path ?2,
+ * and the source of the move either lies outside of the subtree rooted at
+ * path ?2 or is not visible in the WORKING tree rooted at path ?2.
+ * It also returns the op-depth of the source of the move. */
-- STMT_SELECT_MOVED_PAIR
SELECT local_relpath, moved_to, op_depth FROM nodes_current
WHERE wc_id = ?1
@@ -1415,6 +1420,9 @@ WHERE wc_id = ?1
AND op_depth > ?3
AND op_depth < nodes_current.op_depth))
+/* This statement returns pairs of move-roots below the path ?2 in WC_ID ?1,
+ * where the source of the move is within the subtree rooted at path ?2, and
+ * the destination of the move is outside the subtree rooted at path ?2. */
-- STMT_SELECT_MOVED_PAIR2
SELECT local_relpath, moved_to FROM nodes_current
WHERE wc_id = ?1
Modified: subversion/branches/multi-layer-moves/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/branches/multi-layer-moves/subversion/libsvn_wc/wc_db.c?rev=1293124&r1=1293123&r2=1293124&view=diff
==============================================================================
--- subversion/branches/multi-layer-moves/subversion/libsvn_wc/wc_db.c
(original)
+++ subversion/branches/multi-layer-moves/subversion/libsvn_wc/wc_db.c Fri Feb
24 08:07:57 2012
@@ -6296,25 +6296,18 @@ struct op_delete_baton_t {
* a moved-away subtree is moved again: mv A B; mv B C
* The second move requires rewriting moved-to info at or within A.
*
+ * Another example is a move of a subtree which had nodes moved into it:
+ * mv A B/F; mv B G
+ * This requires rewriting such that A/F is marked has having moved to G/F.
+ *
* Another case is where a node becomes a nested moved node.
* A nested move happens when a subtree child is moved before or after
* the subtree itself is moved. For example:
- * mv A/F A/G
- * mv A B
+ * mv A/F A/G; mv A B
* In this case, the move A/F -> A/G is rewritten to B/F -> B/G.
- *
- * Note that the following sequence results in the same DB state
- * as the above sequence:
- * mv A B
- * mv B/F B/G
+ * Note that the following sequence results in the same DB state:
+ * mv A B; mv B/F B/G
* We do not care about the order the moves were performed in.
- *
- * Another example is a move of a subtree which had nodes moved into it:
- * mv A B/F
- * mv B G
- * This requires rewriting such that A/F is marked has having moved
- * to G/F.
- *
* For details, see http://wiki.apache.org/subversion/MultiLayerMoves
*/
struct moved_node_t {
@@ -6375,6 +6368,9 @@ delete_node(void *baton,
struct moved_node_t *moved_node
= apr_palloc(scratch_pool, sizeof(struct moved_node_t));
+ /* The node is being moved-away.
+ * Figure out if the node was moved-here before, or whether this
+ * is the first time the node is moved. */
if (status == svn_wc__db_status_added)
SVN_ERR(scan_addition(&status, NULL, NULL, NULL, NULL, NULL, NULL,
&moved_node->local_relpath, NULL,
@@ -6384,6 +6380,7 @@ delete_node(void *baton,
if (status != svn_wc__db_status_moved_here)
{
+ /* The node is being moved for the first time. */
moved_node->local_relpath = local_relpath;
moved_node->op_depth = b->delete_depth;
}
@@ -6395,8 +6392,7 @@ delete_node(void *baton,
APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *) = moved_node;
/* If a subtree is being moved-away, we need to update moved-to
- * information for all children that were moved into or within
- * this subtree. */
+ * information for all children that were moved into this subtree. */
if (kind == svn_kind_dir)
{
apr_pool_t *iterpool;