Author: stsp
Date: Wed Aug 23 11:55:10 2017
New Revision: 1805887
URL: http://svn.apache.org/viewvc?rev=1805887&view=rev
Log:
On the addremove branch, tweak an internal libsvn_wc API.
The previous API was focused only on moves. We will need a way to handle
ambiguous moves, and one possibility of handling them in addremove is
creating a deletion and more than one copy of the deleted item.
Therefore, the new API allows for changing copyfrom info only, without
creating a local move.
* subversion/include/private/svn_wc_private.h
(svn_wc__move_fixup): Rename to ...
(svn_wc__fixup_copyfrom): ... this, and add an is_move parameter.
* subversion/libsvn_client/addremove.c
(match_up_local_deletes_and_adds): Track rename. Always set is_move for now.
* subversion/libsvn_wc/copy.c
(svn_wc__move_fixup): Rename to ...
(svn_wc__fixup_copyfrom): ... this, and add an is_move parameter.
Track rename of wc_db API.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_move_fixup): Rename to ...
(svn_wc__db_fixup_copyfrom): ... this.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_move_fixup): Rename to ...
(svn_wc__db_fixup_copyfrom): ... this. Only record a move if is_move is set.
Modified:
subversion/branches/addremove/subversion/include/private/svn_wc_private.h
subversion/branches/addremove/subversion/libsvn_client/addremove.c
subversion/branches/addremove/subversion/libsvn_wc/copy.c
subversion/branches/addremove/subversion/libsvn_wc/wc_db.c
subversion/branches/addremove/subversion/libsvn_wc/wc_db.h
Modified:
subversion/branches/addremove/subversion/include/private/svn_wc_private.h
URL:
http://svn.apache.org/viewvc/subversion/branches/addremove/subversion/include/private/svn_wc_private.h?rev=1805887&r1=1805886&r2=1805887&view=diff
==============================================================================
--- subversion/branches/addremove/subversion/include/private/svn_wc_private.h
(original)
+++ subversion/branches/addremove/subversion/include/private/svn_wc_private.h
Wed Aug 23 11:55:10 2017
@@ -1999,7 +1999,8 @@ svn_wc__move2(svn_wc_context_t *wc_ctx,
/**
- * Move @a src_abspath to @a dst_abspath in working copy meta data.
+ * Make @a dst_abspath a copy of @a src_abspath in working copy meta data.
+ * If @a is_move is @c TRUE, mark source and destination as a local move.
* This is a database-only operation and the working directories and files
* are not changed.
*
@@ -2022,14 +2023,15 @@ svn_wc__move2(svn_wc_context_t *wc_ctx,
* @since New in 1.10.
*/
svn_error_t *
-svn_wc__move_fixup(svn_wc_context_t *wc_ctx,
- const char *src_abspath,
- const char *dst_abspath,
- 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__fixup_copyfrom(svn_wc_context_t *wc_ctx,
+ const char *src_abspath,
+ const char *dst_abspath,
+ svn_boolean_t is_move,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool);
/* During merge when we encounter added directories, we add them using
Modified: subversion/branches/addremove/subversion/libsvn_client/addremove.c
URL:
http://svn.apache.org/viewvc/subversion/branches/addremove/subversion/libsvn_client/addremove.c?rev=1805887&r1=1805886&r2=1805887&view=diff
==============================================================================
--- subversion/branches/addremove/subversion/libsvn_client/addremove.c
(original)
+++ subversion/branches/addremove/subversion/libsvn_client/addremove.c Wed Aug
23 11:55:10 2017
@@ -288,10 +288,11 @@ match_up_local_deletes_and_adds(const ch
svn_pool_clear(iterpool);
- SVN_ERR(svn_wc__move_fixup(ctx->wc_ctx, src_abspath, dst_abspath,
- ctx->cancel_func, ctx->cancel_baton,
- ctx->notify_func2, ctx->notify_baton2,
- iterpool));
+ SVN_ERR(svn_wc__fixup_copyfrom(ctx->wc_ctx, src_abspath, dst_abspath,
+ TRUE, /* is_move */
+ ctx->cancel_func, ctx->cancel_baton,
+ ctx->notify_func2, ctx->notify_baton2,
+ iterpool));
}
svn_pool_destroy(iterpool);
Modified: subversion/branches/addremove/subversion/libsvn_wc/copy.c
URL:
http://svn.apache.org/viewvc/subversion/branches/addremove/subversion/libsvn_wc/copy.c?rev=1805887&r1=1805886&r2=1805887&view=diff
==============================================================================
--- subversion/branches/addremove/subversion/libsvn_wc/copy.c (original)
+++ subversion/branches/addremove/subversion/libsvn_wc/copy.c Wed Aug 23
11:55:10 2017
@@ -1159,14 +1159,15 @@ svn_wc__move2(svn_wc_context_t *wc_ctx,
}
svn_error_t *
-svn_wc__move_fixup(svn_wc_context_t *wc_ctx,
- const char *src_abspath,
- const char *dst_abspath,
- 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__fixup_copyfrom(svn_wc_context_t *wc_ctx,
+ const char *src_abspath,
+ const char *dst_abspath,
+ svn_boolean_t is_move,
+ 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_t *db = wc_ctx->db;
svn_node_kind_t src_kind;
@@ -1227,9 +1228,9 @@ svn_wc__move_fixup(svn_wc_context_t *wc_
svn_dirent_local_style(dst_abspath,
scratch_pool));
- SVN_ERR(svn_wc__db_move_fixup(wc_ctx->db, src_abspath, dst_abspath,
- cancel_func, cancel_baton,
- notify_func, notify_baton,
- scratch_pool));
+ SVN_ERR(svn_wc__db_fixup_copyfrom(wc_ctx->db, src_abspath, dst_abspath,
+ is_move, cancel_func, cancel_baton,
+ notify_func, notify_baton,
+ scratch_pool));
return SVN_NO_ERROR;
}
Modified: subversion/branches/addremove/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/branches/addremove/subversion/libsvn_wc/wc_db.c?rev=1805887&r1=1805886&r2=1805887&view=diff
==============================================================================
--- subversion/branches/addremove/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/addremove/subversion/libsvn_wc/wc_db.c Wed Aug 23
11:55:10 2017
@@ -16770,10 +16770,11 @@ update_origin(svn_wc__db_wcroot_t *wcroo
}
static svn_error_t *
-move_fixup(svn_wc__db_wcroot_t *wcroot,
- const char *src_relpath,
- const char *dst_relpath,
- apr_pool_t *scratch_pool)
+fixup_copyfrom(svn_wc__db_wcroot_t *wcroot,
+ const char *src_relpath,
+ const char *dst_relpath,
+ svn_boolean_t is_move,
+ apr_pool_t *scratch_pool)
{
svn_wc__db_status_t src_status;
svn_wc__db_status_t dst_status;
@@ -16786,7 +16787,6 @@ move_fixup(svn_wc__db_wcroot_t *wcroot,
apr_int64_t dst_repos_id;
svn_boolean_t src_is_op_root;
svn_boolean_t dst_is_op_root;
- const char *moved_to_relpath;
const char *moved_from_relpath;
SVN_ERR(read_info(&src_status, &src_kind, NULL, NULL, NULL,
@@ -16806,16 +16806,22 @@ move_fixup(svn_wc__db_wcroot_t *wcroot,
_("'%s' is not the root of a deletion"),
path_for_error_message(wcroot, src_relpath,
scratch_pool));
- /* Source must not already be part of a move. */
- SVN_ERR(scan_deletion(NULL, &moved_to_relpath, NULL, NULL,
- wcroot, src_relpath, scratch_pool, scratch_pool));
- if (moved_to_relpath != NULL)
- return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' is already moved to '%s'"),
- path_for_error_message(wcroot, src_relpath,
- scratch_pool),
- path_for_error_message(wcroot, moved_to_relpath,
- scratch_pool));
+ if (is_move)
+ {
+ const char *moved_to_relpath;
+
+ /* Source must not already be part of a move. */
+ SVN_ERR(scan_deletion(NULL, &moved_to_relpath, NULL, NULL,
+ wcroot, src_relpath, scratch_pool, scratch_pool));
+ if (moved_to_relpath != NULL)
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is already moved to '%s'"),
+ path_for_error_message(wcroot, src_relpath,
+ scratch_pool),
+ path_for_error_message(wcroot,
+ moved_to_relpath,
+ scratch_pool));
+ }
SVN_ERR(get_origin_of_delete_op_root(&src_repos_relpath, &src_revision,
&src_repos_id, src_relpath, wcroot,
@@ -16828,17 +16834,21 @@ move_fixup(svn_wc__db_wcroot_t *wcroot,
path_for_error_message(wcroot, dst_relpath,
scratch_pool));
- /* Destination must not already be part of a move. */
SVN_ERR(scan_addition(NULL, NULL, NULL, &dst_repos_id, NULL, NULL, NULL,
&moved_from_relpath, NULL, NULL,
wcroot, dst_relpath, scratch_pool, scratch_pool));
- if (moved_from_relpath != NULL)
- return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' was already moved here from '%s'"),
- path_for_error_message(wcroot, dst_relpath,
- scratch_pool),
- path_for_error_message(wcroot, moved_from_relpath,
- scratch_pool));
+ if (is_move)
+ {
+ /* Destination must not already be part of a move. */
+ if (moved_from_relpath != NULL)
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' was already moved here from '%s'"),
+ path_for_error_message(wcroot, dst_relpath,
+ scratch_pool),
+ path_for_error_message(wcroot,
+ moved_from_relpath,
+ scratch_pool));
+ }
/* Source and destination must be from the same repository. */
if (src_repos_id != dst_repos_id)
@@ -16850,8 +16860,11 @@ move_fixup(svn_wc__db_wcroot_t *wcroot,
path_for_error_message(wcroot, dst_relpath,
scratch_pool));
- /* Set the moved-here flag on the destination and children, if any. */
- SVN_ERR(set_moved_here_recursive(wcroot, dst_relpath, scratch_pool));
+ if (is_move)
+ {
+ /* Set the moved-here flag on the destination and children, if any. */
+ SVN_ERR(set_moved_here_recursive(wcroot, dst_relpath, scratch_pool));
+ }
/* Rewrite copyfrom on the destination. The repository location of the
* source will become the destination's new copyfrom url@revision. */
@@ -16871,23 +16884,27 @@ move_fixup(svn_wc__db_wcroot_t *wcroot,
moves, scratch_pool));
}
- /* Rewrite the moved-to path on the source. */
- SVN_ERR(delete_update_movedto(wcroot,
- src_relpath, relpath_depth(src_relpath),
- dst_relpath, scratch_pool));
+ if (is_move)
+ {
+ /* Rewrite the moved-to path on the source. */
+ SVN_ERR(delete_update_movedto(wcroot,
+ src_relpath, relpath_depth(src_relpath),
+ dst_relpath, scratch_pool));
+ }
return SVN_NO_ERROR;
}
svn_error_t *
-svn_wc__db_move_fixup(svn_wc__db_t *db,
- const char *src_abspath,
- const char *dst_abspath,
- 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_fixup_copyfrom(svn_wc__db_t *db,
+ const char *src_abspath,
+ const char *dst_abspath,
+ svn_boolean_t is_move,
+ 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 *src_wcroot;
svn_wc__db_wcroot_t *dst_wcroot;
@@ -16916,7 +16933,8 @@ svn_wc__db_move_fixup(svn_wc__db_t *db,
scratch_pool));
SVN_WC__DB_WITH_TXN(
- move_fixup(src_wcroot, src_relpath, dst_relpath, scratch_pool),
+ fixup_copyfrom(src_wcroot, src_relpath, dst_relpath, is_move,
+ scratch_pool),
src_wcroot);
return SVN_NO_ERROR;
Modified: subversion/branches/addremove/subversion/libsvn_wc/wc_db.h
URL:
http://svn.apache.org/viewvc/subversion/branches/addremove/subversion/libsvn_wc/wc_db.h?rev=1805887&r1=1805886&r2=1805887&view=diff
==============================================================================
--- subversion/branches/addremove/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/addremove/subversion/libsvn_wc/wc_db.h Wed Aug 23
11:55:10 2017
@@ -3537,16 +3537,17 @@ svn_wc__db_verify_db_full(svn_wc__db_t *
void *baton,
apr_pool_t *scratch_pool);
-/* Internal implementation of svn_wc__move_fixup(). */
+/* Internal implementation of svn_wc__fixup_copyfrom(). */
svn_error_t *
-svn_wc__db_move_fixup(svn_wc__db_t *db,
- const char *src_abspath,
- const char *dst_abspath,
- 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_fixup_copyfrom(svn_wc__db_t *db,
+ const char *src_abspath,
+ const char *dst_abspath,
+ svn_boolean_t is_move,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool);
#ifdef __cplusplus
}