You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2015/02/12 16:50:48 UTC
svn commit: r1659291 [4/21] - in /subversion/branches/remove-log-addressing:
./ subversion/include/ subversion/include/private/ subversion/libsvn_delta/
subversion/libsvn_fs_base/ subversion/libsvn_fs_fs/ subversion/libsvn_fs_x/
subversion/libsvn_repos...
Modified: subversion/branches/remove-log-addressing/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/libsvn_wc/wc_db_update_move.c?rev=1659291&r1=1659290&r2=1659291&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/branches/remove-log-addressing/subversion/libsvn_wc/wc_db_update_move.c Thu Feb 12 15:50:47 2015
@@ -135,6 +135,44 @@ verify_write_lock(svn_wc__db_wcroot_t *w
return SVN_NO_ERROR;
}
+/* In our merge conflicts we record the move_op_src path, which is essentially
+ the depth at which what was moved is marked deleted. The problem is that
+ this depth is not guaranteed to be stable, because somebody might just
+ remove another ancestor, or revert one.
+
+ To work around this problem we locate the layer below this path, and use
+ that to pinpoint whatever is moved.
+
+ For a path SRC_RELPATH that was deleted by an operation rooted at
+ DELETE_OP_DEPTH find the op-depth at which the node was originally added.
+ */
+static svn_error_t *
+find_src_op_depth(int *src_op_depth,
+ svn_wc__db_wcroot_t *wcroot,
+ const char *src_relpath,
+ int delete_op_depth,
+ apr_pool_t *scratch_pool)
+{
+ svn_sqlite__stmt_t *stmt;
+ svn_boolean_t have_row;
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_HIGHEST_WORKING_NODE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
+ src_relpath, delete_op_depth));
+
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ if (have_row)
+ *src_op_depth = svn_sqlite__column_int(stmt, 0);
+ SVN_ERR(svn_sqlite__reset(stmt));
+ if (!have_row)
+ return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
+ _("'%s' is not deleted"),
+ path_for_error_message(wcroot, src_relpath,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
/*
* Receiver code.
@@ -159,6 +197,9 @@ typedef struct update_move_baton_t {
svn_wc_operation_t operation;
svn_wc_conflict_version_t *old_version;
svn_wc_conflict_version_t *new_version;
+
+ svn_cancel_func_t cancel_func;
+ void *cancel_baton;
} update_move_baton_t;
/* Per node flags for tree conflict collection */
@@ -187,6 +228,7 @@ typedef struct node_move_baton_t
static svn_error_t *
update_move_list_add(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ svn_wc__db_t *db,
svn_wc_notify_action_t action,
svn_node_kind_t kind,
svn_wc_notify_state_t content_state,
@@ -199,15 +241,25 @@ update_move_list_add(svn_wc__db_wcroot_t
if (conflict)
{
- action = svn_wc_notify_tree_conflict;
- content_state = svn_wc_notify_state_inapplicable;
- prop_state = svn_wc_notify_state_inapplicable;
+ svn_boolean_t tree_conflict;
+
+ SVN_ERR(svn_wc__conflict_read_info(NULL, NULL, NULL, NULL,
+ &tree_conflict,
+ db, wcroot->abspath, conflict,
+ scratch_pool, scratch_pool));
+ if (tree_conflict)
+ {
+ action = svn_wc_notify_tree_conflict;
+ content_state = svn_wc_notify_state_inapplicable;
+ prop_state = svn_wc_notify_state_inapplicable;
+ }
}
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_INSERT_UPDATE_MOVE_LIST));
- SVN_ERR(svn_sqlite__bindf(stmt, "sdddd", local_relpath,
- action, kind, content_state, prop_state));
+ SVN_ERR(svn_sqlite__bindf(stmt, "sdtdd", local_relpath,
+ action, kind_map_none, kind,
+ content_state, prop_state));
SVN_ERR(svn_sqlite__step_done(stmt));
if (conflict)
@@ -256,7 +308,7 @@ svn_wc__db_update_move_list_notify(svn_w
local_relpath,
iterpool),
action, iterpool);
- notify->kind = svn_sqlite__column_int(stmt, 2);
+ notify->kind = svn_sqlite__column_token(stmt, 2, kind_map_none);
notify->content_state = svn_sqlite__column_int(stmt, 3);
notify->prop_state = svn_sqlite__column_int(stmt, 4);
notify->old_revision = old_revision;
@@ -395,16 +447,10 @@ create_tree_conflict(svn_skel_t **confli
result_pool,
scratch_pool));
- if (reason != svn_wc_conflict_reason_unversioned
- && old_repos_relpath != NULL /* no local additions */)
- {
- conflict_old_version = svn_wc_conflict_version_create2(
+ conflict_old_version = svn_wc_conflict_version_create2(
old_version->repos_url, old_version->repos_uuid,
old_repos_relpath, old_version->peg_rev,
old_kind, scratch_pool);
- }
- else
- conflict_old_version = NULL;
conflict_new_version = svn_wc_conflict_version_create2(
new_version->repos_url, new_version->repos_uuid,
@@ -435,7 +481,6 @@ create_node_tree_conflict(svn_skel_t **c
const char *dst_local_relpath,
svn_node_kind_t old_kind,
svn_node_kind_t new_kind,
- const char *old_repos_relpath,
svn_wc_conflict_reason_t reason,
svn_wc_conflict_action_t action,
const char *move_src_op_root_relpath,
@@ -443,6 +488,18 @@ create_node_tree_conflict(svn_skel_t **c
apr_pool_t *scratch_pool)
{
update_move_baton_t *umb = nmb->umb;
+ const char *dst_repos_relpath;
+ const char *dst_root_relpath = svn_relpath_limit(nmb->dst_relpath,
+ nmb->umb->dst_op_depth,
+ scratch_pool);
+
+ dst_repos_relpath =
+ svn_relpath_join(nmb->umb->old_version->path_in_repos,
+ svn_relpath_skip_ancestor(dst_root_relpath,
+ nmb->dst_relpath),
+ scratch_pool);
+
+
return svn_error_trace(
create_tree_conflict(conflict_p, umb->wcroot, dst_local_relpath,
@@ -452,7 +509,7 @@ create_node_tree_conflict(svn_skel_t **c
umb->db,
umb->old_version, umb->new_version,
umb->operation, old_kind, new_kind,
- old_repos_relpath,
+ dst_repos_relpath,
reason, action, move_src_op_root_relpath,
result_pool, scratch_pool));
}
@@ -495,38 +552,36 @@ static svn_error_t *
mark_tc_on_op_root(node_move_baton_t *nmb,
svn_node_kind_t old_kind,
svn_node_kind_t new_kind,
- const char *old_repos_relpath,
svn_wc_conflict_action_t action,
apr_pool_t *scratch_pool)
{
update_move_baton_t *b = nmb->umb;
- const char *conflict_root_relpath = nmb->dst_relpath;
- const char *move_dst_relpath, *dummy1;
- const char *dummy2, *move_src_op_root_relpath;
+ const char *move_dst_relpath;
svn_skel_t *conflict;
SVN_ERR_ASSERT(nmb->shadowed && !nmb->pb->shadowed);
nmb->skip = TRUE;
- SVN_ERR(svn_wc__db_op_depth_moved_to(&move_dst_relpath,
- &dummy1,
- &dummy2,
- &move_src_op_root_relpath,
- b->dst_op_depth,
- b->wcroot, conflict_root_relpath,
- scratch_pool, scratch_pool));
+ if (old_kind == svn_node_none)
+ move_dst_relpath = NULL;
+ else
+ SVN_ERR(svn_wc__db_scan_moved_to_internal(NULL, &move_dst_relpath, NULL,
+ b->wcroot, nmb->dst_relpath,
+ b->dst_op_depth,
+ scratch_pool, scratch_pool));
- SVN_ERR(create_node_tree_conflict(&conflict, nmb, conflict_root_relpath,
+ SVN_ERR(create_node_tree_conflict(&conflict, nmb, nmb->dst_relpath,
old_kind, new_kind,
- old_repos_relpath,
(move_dst_relpath
? svn_wc_conflict_reason_moved_away
: svn_wc_conflict_reason_deleted),
- action, move_src_op_root_relpath,
+ action, move_dst_relpath
+ ? nmb->dst_relpath
+ : NULL,
scratch_pool, scratch_pool));
- SVN_ERR(update_move_list_add(b->wcroot, conflict_root_relpath,
+ SVN_ERR(update_move_list_add(b->wcroot, nmb->dst_relpath, b->db,
svn_wc_notify_tree_conflict,
new_kind,
svn_wc_notify_state_inapplicable,
@@ -559,10 +614,9 @@ mark_node_edited(node_move_baton_t *nmb,
if (nmb->shadowed && !(nmb->pb && nmb->pb->shadowed))
{
svn_node_kind_t dst_kind, src_kind;
- const char *dst_repos_relpath;
SVN_ERR(svn_wc__db_depth_get_info(NULL, &dst_kind, NULL,
- &dst_repos_relpath, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
nmb->umb->wcroot, nmb->dst_relpath,
nmb->umb->dst_op_depth,
@@ -577,7 +631,6 @@ mark_node_edited(node_move_baton_t *nmb,
SVN_ERR(mark_tc_on_op_root(nmb,
dst_kind, src_kind,
- dst_repos_relpath,
svn_wc_conflict_action_edit,
scratch_pool));
}
@@ -607,61 +660,61 @@ tc_editor_add_directory(node_move_baton_
apr_pool_t *scratch_pool)
{
update_move_baton_t *b = nmb->umb;
- const char *move_dst_repos_relpath;
const char *local_abspath;
svn_node_kind_t wc_kind;
svn_skel_t *work_item = NULL;
svn_skel_t *conflict = NULL;
+ svn_wc_conflict_reason_t reason = svn_wc_conflict_reason_unversioned;
SVN_ERR(mark_parent_edited(nmb, scratch_pool));
if (nmb->skip)
return SVN_NO_ERROR;
- /* We can't read the information from the pre-add node to obtain the
- relpath, but in WORKING we can just calculate it from the op-root */
- {
- const char *dst_op_root_relpath = svn_relpath_limit(nmb->pb->dst_relpath,
- b->dst_op_depth,
- scratch_pool);
- SVN_ERR(svn_wc__db_depth_get_info(NULL, NULL, NULL,
- &move_dst_repos_relpath, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL,
- b->wcroot, dst_op_root_relpath,
- b->dst_op_depth,
- scratch_pool, scratch_pool));
-
- move_dst_repos_relpath =
- svn_relpath_join(move_dst_repos_relpath,
- svn_relpath_skip_ancestor(dst_op_root_relpath,
- relpath),
- scratch_pool);
- }
-
if (nmb->shadowed)
{
- SVN_ERR(mark_tc_on_op_root(nmb,
- svn_node_none, svn_node_dir,
- move_dst_repos_relpath,
- svn_wc_conflict_action_add,
- scratch_pool));
- return SVN_NO_ERROR;
+ svn_wc__db_status_t status;
+
+ SVN_ERR(svn_wc__db_read_info_internal(&status, &wc_kind, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ b->wcroot, relpath,
+ scratch_pool, scratch_pool));
+
+ if (status == svn_wc__db_status_deleted)
+ reason = svn_wc_conflict_reason_deleted;
+ else if (status != svn_wc__db_status_added)
+ wc_kind = svn_node_none;
+ else if (old_kind == svn_node_none)
+ reason = svn_wc_conflict_reason_added;
+ else
+ reason = svn_wc_conflict_reason_replaced;
}
+ else
+ wc_kind = svn_node_none;
- /* Check for unversioned tree-conflict */
local_abspath = svn_dirent_join(b->wcroot->abspath, relpath, scratch_pool);
- SVN_ERR(svn_io_check_path(local_abspath, &wc_kind, scratch_pool));
- if (wc_kind == old_kind)
+ if (wc_kind == svn_node_none)
+ {
+ /* Check for unversioned tree-conflict */
+ SVN_ERR(svn_io_check_path(local_abspath, &wc_kind, scratch_pool));
+ }
+
+ if (!nmb->shadowed && wc_kind == old_kind)
wc_kind = svn_node_none; /* Node will be gone once we install */
- if (wc_kind != svn_node_none)
+ if (wc_kind != svn_node_none
+ && (nmb->shadowed || wc_kind != old_kind)) /* replace */
{
SVN_ERR(create_node_tree_conflict(&conflict, nmb, relpath,
- wc_kind, svn_node_dir,
- move_dst_repos_relpath,
- svn_wc_conflict_reason_unversioned,
- svn_wc_conflict_action_add, NULL,
+ old_kind, svn_node_dir,
+ reason,
+ (old_kind == svn_node_none)
+ ? svn_wc_conflict_action_add
+ : svn_wc_conflict_action_replace,
+ NULL,
scratch_pool, scratch_pool));
nmb->skip = TRUE;
}
@@ -671,7 +724,7 @@ tc_editor_add_directory(node_move_baton_
scratch_pool, scratch_pool));
}
- SVN_ERR(update_move_list_add(b->wcroot, relpath,
+ SVN_ERR(update_move_list_add(b->wcroot, relpath, b->db,
(old_kind == svn_node_none)
? svn_wc_notify_update_add
: svn_wc_notify_update_replace,
@@ -691,7 +744,7 @@ tc_editor_add_file(node_move_baton_t *nm
apr_pool_t *scratch_pool)
{
update_move_baton_t *b = nmb->umb;
- const char *move_dst_repos_relpath;
+ svn_wc_conflict_reason_t reason = svn_wc_conflict_reason_unversioned;
svn_node_kind_t wc_kind;
const char *local_abspath;
svn_skel_t *work_item = NULL;
@@ -701,52 +754,48 @@ tc_editor_add_file(node_move_baton_t *nm
if (nmb->skip)
return SVN_NO_ERROR;
- /* We can't read the information from the pre-add node to obtain the
- relpath, but in WORKING we can just calculate it from the op-root */
- {
- const char *dst_op_root_relpath = svn_relpath_limit(nmb->pb->dst_relpath,
- b->dst_op_depth,
- scratch_pool);
- SVN_ERR(svn_wc__db_depth_get_info(NULL, NULL, NULL,
- &move_dst_repos_relpath, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL,
- b->wcroot, dst_op_root_relpath,
- b->dst_op_depth,
- scratch_pool, scratch_pool));
-
- move_dst_repos_relpath =
- svn_relpath_join(move_dst_repos_relpath,
- svn_relpath_skip_ancestor(dst_op_root_relpath,
- relpath),
- scratch_pool);
- }
-
- /* Check for NODES tree-conflict. */
if (nmb->shadowed)
{
- SVN_ERR(mark_tc_on_op_root(nmb,
- svn_node_none, svn_node_file,
- move_dst_repos_relpath,
- svn_wc_conflict_action_add,
- scratch_pool));
- return SVN_NO_ERROR;
+ svn_wc__db_status_t status;
+
+ SVN_ERR(svn_wc__db_read_info_internal(&status, &wc_kind, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ b->wcroot, relpath,
+ scratch_pool, scratch_pool));
+
+ if (status == svn_wc__db_status_deleted)
+ reason = svn_wc_conflict_reason_deleted;
+ else if (status != svn_wc__db_status_added)
+ wc_kind = svn_node_none;
+ else if (old_kind == svn_node_none)
+ reason = svn_wc_conflict_reason_added;
+ else
+ reason = svn_wc_conflict_reason_replaced;
}
+ else
+ wc_kind = svn_node_none;
- /* Check for unversioned tree-conflict */
local_abspath = svn_dirent_join(b->wcroot->abspath, relpath, scratch_pool);
- SVN_ERR(svn_io_check_path(local_abspath, &wc_kind, scratch_pool));
- if (wc_kind == old_kind)
- wc_kind = svn_node_none; /* Node will be gone once we install */
+ if (wc_kind == svn_node_none)
+ {
+ /* Check for unversioned tree-conflict */
+ SVN_ERR(svn_io_check_path(local_abspath, &wc_kind, scratch_pool));
+ }
- if (wc_kind != svn_node_none)
+ if (wc_kind != svn_node_none
+ && (nmb->shadowed || wc_kind != old_kind)) /* replace */
{
SVN_ERR(create_node_tree_conflict(&conflict, nmb, relpath,
- wc_kind, svn_node_file,
- move_dst_repos_relpath,
- svn_wc_conflict_reason_unversioned,
- svn_wc_conflict_action_add, NULL,
+ old_kind, svn_node_file,
+ reason,
+ (old_kind == svn_node_none)
+ ? svn_wc_conflict_action_add
+ : svn_wc_conflict_action_replace,
+ NULL,
scratch_pool, scratch_pool));
nmb->skip = TRUE;
}
@@ -763,7 +812,7 @@ tc_editor_add_file(node_move_baton_t *nm
scratch_pool, scratch_pool));
}
- SVN_ERR(update_move_list_add(b->wcroot, relpath,
+ SVN_ERR(update_move_list_add(b->wcroot, relpath, b->db,
(old_kind == svn_node_none)
? svn_wc_notify_update_add
: svn_wc_notify_update_replace,
@@ -925,8 +974,7 @@ tc_editor_alter_directory(node_move_bato
if (wc_kind != svn_node_none && wc_kind != svn_node_dir)
{
SVN_ERR(create_node_tree_conflict(&conflict_skel, nmb, dst_relpath,
- wc_kind, svn_node_dir,
- NULL /* local obstruction relpath */,
+ svn_node_dir, svn_node_dir,
svn_wc_conflict_reason_obstructed,
svn_wc_conflict_action_edit,
NULL,
@@ -968,7 +1016,7 @@ tc_editor_alter_directory(node_move_bato
scratch_pool, scratch_pool));
}
- SVN_ERR(update_move_list_add(b->wcroot, dst_relpath,
+ SVN_ERR(update_move_list_add(b->wcroot, dst_relpath, b->db,
svn_wc_notify_update_update,
svn_node_dir,
svn_wc_notify_state_inapplicable,
@@ -1028,8 +1076,7 @@ tc_editor_alter_file(node_move_baton_t *
if (wc_kind != svn_node_none && wc_kind != svn_node_file)
{
SVN_ERR(create_node_tree_conflict(&conflict_skel, nmb, dst_relpath,
- wc_kind, svn_node_file,
- NULL /* local obstruction relpath */,
+ svn_node_file, svn_node_file,
svn_wc_conflict_reason_obstructed,
svn_wc_conflict_action_edit,
NULL,
@@ -1101,7 +1148,7 @@ tc_editor_alter_file(node_move_baton_t *
NULL, /* diff3-cmd */
NULL, /* merge options */
propchanges,
- NULL, NULL, /* cancel_func + baton */
+ b->cancel_func, b->cancel_baton,
scratch_pool, scratch_pool));
work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
@@ -1138,7 +1185,7 @@ tc_editor_alter_file(node_move_baton_t *
work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
}
- SVN_ERR(update_move_list_add(b->wcroot, dst_relpath,
+ SVN_ERR(update_move_list_add(b->wcroot, dst_relpath, b->db,
svn_wc_notify_update_update,
svn_node_file,
content_state,
@@ -1157,8 +1204,6 @@ tc_editor_delete(node_move_baton_t *nmb,
{
update_move_baton_t *b = nmb->umb;
svn_sqlite__stmt_t *stmt;
- const char *move_dst_repos_relpath;
- svn_node_kind_t move_dst_kind;
const char *local_abspath;
svn_boolean_t is_modified, is_all_deletes;
svn_skel_t *work_items = NULL;
@@ -1168,21 +1213,13 @@ tc_editor_delete(node_move_baton_t *nmb,
if (nmb->skip)
return SVN_NO_ERROR;
- SVN_ERR(svn_wc__db_depth_get_info(NULL, &move_dst_kind, NULL,
- &move_dst_repos_relpath, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- b->wcroot, relpath, b->dst_op_depth,
- scratch_pool, scratch_pool));
-
/* Check before retracting delete to catch delete-delete
conflicts. This catches conflicts on the node itself; deleted
children are caught as local modifications below.*/
if (nmb->shadowed)
{
SVN_ERR(mark_tc_on_op_root(nmb,
- move_dst_kind,
- svn_node_unknown,
- move_dst_repos_relpath,
+ old_kind, new_kind,
svn_wc_conflict_action_delete,
scratch_pool));
return SVN_NO_ERROR;
@@ -1210,8 +1247,7 @@ tc_editor_delete(node_move_baton_t *nmb,
reason = svn_wc_conflict_reason_edited;
SVN_ERR(create_node_tree_conflict(&conflict, nmb, relpath,
- move_dst_kind, new_kind,
- move_dst_repos_relpath, reason,
+ old_kind, new_kind, reason,
(new_kind == svn_node_none)
? svn_wc_conflict_action_delete
: svn_wc_conflict_action_replace,
@@ -1277,9 +1313,9 @@ tc_editor_delete(node_move_baton_t *nmb,
/* Only notify if add_file/add_dir is not going to notify */
if (conflict || (new_kind == svn_node_none))
- SVN_ERR(update_move_list_add(b->wcroot, relpath,
+ SVN_ERR(update_move_list_add(b->wcroot, relpath, b->db,
svn_wc_notify_update_delete,
- move_dst_kind,
+ new_kind,
svn_wc_notify_state_inapplicable,
svn_wc_notify_state_inapplicable,
conflict, work_items, scratch_pool));
@@ -1384,30 +1420,26 @@ get_info(apr_hash_t **props,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- apr_hash_t *hash_children;
- apr_array_header_t *sorted_children;
- svn_error_t *err;
svn_wc__db_status_t status;
const char *repos_relpath;
- int i;
+ svn_node_kind_t db_kind;
+ svn_error_t *err;
- err = svn_wc__db_depth_get_info(&status, kind, NULL, &repos_relpath, NULL,
+ err = svn_wc__db_depth_get_info(&status, &db_kind, NULL, &repos_relpath, NULL,
NULL, NULL, NULL, NULL, checksum, NULL,
NULL, props,
wcroot, local_relpath, op_depth,
result_pool, scratch_pool);
/* If there is no node at this depth, or only a node that describes a delete
- of a lower layer we report this node as not existing.
-
- But when a node is reported as DELETED, but has a repository location it
- is really a not-present node that must be reported as being there */
+ of a lower layer we report this node as not existing. */
if ((err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
- || (!err && status == svn_wc__db_status_deleted))
+ || (!err && status != svn_wc__db_status_added
+ && status != svn_wc__db_status_normal))
{
svn_error_clear(err);
- if (kind && (err || !repos_relpath))
+ if (kind)
*kind = svn_node_none;
if (checksum)
*checksum = NULL;
@@ -1421,21 +1453,33 @@ get_info(apr_hash_t **props,
else
SVN_ERR(err);
+ if (kind)
+ *kind = db_kind;
- SVN_ERR(svn_wc__db_get_children_op_depth(&hash_children, wcroot,
- local_relpath, op_depth,
- scratch_pool, scratch_pool));
+ if (children && db_kind == svn_node_dir)
+ {
+ svn_sqlite__stmt_t *stmt;
+ svn_boolean_t have_row;
+
+ *children = apr_array_make(result_pool, 16, sizeof(const char *));
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_OP_DEPTH_CHILDREN_EXISTS));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
+ op_depth));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ while (have_row)
+ {
+ const char *child_relpath = svn_sqlite__column_text(stmt, 0, NULL);
- sorted_children = svn_sort__hash(hash_children,
- svn_sort_compare_items_lexically,
- scratch_pool);
-
- *children = apr_array_make(result_pool, sorted_children->nelts,
- sizeof(const char *));
- for (i = 0; i < sorted_children->nelts; ++i)
- APR_ARRAY_PUSH(*children, const char *)
- = apr_pstrdup(result_pool, APR_ARRAY_IDX(sorted_children, i,
- svn_sort__item_t).key);
+ APR_ARRAY_PUSH(*children, const char *)
+ = svn_relpath_basename(child_relpath, result_pool);
+
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ }
+ SVN_ERR(svn_sqlite__reset(stmt));
+ }
+ else if (children)
+ *children = apr_array_make(result_pool, 0, sizeof(const char *));
return SVN_NO_ERROR;
}
@@ -1478,8 +1522,8 @@ update_moved_away_node(node_move_baton_t
apr_hash_t *src_props, *dst_props;
apr_array_header_t *src_children, *dst_children;
- SVN_ERR(verify_write_lock(wcroot, src_relpath, scratch_pool));
- SVN_ERR(verify_write_lock(wcroot, dst_relpath, scratch_pool));
+ if (b->cancel_func)
+ SVN_ERR(b->cancel_func(b->cancel_baton));
SVN_ERR(get_info(&src_props, &src_checksum, &src_children, &src_kind,
src_relpath, b->src_op_depth,
@@ -1605,66 +1649,6 @@ update_moved_away_node(node_move_baton_t
return SVN_NO_ERROR;
}
-/* Transfer changes from the move source to the move destination.
- *
- * Drive the editor with the difference between DST_RELPATH
- * (at its own op-depth) and SRC_RELPATH (at op-depth zero).
- *
- * Then update the single op-depth layer in the move destination subtree
- * rooted at DST_RELPATH to make it match the move source subtree
- * rooted at SRC_RELPATH.
- *
- * ### And the other params?
- */
-static svn_error_t *
-drive_tree_conflict_editor(update_move_baton_t *b,
- const char *src_relpath,
- const char *dst_relpath,
- svn_wc_operation_t operation,
- svn_wc_conflict_reason_t local_change,
- svn_wc_conflict_action_t incoming_change,
- svn_wc_conflict_version_t *old_version,
- svn_wc_conflict_version_t *new_version,
- svn_wc__db_wcroot_t *wcroot,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- apr_pool_t *scratch_pool)
-{
- node_move_baton_t nmb = { 0 };
- SVN_ERR(verify_write_lock(wcroot, src_relpath, scratch_pool));
- SVN_ERR(verify_write_lock(wcroot, dst_relpath, scratch_pool));
- /*
- * Refuse to auto-resolve unsupported tree conflicts.
- */
- /* ### Only handle conflicts created by update/switch operations for now. */
- if (operation != svn_wc_operation_update &&
- operation != svn_wc_operation_switch)
- return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
- _("Cannot auto-resolve tree-conflict on '%s'"),
- path_for_error_message(wcroot, src_relpath,
- scratch_pool));
-
- nmb.umb = b;
- nmb.src_relpath = src_relpath;
- nmb.dst_relpath = dst_relpath;
- /* nmb.shadowed = FALSE; */
- /* nmb.edited = FALSE; */
- /* nmb.skip_children = FALSE; */
-
- /* We walk the move source (i.e. the post-update tree), comparing each node
- * with the equivalent node at the move destination and applying the update
- * to nodes at the move destination. */
- SVN_ERR(update_moved_away_node(&nmb, wcroot, src_relpath, dst_relpath,
- scratch_pool));
-
- SVN_ERR(svn_wc__db_op_copy_layer_internal(wcroot, src_relpath,
- b->src_op_depth,
- dst_relpath, NULL, NULL,
- scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
static svn_error_t *
suitable_for_move(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
@@ -1731,85 +1715,113 @@ suitable_for_move(svn_wc__db_wcroot_t *w
/* The body of svn_wc__db_update_moved_away_conflict_victim(), which see.
*/
static svn_error_t *
-update_moved_away_conflict_victim(svn_wc__db_t *db,
+update_moved_away_conflict_victim(svn_revnum_t *old_rev,
+ svn_revnum_t *new_rev,
+ svn_wc__db_t *db,
svn_wc__db_wcroot_t *wcroot,
- const char *victim_relpath,
+ const char *local_relpath,
+ const char *delete_relpath,
svn_wc_operation_t operation,
- svn_wc_conflict_reason_t local_change,
- svn_wc_conflict_action_t incoming_change,
- const char *move_src_op_root_relpath,
- svn_wc_conflict_version_t *old_version,
- svn_wc_conflict_version_t *new_version,
+ svn_wc_conflict_action_t action,
+ svn_wc_conflict_reason_t reason,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *scratch_pool)
{
update_move_baton_t umb = { NULL };
- svn_sqlite__stmt_t *stmt;
- svn_boolean_t have_row;
- const char *dummy1, *dummy2, *dummy3;
- const char *move_root_dst_abspath;
- const char *move_root_dst_relpath;
+ const char *src_relpath, *dst_relpath;
+ svn_wc_conflict_version_t old_version;
+ svn_wc_conflict_version_t new_version;
+ apr_int64_t repos_id;
+ node_move_baton_t nmb = { 0 };
- /* ### assumes wc write lock already held */
+ SVN_ERR_ASSERT(svn_relpath_skip_ancestor(delete_relpath, local_relpath));
/* Construct editor baton. */
- SVN_ERR(svn_wc__db_op_depth_moved_to(
- &dummy1, &move_root_dst_relpath, &dummy2, &dummy3,
- relpath_depth(move_src_op_root_relpath) - 1,
- wcroot, victim_relpath, scratch_pool, scratch_pool));
- if (move_root_dst_relpath == NULL)
+
+ SVN_ERR(find_src_op_depth(&umb.src_op_depth, wcroot,
+ local_relpath, relpath_depth(delete_relpath),
+ scratch_pool));
+
+ SVN_ERR(svn_wc__db_scan_moved_to_internal(&src_relpath, &dst_relpath, NULL,
+ wcroot, local_relpath,
+ umb.src_op_depth,
+ scratch_pool, scratch_pool));
+
+ if (dst_relpath == NULL)
return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
_("The node '%s' has not been moved away"),
- path_for_error_message(wcroot, victim_relpath,
+ path_for_error_message(wcroot, local_relpath,
scratch_pool));
- move_root_dst_abspath
- = svn_dirent_join(wcroot->abspath, move_root_dst_relpath, scratch_pool);
- SVN_ERR(svn_wc__write_check(db, move_root_dst_abspath, scratch_pool));
+ umb.dst_op_depth = relpath_depth(dst_relpath);
+
+ SVN_ERR(verify_write_lock(wcroot, src_relpath, scratch_pool));
+ SVN_ERR(verify_write_lock(wcroot, dst_relpath, scratch_pool));
+
+
+ SVN_ERR(svn_wc__db_depth_get_info(NULL, &new_version.node_kind,
+ &new_version.peg_rev,
+ &new_version.path_in_repos, &repos_id,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL,
+ wcroot, src_relpath, umb.src_op_depth,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(svn_wc__db_fetch_repos_info(&new_version.repos_url,
+ &new_version.repos_uuid,
+ wcroot, repos_id,
+ scratch_pool));
+
+ SVN_ERR(svn_wc__db_depth_get_info(NULL, &old_version.node_kind,
+ &old_version.peg_rev,
+ &old_version.path_in_repos, &repos_id,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL,
+ wcroot, dst_relpath, umb.dst_op_depth,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(svn_wc__db_fetch_repos_info(&old_version.repos_url,
+ &old_version.repos_uuid,
+ wcroot, repos_id,
+ scratch_pool));
+ *old_rev = old_version.peg_rev;
+ *new_rev = new_version.peg_rev;
umb.operation = operation;
- umb.old_version= old_version;
- umb.new_version= new_version;
+ umb.old_version= &old_version;
+ umb.new_version= &new_version;
umb.db = db;
umb.wcroot = wcroot;
-
- umb.dst_op_depth = relpath_depth(move_root_dst_relpath);
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_HIGHEST_WORKING_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
- move_src_op_root_relpath,
- relpath_depth(move_src_op_root_relpath)));
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
- if (have_row)
- umb.src_op_depth = svn_sqlite__column_int(stmt, 0);
- SVN_ERR(svn_sqlite__reset(stmt));
- if (!have_row)
- return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
- _("'%s' is not deleted"),
- path_for_error_message(wcroot, victim_relpath,
- scratch_pool));
+ umb.cancel_func = cancel_func;
+ umb.cancel_baton = cancel_baton;
if (umb.src_op_depth == 0)
- SVN_ERR(suitable_for_move(wcroot, victim_relpath, scratch_pool));
+ SVN_ERR(suitable_for_move(wcroot, src_relpath, scratch_pool));
/* Create a new, and empty, list for notification information. */
SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
STMT_CREATE_UPDATE_MOVE_LIST));
- /* Create the editor... */
- /* ... and drive it. */
- SVN_ERR(drive_tree_conflict_editor(&umb,
- victim_relpath,
- move_root_dst_relpath,
- operation,
- local_change, incoming_change,
- umb.old_version,
- umb.new_version,
- wcroot,
- cancel_func, cancel_baton,
- scratch_pool));
+ /* Drive the editor... */
+
+ nmb.umb = &umb;
+ nmb.src_relpath = src_relpath;
+ nmb.dst_relpath = dst_relpath;
+ /* nmb.shadowed = FALSE; */
+ /* nmb.edited = FALSE; */
+ /* nmb.skip_children = FALSE; */
+
+ /* We walk the move source (i.e. the post-update tree), comparing each node
+ * with the equivalent node at the move destination and applying the update
+ * to nodes at the move destination. */
+ SVN_ERR(update_moved_away_node(&nmb, wcroot, src_relpath, dst_relpath,
+ scratch_pool));
+
+ SVN_ERR(svn_wc__db_op_copy_layer_internal(wcroot, src_relpath,
+ umb.src_op_depth,
+ dst_relpath, NULL, NULL,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -1817,58 +1829,43 @@ update_moved_away_conflict_victim(svn_wc
svn_error_t *
svn_wc__db_update_moved_away_conflict_victim(svn_wc__db_t *db,
- const char *victim_abspath,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
+ const char *local_abspath,
+ const char *delete_op_abspath,
+ svn_wc_operation_t operation,
+ svn_wc_conflict_action_t action,
+ svn_wc_conflict_reason_t reason,
svn_cancel_func_t cancel_func,
void *cancel_baton,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
apr_pool_t *scratch_pool)
{
svn_wc__db_wcroot_t *wcroot;
+ svn_revnum_t old_rev, new_rev;
const char *local_relpath;
- svn_wc_operation_t operation;
- svn_wc_conflict_reason_t local_change;
- svn_wc_conflict_action_t incoming_change;
- svn_wc_conflict_version_t *old_version;
- svn_wc_conflict_version_t *new_version;
- const char *move_src_op_root_abspath, *move_src_op_root_relpath;
+ const char *delete_relpath;
/* ### Check for mixed-rev src or dst? */
- SVN_ERR(get_tc_info(&operation, &local_change, &incoming_change,
- &move_src_op_root_abspath,
- &old_version, &new_version,
- db, victim_abspath,
- scratch_pool, scratch_pool));
-
- SVN_ERR(svn_wc__write_check(db, move_src_op_root_abspath, scratch_pool));
-
SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
- db, victim_abspath,
+ db, local_abspath,
scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- move_src_op_root_relpath
- = svn_dirent_skip_ancestor(wcroot->abspath, move_src_op_root_abspath);
+ delete_relpath
+ = svn_dirent_skip_ancestor(wcroot->abspath, delete_op_abspath);
SVN_WC__DB_WITH_TXN(
update_moved_away_conflict_victim(
- db, wcroot, local_relpath,
- operation, local_change, incoming_change,
- move_src_op_root_relpath,
- old_version, new_version,
+ &old_rev, &new_rev,
+ db, wcroot, local_relpath, delete_relpath,
+ operation, action, reason,
cancel_func, cancel_baton,
scratch_pool),
wcroot);
/* Send all queued up notifications. */
- SVN_ERR(svn_wc__db_update_move_list_notify(wcroot,
- (old_version
- ? old_version->peg_rev
- : SVN_INVALID_REVNUM),
- (new_version
- ? new_version->peg_rev
- : SVN_INVALID_REVNUM),
+ SVN_ERR(svn_wc__db_update_move_list_notify(wcroot, old_rev, new_rev,
notify_func, notify_baton,
scratch_pool));
if (notify_func)
@@ -1883,7 +1880,7 @@ svn_wc__db_update_moved_away_conflict_vi
notify->kind = svn_node_none;
notify->content_state = svn_wc_notify_state_inapplicable;
notify->prop_state = svn_wc_notify_state_inapplicable;
- notify->revision = new_version->peg_rev;
+ notify->revision = new_rev;
notify_func(notify_baton, notify, scratch_pool);
}
@@ -1973,7 +1970,7 @@ bump_mark_tree_conflict(svn_wc__db_wcroo
wcroot, move_src_op_root_relpath,
scratch_pool, scratch_pool));
SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, &repos_uuid,
- wcroot->sdb, repos_id, scratch_pool));
+ wcroot, repos_id, scratch_pool));
/* Read old (pre-update) information from the move destination node.
@@ -2023,7 +2020,7 @@ bump_mark_tree_conflict(svn_wc__db_wcroo
move_src_op_root_relpath,
scratch_pool, scratch_pool));
- SVN_ERR(update_move_list_add(wcroot, move_src_root_relpath,
+ SVN_ERR(update_move_list_add(wcroot, move_src_root_relpath, db,
svn_wc_notify_tree_conflict,
new_kind,
svn_wc_notify_state_inapplicable,
@@ -2279,17 +2276,27 @@ svn_wc__db_bump_moved_away(svn_wc__db_wc
if (local_relpath[0] != '\0')
{
- const char *dummy1, *move_dst_op_root_relpath;
- const char *move_src_root_relpath, *move_src_op_root_relpath;
+ const char *move_dst_op_root_relpath;
+ const char *move_src_root_relpath, *delete_relpath;
+ svn_error_t *err;
/* Is the root of the update moved away? (Impossible for the wcroot) */
- SVN_ERR(svn_wc__db_op_depth_moved_to(&dummy1, &move_dst_op_root_relpath,
- &move_src_root_relpath,
- &move_src_op_root_relpath, 0,
- wcroot, local_relpath,
- scratch_pool, scratch_pool));
- if (move_src_root_relpath)
+ err = svn_wc__db_scan_moved_to_internal(&move_src_root_relpath,
+ &move_dst_op_root_relpath,
+ &delete_relpath,
+ wcroot, local_relpath,
+ 0 /* BASE */,
+ scratch_pool, scratch_pool);
+
+ if (err)
+ {
+ if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+ return svn_error_trace(err);
+
+ svn_error_clear(err);
+ }
+ else if (move_src_root_relpath)
{
if (strcmp(move_src_root_relpath, local_relpath))
{
@@ -2309,7 +2316,7 @@ svn_wc__db_bump_moved_away(svn_wc__db_wc
{
SVN_ERR(bump_mark_tree_conflict(wcroot,
move_src_root_relpath,
- move_src_op_root_relpath,
+ delete_relpath,
move_dst_op_root_relpath,
db, scratch_pool));
}
@@ -2323,15 +2330,17 @@ svn_wc__db_bump_moved_away(svn_wc__db_wc
return SVN_NO_ERROR;
}
-static svn_error_t *
-resolve_delete_raise_moved_away(svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- svn_wc__db_t *db,
- svn_wc_operation_t operation,
- svn_wc_conflict_action_t action,
- svn_wc_conflict_version_t *old_version,
- svn_wc_conflict_version_t *new_version,
- apr_pool_t *scratch_pool)
+svn_error_t *
+svn_wc__db_op_raise_moved_away_internal(
+ svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ int delete_op_depth,
+ svn_wc__db_t *db,
+ svn_wc_operation_t operation,
+ svn_wc_conflict_action_t action,
+ const svn_wc_conflict_version_t *old_version,
+ const svn_wc_conflict_version_t *new_version,
+ apr_pool_t *scratch_pool)
{
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
@@ -2341,17 +2350,17 @@ resolve_delete_raise_moved_away(svn_wc__
STMT_CREATE_UPDATE_MOVE_LIST));
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_OP_DEPTH_MOVED_PAIR));
+ STMT_SELECT_MOVED_DESCENDANTS_SHD));
SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
- relpath_depth(local_relpath)));
+ delete_op_depth));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
while(have_row)
{
svn_error_t *err;
- const char *src_relpath = svn_sqlite__column_text(stmt, 0, NULL);
- svn_node_kind_t src_kind = svn_sqlite__column_token(stmt, 1, kind_map);
- const char *dst_relpath = svn_sqlite__column_text(stmt, 2, NULL);
+ const char *src_relpath = svn_sqlite__column_text(stmt, 1, NULL);
+ svn_node_kind_t src_kind = svn_sqlite__column_token(stmt, 2, kind_map);
const char *src_repos_relpath = svn_sqlite__column_text(stmt, 3, NULL);
+ const char *dst_relpath = svn_sqlite__column_text(stmt, 4, NULL);
svn_skel_t *conflict;
svn_pool_clear(iterpool);
@@ -2363,11 +2372,14 @@ resolve_delete_raise_moved_away(svn_wc__
src_kind /* ### new kind */,
src_repos_relpath,
svn_wc_conflict_reason_moved_away,
- action, local_relpath,
+ action,
+ svn_relpath_limit(src_relpath,
+ delete_op_depth,
+ iterpool),
iterpool, iterpool);
if (!err)
- err = update_move_list_add(wcroot, src_relpath,
+ err = update_move_list_add(wcroot, src_relpath, db,
svn_wc_notify_tree_conflict,
src_kind,
svn_wc_notify_state_inapplicable,
@@ -2410,10 +2422,11 @@ svn_wc__db_resolve_delete_raise_moved_aw
db, local_abspath, scratch_pool, scratch_pool));
SVN_WC__DB_WITH_TXN(
- resolve_delete_raise_moved_away(wcroot, local_relpath,
- db, operation, action,
- old_version, new_version,
- scratch_pool),
+ svn_wc__db_op_raise_moved_away_internal(wcroot, local_relpath,
+ relpath_depth(local_relpath),
+ db, operation, action,
+ old_version, new_version,
+ scratch_pool),
wcroot);
SVN_ERR(svn_wc__db_update_move_list_notify(wcroot,
@@ -2430,63 +2443,41 @@ svn_wc__db_resolve_delete_raise_moved_aw
}
static svn_error_t *
-break_move(svn_wc__db_wcroot_t *wcroot,
- const char *src_relpath,
- int src_op_depth,
- const char *dst_relpath,
- apr_pool_t *scratch_pool)
+break_moved_away(svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ int op_depth,
+ apr_pool_t *scratch_pool)
{
- svn_sqlite__stmt_t *stmt;
+ const char *dst_relpath;
+ int src_op_depth;
+ const char *delete_relpath;
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_CLEAR_MOVED_TO_RELPATH));
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, src_relpath,
- src_op_depth));
- SVN_ERR(svn_sqlite__step_done(stmt));
+ SVN_ERR(find_src_op_depth(&src_op_depth, wcroot,
+ local_relpath, op_depth,
+ scratch_pool));
- /* The destination is always an op-root, so we can calculate the depth
- from there. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_CLEAR_MOVED_HERE_RECURSIVE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
- dst_relpath, relpath_depth(dst_relpath)));
- SVN_ERR(svn_sqlite__step_done(stmt));
- return SVN_NO_ERROR;
-}
+ SVN_ERR(svn_wc__db_scan_moved_to_internal(NULL, &dst_relpath,
+ &delete_relpath,
+ wcroot, local_relpath,
+ src_op_depth,
+ scratch_pool, scratch_pool));
-svn_error_t *
-svn_wc__db_resolve_break_moved_away_internal(svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- int op_depth,
- apr_pool_t *scratch_pool)
-{
- const char *dummy1, *move_dst_op_root_relpath;
- const char *dummy2, *move_src_op_root_relpath;
+ SVN_ERR_ASSERT(dst_relpath != NULL && delete_relpath != NULL);
- /* We want to include the passed op-depth, but the function does a > check */
- SVN_ERR(svn_wc__db_op_depth_moved_to(&dummy1, &move_dst_op_root_relpath,
- &dummy2,
- &move_src_op_root_relpath,
- op_depth - 1,
- wcroot, local_relpath,
- scratch_pool, scratch_pool));
-
- SVN_ERR_ASSERT(move_src_op_root_relpath != NULL
- && move_dst_op_root_relpath != NULL);
-
- SVN_ERR(break_move(wcroot, local_relpath,
- relpath_depth(move_src_op_root_relpath),
- move_dst_op_root_relpath,
- scratch_pool));
+ SVN_ERR(svn_wc__db_op_break_move_internal(wcroot, local_relpath,
+ relpath_depth(delete_relpath),
+ dst_relpath, NULL,
+ scratch_pool));
return SVN_NO_ERROR;
}
static svn_error_t *
-break_moved_away_children_internal(svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- apr_pool_t *scratch_pool)
+break_moved_away_children(svn_wc__db_wcroot_t *wcroot,
+ svn_wc__db_t *db,
+ const char *local_relpath,
+ apr_pool_t *scratch_pool)
{
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
@@ -2496,7 +2487,7 @@ break_moved_away_children_internal(svn_w
STMT_CREATE_UPDATE_MOVE_LIST));
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_MOVED_DESCENDANTS));
+ STMT_SELECT_MOVED_DESCENDANTS_SRC));
SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
relpath_depth(local_relpath)));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
@@ -2504,21 +2495,23 @@ break_moved_away_children_internal(svn_w
iterpool = svn_pool_create(scratch_pool);
while (have_row)
{
- const char *src_relpath = svn_sqlite__column_text(stmt, 0, NULL);
- const char *dst_relpath = svn_sqlite__column_text(stmt, 1, NULL);
- int src_op_depth = svn_sqlite__column_int(stmt, 2);
+ int src_op_depth = svn_sqlite__column_int(stmt, 0) ;
+ const char *src_relpath = svn_sqlite__column_text(stmt, 1, NULL);
+ svn_node_kind_t src_kind = svn_sqlite__column_token(stmt, 2, kind_map);
+ const char *dst_relpath = svn_sqlite__column_text(stmt, 4, NULL);
svn_error_t *err;
svn_pool_clear(iterpool);
- err = break_move(wcroot, src_relpath, src_op_depth, dst_relpath,
- iterpool);
+ err = svn_wc__db_op_break_move_internal(wcroot,
+ src_relpath, src_op_depth,
+ dst_relpath, NULL, iterpool);
if (! err)
{
- err = update_move_list_add(wcroot, src_relpath,
+ err = update_move_list_add(wcroot, src_relpath, db,
svn_wc_notify_move_broken,
- svn_node_unknown,
+ src_kind,
svn_wc_notify_state_inapplicable,
svn_wc_notify_state_inapplicable,
NULL, NULL, scratch_pool);
@@ -2560,11 +2553,10 @@ svn_wc__db_resolve_break_moved_away(svn_
src_relpath = svn_dirent_skip_ancestor(wcroot->abspath, src_op_root_abspath);
SVN_ERR_ASSERT(src_relpath != NULL);
- SVN_WC__DB_WITH_TXN(
- svn_wc__db_resolve_break_moved_away_internal(wcroot, local_relpath,
- relpath_depth(src_relpath),
- scratch_pool),
- wcroot);
+ SVN_WC__DB_WITH_TXN(break_moved_away(wcroot, local_relpath,
+ relpath_depth(src_relpath),
+ scratch_pool),
+ wcroot);
if (notify_func)
{
@@ -2602,7 +2594,7 @@ svn_wc__db_resolve_break_moved_away_chil
VERIFY_USABLE_WCROOT(wcroot);
SVN_WC__DB_WITH_TXN(
- break_moved_away_children_internal(wcroot, local_relpath, scratch_pool),
+ break_moved_away_children(wcroot, db, local_relpath, scratch_pool),
wcroot);
SVN_ERR(svn_wc__db_update_move_list_notify(wcroot,
Modified: subversion/branches/remove-log-addressing/subversion/mod_dav_svn/deadprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/mod_dav_svn/deadprops.c?rev=1659291&r1=1659290&r2=1659291&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/mod_dav_svn/deadprops.c (original)
+++ subversion/branches/remove-log-addressing/subversion/mod_dav_svn/deadprops.c Thu Feb 12 15:50:47 2015
@@ -638,16 +638,14 @@ static void get_name(dav_db *db, dav_pro
}
else
{
- const void *name;
-
- apr_hash_this(db->hi, &name, NULL, NULL);
+ const char *name = apr_hash_this_key(db->hi);
#define PREFIX_LEN (sizeof(SVN_PROP_PREFIX) - 1)
if (strncmp(name, SVN_PROP_PREFIX, PREFIX_LEN) == 0)
#undef PREFIX_LEN
{
pname->ns = SVN_DAV_PROP_NS_SVN;
- pname->name = (const char *)name + 4;
+ pname->name = name + 4;
}
else
{
Modified: subversion/branches/remove-log-addressing/subversion/svn/cl-conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/svn/cl-conflicts.c?rev=1659291&r1=1659290&r2=1659291&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/svn/cl-conflicts.c (original)
+++ subversion/branches/remove-log-addressing/subversion/svn/cl-conflicts.c Thu Feb 12 15:50:47 2015
@@ -337,6 +337,27 @@ svn_cl__get_human_readable_tree_conflict
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_cl__get_human_readable_action_description(
+ const char **desc,
+ svn_wc_conflict_action_t action,
+ svn_wc_operation_t operation,
+ svn_node_kind_t kind,
+ apr_pool_t *pool)
+{
+ const char *action_s, *operation_s;
+
+ action_s = incoming_action_str(kind, action);
+ operation_s = operation_str(operation);
+
+ SVN_ERR_ASSERT(operation_s);
+
+ *desc = apr_psprintf(pool, _("%s %s"),
+ action_s, operation_s);
+
+ return SVN_NO_ERROR;
+}
+
/* Helper for svn_cl__append_tree_conflict_info_xml().
* Appends the attributes of the given VERSION to ATT_HASH.
Modified: subversion/branches/remove-log-addressing/subversion/svn/cl-conflicts.h
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/svn/cl-conflicts.h?rev=1659291&r1=1659290&r2=1659291&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/svn/cl-conflicts.h (original)
+++ subversion/branches/remove-log-addressing/subversion/svn/cl-conflicts.h Thu Feb 12 15:50:47 2015
@@ -63,6 +63,16 @@ svn_cl__get_human_readable_tree_conflict
const svn_wc_conflict_description2_t *conflict,
apr_pool_t *pool);
+/* Like svn_cl__get_human_readable_tree_conflict_description but
+ for other conflict types */
+svn_error_t *
+svn_cl__get_human_readable_action_description(
+ const char **desc,
+ svn_wc_conflict_action_t action,
+ svn_wc_operation_t operation,
+ svn_node_kind_t kind,
+ apr_pool_t *pool);
+
/**
* Append to @a str an XML representation of the conflict data
* for @a conflict, in a format suitable for 'svn info --xml'.
Modified: subversion/branches/remove-log-addressing/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/svn/info-cmd.c?rev=1659291&r1=1659290&r2=1659291&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/svn/info-cmd.c (original)
+++ subversion/branches/remove-log-addressing/subversion/svn/info-cmd.c Thu Feb 12 15:50:47 2015
@@ -389,30 +389,18 @@ print_info(void *baton,
SVN_ERR(svn_cmdline_printf(pool, _("Copied From Rev: %ld\n"),
info->wc_info->copyfrom_rev));
if (info->wc_info->moved_from_abspath)
- {
- const char *relpath;
-
- relpath = svn_dirent_skip_ancestor(info->wc_info->wcroot_abspath,
- info->wc_info->moved_from_abspath);
- if (relpath && relpath[0] != '\0')
- SVN_ERR(svn_cmdline_printf(pool, _("Moved From: %s\n"), relpath));
- else
- SVN_ERR(svn_cmdline_printf(pool, _("Moved From: %s\n"),
- info->wc_info->moved_from_abspath));
- }
+ SVN_ERR(svn_cmdline_printf(pool, _("Moved From: %s\n"),
+ svn_cl__local_style_skip_ancestor(
+ path_prefix,
+ info->wc_info->moved_from_abspath,
+ pool)));
if (info->wc_info->moved_to_abspath)
- {
- const char *relpath;
-
- relpath = svn_dirent_skip_ancestor(info->wc_info->wcroot_abspath,
- info->wc_info->moved_to_abspath);
- if (relpath && relpath[0] != '\0')
- SVN_ERR(svn_cmdline_printf(pool, _("Moved To: %s\n"), relpath));
- else
- SVN_ERR(svn_cmdline_printf(pool, _("Moved To: %s\n"),
- info->wc_info->moved_to_abspath));
- }
+ SVN_ERR(svn_cmdline_printf(pool, _("Moved To: %s\n"),
+ svn_cl__local_style_skip_ancestor(
+ path_prefix,
+ info->wc_info->moved_to_abspath,
+ pool)));
}
if (info->last_changed_author)
@@ -441,6 +429,7 @@ print_info(void *baton,
if (info->wc_info->conflicts)
{
svn_boolean_t printed_prop_conflict_file = FALSE;
+ svn_boolean_t printed_tc = FALSE;
int i;
for (i = 0; i < info->wc_info->conflicts->nelts; i++)
@@ -479,12 +468,15 @@ print_info(void *baton,
if (! printed_prop_conflict_file)
SVN_ERR(svn_cmdline_printf(pool,
_("Conflict Properties File: %s\n"),
- svn_dirent_local_style(conflict->their_abspath,
- pool)));
+ svn_cl__local_style_skip_ancestor(
+ path_prefix,
+ conflict->prop_reject_abspath,
+ pool)));
printed_prop_conflict_file = TRUE;
break;
case svn_wc_conflict_kind_tree:
+ printed_tc = TRUE;
SVN_ERR(
svn_cl__get_human_readable_tree_conflict_description(
&desc, conflict, pool));
@@ -506,6 +498,19 @@ print_info(void *baton,
APR_ARRAY_IDX(info->wc_info->conflicts, 0,
const svn_wc_conflict_description2_t *);
+ if (!printed_tc)
+ {
+ const char *desc;
+
+ SVN_ERR(svn_cl__get_human_readable_action_description(&desc,
+ svn_wc_conflict_action_edit,
+ conflict->operation,
+ conflict->node_kind, pool));
+
+ SVN_ERR(svn_cmdline_printf(pool, "%s: %s\n",
+ _("Conflict Details"), desc));
+ }
+
src_left_version =
svn_cl__node_description(conflict->src_left_version,
info->repos_root_URL, pool);
Modified: subversion/branches/remove-log-addressing/subversion/svndumpfilter/svndumpfilter.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/svndumpfilter/svndumpfilter.c?rev=1659291&r1=1659290&r2=1659291&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/svndumpfilter/svndumpfilter.c (original)
+++ subversion/branches/remove-log-addressing/subversion/svndumpfilter/svndumpfilter.c Thu Feb 12 15:50:47 2015
@@ -278,7 +278,7 @@ struct node_baton_t
svn_filesize_t tcl;
/* Pointers to dumpfile data. */
- apr_array_header_t *headers;
+ svn_repos__dumpfile_headers_t *headers;
svn_stringbuf_t *props;
/* Expect deltas? */
Modified: subversion/branches/remove-log-addressing/subversion/svnrdump/dump_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/svnrdump/dump_editor.c?rev=1659291&r1=1659290&r2=1659291&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/svnrdump/dump_editor.c (original)
+++ subversion/branches/remove-log-addressing/subversion/svnrdump/dump_editor.c Thu Feb 12 15:50:47 2015
@@ -58,7 +58,7 @@ struct dir_baton
svn_revnum_t copyfrom_rev;
/* Headers accumulated so far for this directory */
- apr_array_header_t *headers;
+ svn_repos__dumpfile_headers_t *headers;
/* Properties which were modified during change_dir_prop. */
apr_hash_t *props;
@@ -72,9 +72,8 @@ struct dir_baton
us, although they're all really within this directory. */
apr_hash_t *deleted_entries;
- /* Flags to trigger dumping props and record termination newlines. */
+ /* Flag to trigger dumping props. */
svn_boolean_t dump_props;
- svn_boolean_t dump_newlines;
};
/* A file baton used by all file-related callback functions in the dump
@@ -223,7 +222,7 @@ make_file_baton(const char *path,
* content section, to represent the property delta of PROPS/DELETED_PROPS.
*/
static svn_error_t *
-get_props_content(apr_array_header_t *headers,
+get_props_content(svn_repos__dumpfile_headers_t *headers,
svn_stringbuf_t **content,
apr_hash_t *props,
apr_hash_t *deleted_props,
@@ -262,7 +261,8 @@ dump_node_delete(svn_stream_t *stream,
const char *node_relpath,
apr_pool_t *pool)
{
- apr_array_header_t *headers = svn_repos__dumpfile_headers_create(pool);
+ svn_repos__dumpfile_headers_t *headers
+ = svn_repos__dumpfile_headers_create(pool);
assert(svn_relpath_is_canonical(node_relpath));
@@ -274,7 +274,9 @@ dump_node_delete(svn_stream_t *stream,
svn_repos__dumpfile_header_push(
headers, SVN_REPOS_DUMPFILE_NODE_ACTION, "delete");
- SVN_ERR(svn_repos__dump_headers(stream, headers, TRUE, pool));
+ SVN_ERR(svn_repos__dump_node_record(stream, headers,
+ NULL, FALSE, 0, /* props & text */
+ FALSE /*content_length_always*/, pool));
return SVN_NO_ERROR;
}
@@ -296,7 +298,7 @@ dump_node_delete(svn_stream_t *stream,
* header block.)
*/
static svn_error_t *
-dump_node(apr_array_header_t **headers_p,
+dump_node(svn_repos__dumpfile_headers_t **headers_p,
struct dump_edit_baton *eb,
const char *repos_relpath,
struct dir_baton *db,
@@ -308,7 +310,8 @@ dump_node(apr_array_header_t **headers_p
apr_pool_t *pool)
{
const char *node_relpath = repos_relpath;
- apr_array_header_t *headers = svn_repos__dumpfile_headers_create(pool);
+ svn_repos__dumpfile_headers_t *headers
+ = svn_repos__dumpfile_headers_create(pool);
assert(svn_relpath_is_canonical(repos_relpath));
assert(!copyfrom_path || svn_relpath_is_canonical(copyfrom_path));
@@ -394,16 +397,6 @@ dump_node(apr_array_header_t **headers_p
headers, SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV, "%ld", copyfrom_rev);
svn_repos__dumpfile_header_push(
headers, SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH, copyfrom_path);
-
- /* Ugly hack: If a directory was copied from a previous
- revision, nothing like close_file() will be called to write two
- blank lines. If change_dir_prop() is called, props are dumped
- (along with the necessary PROPS-END\n\n and we're good. So
- set DUMP_NEWLINES here to print the newlines unless
- change_dir_prop() is called next otherwise the `svnadmin load`
- parser will fail. */
- if (db)
- db->dump_newlines = TRUE;
}
else
{
@@ -445,7 +438,8 @@ dump_mkdir(struct dump_edit_baton *eb,
apr_pool_t *pool)
{
svn_stringbuf_t *prop_content;
- apr_array_header_t *headers = svn_repos__dumpfile_headers_create(pool);
+ svn_repos__dumpfile_headers_t *headers
+ = svn_repos__dumpfile_headers_create(pool);
/* Node-path: ... */
svn_repos__dumpfile_header_push(
@@ -496,25 +490,18 @@ dump_pending_dir(struct dump_edit_baton
FALSE, 0, FALSE /*content_length_always*/,
scratch_pool));
+ /* No text is going to be dumped. Write a couple of newlines and
+ wait for the next node/ revision. */
+ SVN_ERR(svn_stream_puts(eb->stream, "\n\n"));
+
if (db->dump_props)
{
- /* No text is going to be dumped. Write a couple of newlines and
- wait for the next node/ revision. */
- SVN_ERR(svn_stream_puts(eb->stream, "\n\n"));
-
/* Cleanup so that data is never dumped twice. */
apr_hash_clear(db->props);
apr_hash_clear(db->deleted_props);
db->dump_props = FALSE;
}
- /* Some pending newlines to dump? */
- if (db->dump_newlines)
- {
- SVN_ERR(svn_stream_puts(eb->stream, "\n\n"));
- db->dump_newlines = FALSE;
- }
-
/* Anything that was pending is pending no longer. */
eb->pending_db = NULL;
@@ -828,9 +815,7 @@ change_dir_prop(void *parent_baton,
else
svn_hash_sets(db->deleted_props, apr_pstrdup(db->pool, name), "");
- /* Make sure we eventually output the props, and disable printing
- a couple of extra newlines */
- db->dump_newlines = FALSE;
+ /* Make sure we eventually output the props */
db->dump_props = TRUE;
return SVN_NO_ERROR;
@@ -896,7 +881,7 @@ close_file(void *file_baton,
struct dump_edit_baton *eb = fb->eb;
apr_finfo_t *info = apr_pcalloc(pool, sizeof(apr_finfo_t));
svn_stringbuf_t *propstring = NULL;
- apr_array_header_t *headers;
+ svn_repos__dumpfile_headers_t *headers;
SVN_ERR(dump_pending_dir(eb, pool));