You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/10/17 23:52:19 UTC
svn commit: r1185392 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c
update_editor.c wc_db.c wc_db.h
Author: stsp
Date: Mon Oct 17 21:52:18 2011
New Revision: 1185392
URL: http://svn.apache.org/viewvc?rev=1185392&view=rev
Log:
During updates, auto-merge newly added directories into locally moved-away
directories.
* subversion/libsvn_wc/update_editor.c
(dir_baton, make_dir_baton): Add MOVED_TO_OP_ROOT_ABSPATH.
(open_root, open_directory): Scan for the op-root of a move as well
as the moved-to abspath of the directory itself.
(add_directory): If the parent directory was moved-away, prepare to add
the incoming directory at the new location by constructing a moved-to
abspath for the incoming directory. Also remember the op-root of the move.
Use the moved-to abspath in notifications if applicable.
(close_directory): After completing an update of a moved-away directory
at the pre-move location, perform an in-DB copy of the directory meta
data to the post-move location and ensure that move information stays
present. Also make sure that it exists on disk at the post-move location.
This also handles incoming directories which are added as children
of moved-away directories.
* subversion/libsvn_wc/wc_db.c,
subversion/libsvn_wc/wc_db.h
(svn_wc__db_op_copy_dir): Add new parameter IS_MOVE, used by
update_editor.c:close_directory() to properly copy op-roots of moves.
* subversion/libsvn_wc/adm_ops.c
(svn_wc_add4): Update caller of svn_wc__db_op_copy_dir().
Modified:
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/update_editor.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1185392&r1=1185391&r2=1185392&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon Oct 17 21:52:18 2011
@@ -1165,7 +1165,7 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
repos_relpath,
repos_root_url, repos_uuid,
copyfrom_rev,
- NULL /* children */, depth,
+ NULL /* children */, FALSE, depth,
NULL /* conflicts */,
NULL /* work items */,
scratch_pool));
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1185392&r1=1185391&r2=1185392&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Mon Oct 17 21:52:18 2011
@@ -35,6 +35,7 @@
#include "svn_types.h"
#include "svn_pools.h"
#include "svn_delta.h"
+#include "svn_hash.h"
#include "svn_string.h"
#include "svn_dirent_uri.h"
#include "svn_path.h"
@@ -283,10 +284,12 @@ struct dir_baton
/* Absolute path of this directory */
const char *local_abspath;
- /* Absolute path to the new location of the directory if it was moved away.
+ /* Absolute path to the new location of the directory if it was moved away,
+ * and the op-root of the move operation.
* This is set on the root of a move operation and all children.
* If the directory was not moved away, this is NULL. */
const char *moved_to_abspath;
+ const char *moved_to_op_root_abspath;
/* The repository relative path this directory will correspond to. */
const char *new_relpath;
@@ -623,6 +626,7 @@ make_dir_baton(struct dir_baton **d_p,
d->changed_rev = SVN_INVALID_REVNUM;
d->not_present_files = apr_hash_make(dir_pool);
d->moved_to_abspath = NULL;
+ d->moved_to_op_root_abspath = NULL;
/* Copy some flags from the parent baton */
if (pb)
@@ -1158,8 +1162,8 @@ open_root(void *edit_baton,
}
else if (status == svn_wc__db_status_deleted)
SVN_ERR(svn_wc__db_scan_deletion(NULL, &db->moved_to_abspath, NULL,
- NULL, eb->db, db->local_abspath,
- db->pool, pool));
+ &db->moved_to_op_root_abspath,
+ eb->db, db->local_abspath, db->pool, pool));
return SVN_NO_ERROR;
}
@@ -2335,6 +2339,16 @@ add_directory(const char *path,
do_notification(eb, db->local_abspath, svn_node_dir,
svn_wc_notify_tree_conflict, pool);
}
+ else if (wc_kind == svn_kind_unknown &&
+ versioned_locally_and_present == FALSE &&
+ pb->moved_to_abspath)
+ {
+ /* The parent directory of the directory we're adding was moved.
+ * Add the new directory at the new location. */
+ db->moved_to_abspath = svn_dirent_join(pb->moved_to_abspath,
+ db->name, db->pool);
+ db->moved_to_op_root_abspath = pb->moved_to_op_root_abspath;
+ }
@@ -2356,7 +2370,9 @@ add_directory(const char *path,
db->already_notified = TRUE;
- do_notification(eb, db->local_abspath, svn_node_dir, action, pool);
+ do_notification(eb, db->moved_to_abspath ? db->moved_to_abspath
+ : db->local_abspath,
+ svn_node_dir, action, pool);
}
return SVN_NO_ERROR;
@@ -2468,7 +2484,8 @@ open_directory(const char *path,
}
else if (status == svn_wc__db_status_deleted)
SVN_ERR(svn_wc__db_scan_deletion(NULL, &db->moved_to_abspath, NULL,
- NULL, eb->db, db->local_abspath,
+ &db->moved_to_op_root_abspath,
+ eb->db, db->local_abspath,
db->pool, pool));
/* Check for conflicts only when we haven't already recorded
@@ -2917,6 +2934,41 @@ close_directory(void *dir_baton,
new_actual_props,
all_work_items,
scratch_pool));
+
+ if (db->moved_to_abspath)
+ {
+ /* Perform another in-DB move of the directory to sync meta-data
+ * of the moved-away node with the new BASE node. */
+ apr_array_header_t *children = NULL;
+ apr_hash_t *children_hash = apr_hash_get(eb->dir_dirents,
+ db->new_relpath,
+ APR_HASH_KEY_STRING);
+ /* The op-root of the move needs to retain its moved-here flag.
+ * Its children are normal copied children. */
+ svn_boolean_t is_move = (strcmp(db->moved_to_op_root_abspath,
+ db->moved_to_abspath) == 0);
+
+ /* Add the new directory as a copy and create it on disk. */
+ if (children_hash)
+ SVN_ERR(svn_hash_keys(&children, children_hash, scratch_pool));
+ SVN_ERR(svn_wc__db_op_copy_dir(eb->db, db->moved_to_abspath,
+ new_actual_props ? new_actual_props
+ : actual_props,
+ db->changed_rev,
+ db->changed_date,
+ db->changed_author,
+ db->new_relpath,
+ eb->repos_root,
+ eb->repos_uuid,
+ *eb->target_revision,
+ children,
+ is_move,
+ db->ambient_depth,
+ NULL /* conflict */,
+ NULL, /* no work, just modify DB */
+ scratch_pool));
+ SVN_ERR(svn_wc__ensure_directory(db->moved_to_abspath, pool));
+ }
}
/* Process all of the queued work items for this directory. */
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1185392&r1=1185391&r2=1185392&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Oct 17 21:52:18 2011
@@ -4178,6 +4178,7 @@ svn_wc__db_op_copy_dir(svn_wc__db_t *db,
const char *original_uuid,
svn_revnum_t original_revision,
const apr_array_header_t *children,
+ svn_boolean_t is_move,
svn_depth_t depth,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
@@ -4209,7 +4210,7 @@ svn_wc__db_op_copy_dir(svn_wc__db_t *db,
iwb.changed_rev = changed_rev;
iwb.changed_date = changed_date;
iwb.changed_author = changed_author;
- iwb.moved_here = FALSE;
+ iwb.moved_here = is_move;
if (original_root_url != NULL)
{
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1185392&r1=1185391&r2=1185392&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Mon Oct 17 21:52:18 2011
@@ -1229,6 +1229,7 @@ svn_wc__db_op_copy_dir(svn_wc__db_t *db,
const char *original_uuid,
svn_revnum_t original_revision,
const apr_array_header_t *children,
+ svn_boolean_t is_move,
svn_depth_t depth,
const svn_skel_t *conflict,
const svn_skel_t *work_items,