You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/03/30 22:58:01 UTC
svn commit: r929279 [8/20] - in /subversion/branches/svn-patch-improvements:
./ build/ac-macros/ build/generator/ build/generator/templates/
contrib/client-side/emacs/ notes/feedback/ notes/meetings/ notes/wc-ng/
subversion/ subversion/bindings/javahl/...
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/commit.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/commit.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/commit.c Tue Mar 30 20:57:53 2010
@@ -221,8 +221,8 @@ import_file(const svn_delta_editor_t *ed
{
for (hi = apr_hash_first(pool, properties); hi; hi = apr_hash_next(hi))
{
- const char *pname = svn_apr_hash_index_key(hi);
- const svn_string_t *pval = svn_apr_hash_index_val(hi);
+ const char *pname = svn__apr_hash_index_key(hi);
+ const svn_string_t *pval = svn__apr_hash_index_val(hi);
SVN_ERR(editor->change_file_prop(file_baton, pname, pval, pool));
}
@@ -315,8 +315,8 @@ import_dir(const svn_delta_editor_t *edi
for (hi = apr_hash_first(pool, dirents); hi; hi = apr_hash_next(hi))
{
const char *this_path, *this_edit_path, *abs_path;
- const char *filename = svn_apr_hash_index_key(hi);
- const svn_io_dirent_t *dirent = svn_apr_hash_index_val(hi);
+ const char *filename = svn__apr_hash_index_key(hi);
+ const svn_io_dirent_t *dirent = svn__apr_hash_index_val(hi);
svn_pool_clear(subpool);
@@ -478,7 +478,7 @@ import_dir(const svn_delta_editor_t *edi
*/
static svn_error_t *
import(const char *path,
- apr_array_header_t *new_entries,
+ const apr_array_header_t *new_entries,
const svn_delta_editor_t *editor,
void *edit_baton,
svn_depth_t depth,
@@ -601,7 +601,7 @@ get_ra_editor(svn_ra_session_t **ra_sess
const char *base_url,
const char *base_dir,
const char *log_msg,
- apr_array_header_t *commit_items,
+ const apr_array_header_t *commit_items,
const apr_hash_t *revprop_table,
svn_commit_info_t **commit_info_p,
svn_boolean_t is_commit,
@@ -801,6 +801,9 @@ svn_client_import3(svn_commit_info_t **c
}
+/* Remove (if it exists) each file whose path is given by a value in the
+ * hash TEMPFILES, which is a mapping from (const char *) path to (const
+ * char *) tempfile abspath. Ignore the keys of TEMPFILES. */
static svn_error_t *
remove_tmpfiles(apr_hash_t *tempfiles,
apr_pool_t *pool)
@@ -818,7 +821,7 @@ remove_tmpfiles(apr_hash_t *tempfiles,
/* Clean up any tempfiles. */
for (hi = apr_hash_first(pool, tempfiles); hi; hi = apr_hash_next(hi))
{
- const char *path = svn_apr_hash_index_key(hi);
+ const char *path = svn__apr_hash_index_val(hi);
svn_pool_clear(subpool);
@@ -914,8 +917,8 @@ collect_lock_tokens(apr_hash_t **result,
for (hi = apr_hash_first(pool, all_tokens); hi; hi = apr_hash_next(hi))
{
- const char *url = svn_apr_hash_index_key(hi);
- const char *token = svn_apr_hash_index_val(hi);
+ const char *url = svn__apr_hash_index_key(hi);
+ const char *token = svn__apr_hash_index_val(hi);
if (strncmp(base_url, url, base_len) == 0
&& (url[base_len] == '\0' || url[base_len] == '/'))
@@ -935,7 +938,7 @@ struct post_commit_baton
{
svn_wc_committed_queue_t *queue;
apr_pool_t *qpool;
- svn_wc_adm_access_t *base_dir_access;
+ svn_wc_context_t *wc_ctx;
svn_boolean_t keep_changelists;
svn_boolean_t keep_locks;
apr_hash_t *checksums;
@@ -950,35 +953,23 @@ post_process_commit_item(void *baton, vo
svn_client_commit_item3_t *item =
*(svn_client_commit_item3_t **)this_item;
svn_boolean_t loop_recurse = FALSE;
- const char *adm_access_path;
- svn_wc_adm_access_t *adm_access;
svn_boolean_t remove_lock;
- svn_error_t *bump_err;
-
- if (item->kind == svn_node_dir)
- adm_access_path = item->path;
- else
- adm_access_path = svn_dirent_dirname(item->path, pool);
- bump_err = svn_wc_adm_retrieve(&adm_access, btn->base_dir_access,
- adm_access_path, pool);
- if (bump_err
- && bump_err->apr_err == SVN_ERR_WC_NOT_LOCKED)
- {
- /* Is it a directory that was deleted in the commit?
- Then we probably committed a missing directory. */
- if (item->kind == svn_node_dir
- && item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
- {
- /* Mark it as deleted in the parent. */
- svn_error_clear(bump_err);
- return svn_wc_mark_missing_deleted(item->path,
- btn->base_dir_access, pool);
- }
+ /* Is it a missing, deleted directory?
+
+ ### Temporary: once we centralise this sort of node is just a
+ normal delete and will get handled by the post-commit queue. */
+ if (item->kind == svn_node_dir
+ && item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
+ {
+ svn_boolean_t obstructed;
+
+ SVN_ERR(svn_wc__node_is_status_obstructed(&obstructed,
+ btn->wc_ctx, item->path, pool));
+ if (obstructed)
+ return svn_wc__temp_mark_missing_not_present(item->path,
+ btn->wc_ctx, pool);
}
- if (bump_err)
- return bump_err;
-
if ((item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)
&& (item->kind == svn_node_dir)
@@ -990,7 +981,7 @@ post_process_commit_item(void *baton, vo
/* Allocate the queue in a longer-lived pool than (iter)pool:
we want it to survive the next iteration. */
- return svn_wc_queue_committed2(btn->queue, item->path, adm_access,
+ return svn_wc_queue_committed3(btn->queue, item->path,
loop_recurse, item->incoming_prop_changes,
remove_lock, !btn->keep_changelists,
apr_hash_get(btn->checksums,
@@ -1013,7 +1004,6 @@ commit_item_is_changed(void *baton, void
struct check_dir_delete_baton
{
- svn_wc_adm_access_t *base_dir_access;
svn_wc_context_t *wc_ctx;
svn_depth_t depth;
};
@@ -1022,17 +1012,24 @@ static svn_error_t *
check_nonrecursive_dir_delete(void *baton, void *this_item, apr_pool_t *pool)
{
struct check_dir_delete_baton *btn = baton;
- const char *target_abspath;
+ const char *target_abspath, *lock_abspath;
+ svn_boolean_t locked_here;
+ svn_node_kind_t kind;
SVN_ERR(svn_dirent_get_absolute(&target_abspath, *(const char **)this_item,
pool));
- {
- svn_wc_adm_access_t *adm_access;
- SVN_ERR_W(svn_wc_adm_probe_retrieve(&adm_access, btn->base_dir_access,
- target_abspath, pool),
- _("Are all the targets part of the same working copy?"));
- }
+ SVN_ERR(svn_wc__node_get_kind(&kind, btn->wc_ctx, target_abspath, FALSE,
+ pool));
+ if (kind == svn_node_dir)
+ lock_abspath = target_abspath;
+ else
+ lock_abspath = svn_dirent_dirname(target_abspath, pool);
+
+ SVN_ERR(svn_wc_locked2(&locked_here, NULL, btn->wc_ctx, lock_abspath, pool));
+ if (!locked_here)
+ return svn_error_create(SVN_ERR_WC_LOCKED, NULL,
+ _("Are all targets part of the same working copy?"));
/* ### TODO(sd): This check is slightly too strict. It should be
### possible to:
@@ -1052,13 +1049,10 @@ check_nonrecursive_dir_delete(void *bato
*/
if (btn->depth != svn_depth_infinity)
{
- svn_wc_status2_t *status;
- svn_node_kind_t kind;
-
- SVN_ERR(svn_io_check_path(target_abspath, &kind, pool));
-
if (kind == svn_node_dir)
{
+ svn_wc_status2_t *status;
+
/* ### Looking at schedule is probably enough, no need for
pristine compare etc. */
SVN_ERR(svn_wc_status3(&status, btn->wc_ctx, target_abspath, pool,
@@ -1106,7 +1100,6 @@ svn_client_commit4(svn_commit_info_t **c
apr_hash_t *lock_tokens;
apr_hash_t *tempfiles = NULL;
apr_hash_t *checksums;
- svn_wc_adm_access_t *base_dir_access;
apr_array_header_t *commit_items;
svn_error_t *cmt_err = SVN_NO_ERROR, *unlock_err = SVN_NO_ERROR;
svn_error_t *bump_err = SVN_NO_ERROR, *cleanup_err = SVN_NO_ERROR;
@@ -1164,13 +1157,7 @@ svn_client_commit4(svn_commit_info_t **c
}
}
- SVN_ERR(svn_wc__adm_open_in_context(&base_dir_access,
- ctx->wc_ctx,
- base_dir,
- TRUE, /* Write lock */
- -1, /* recursive lock */
- ctx->cancel_func, ctx->cancel_baton,
- pool));
+ SVN_ERR(svn_wc__acquire_write_lock(NULL, ctx->wc_ctx, base_dir, pool, pool));
/* One day we might support committing from multiple working copies, but
we don't yet. This check ensures that we don't silently commit a
@@ -1181,7 +1168,6 @@ svn_client_commit4(svn_commit_info_t **c
{
struct check_dir_delete_baton btn;
- btn.base_dir_access = base_dir_access;
btn.wc_ctx = ctx->wc_ctx;
btn.depth = depth;
SVN_ERR(svn_iter_apr_array(NULL, targets,
@@ -1192,7 +1178,7 @@ svn_client_commit4(svn_commit_info_t **c
/* Crawl the working copy for commit items. */
if ((cmt_err = svn_client__harvest_committables(&committables,
&lock_tokens,
- base_dir_access,
+ base_dir,
rel_targets,
depth,
! keep_locks,
@@ -1282,7 +1268,7 @@ svn_client_commit4(svn_commit_info_t **c
btn.queue = queue;
btn.qpool = pool;
- btn.base_dir_access = base_dir_access;
+ btn.wc_ctx = ctx->wc_ctx;
btn.keep_changelists = keep_changelists;
btn.keep_locks = keep_locks;
btn.checksums = checksums;
@@ -1298,7 +1284,7 @@ svn_client_commit4(svn_commit_info_t **c
SVN_ERR_ASSERT(*commit_info_p);
bump_err
- = svn_wc_process_committed_queue(queue, base_dir_access,
+ = svn_wc_process_committed_queue2(queue, ctx->wc_ctx,
(*commit_info_p)->revision,
(*commit_info_p)->date,
(*commit_info_p)->author,
@@ -1320,7 +1306,7 @@ svn_client_commit4(svn_commit_info_t **c
clean-up. */
if (! bump_err)
{
- unlock_err = svn_wc_adm_close2(base_dir_access, pool);
+ unlock_err = svn_wc__release_write_lock(ctx->wc_ctx, base_dir, pool);
if (! unlock_err)
cleanup_err = remove_tmpfiles(tempfiles, pool);
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/commit_util.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/commit_util.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/commit_util.c Tue Mar 30 20:57:53 2010
@@ -163,7 +163,7 @@ look_up_committable(apr_hash_t *committa
for (hi = apr_hash_first(pool, committables); hi; hi = apr_hash_next(hi))
{
- apr_array_header_t *these_committables = svn_apr_hash_index_val(hi);
+ apr_array_header_t *these_committables = svn__apr_hash_index_val(hi);
int i;
for (i = 0; i < these_committables->nelts; i++)
@@ -197,7 +197,7 @@ add_lock_token(const char *local_abspath
apr_pool_t *token_pool = apr_hash_pool_get(altb->lock_tokens);
const char* lock_token;
const char* url;
-
+
/* I want every lock-token I can get my dirty hands on!
If this entry is switched, so what. We will send an irrelevant lock
token. */
@@ -206,7 +206,7 @@ add_lock_token(const char *local_abspath
if (!lock_token)
return SVN_NO_ERROR;
- SVN_ERR(svn_wc__node_get_url(&url, altb->wc_ctx, local_abspath,
+ SVN_ERR(svn_wc__node_get_url(&url, altb->wc_ctx, local_abspath,
token_pool, scratch_pool));
if (url)
apr_hash_set(altb->lock_tokens, url,
@@ -257,7 +257,7 @@ bail_on_tree_conflicted_children(svn_wc_
for (hi = apr_hash_first(pool, conflicts); hi; hi = apr_hash_next(hi))
{
const svn_wc_conflict_description_t *conflict =
- svn_apr_hash_index_val(hi);
+ svn__apr_hash_index_val(hi);
if ((conflict->node_kind == svn_node_dir) &&
(depth == svn_depth_files))
@@ -326,15 +326,15 @@ bail_on_tree_conflicted_ancestor(svn_wc_
}
-/* Recursively search for commit candidates in (and under) PATH (with
- entry ENTRY and ancestry URL), and add those candidates to
+/* Recursively search for commit candidates in (and under) LOCAL_ABSPATH
+ (with entry ENTRY and ancestry URL), and add those candidates to
COMMITTABLES. If in ADDS_ONLY modes, only new additions are
recognized. COPYFROM_URL is the default copyfrom-url for children
of copied directories.
- DEPTH indicates how to treat files and subdirectories of PATH when
- PATH is itself a directory; see svn_client__harvest_committables()
- for its behavior.
+ DEPTH indicates how to treat files and subdirectories of LOCAL_ABSPATH
+ when LOCAL_ABSPATH is itself a directory; see
+ svn_client__harvest_committables() for its behavior.
Lock tokens of candidates will be added to LOCK_TOKENS, if
non-NULL. JUST_LOCKED indicates whether to treat non-modified items with
@@ -357,7 +357,7 @@ bail_on_tree_conflicted_ancestor(svn_wc_
static svn_error_t *
harvest_committables(apr_hash_t *committables,
apr_hash_t *lock_tokens,
- const char *path,
+ const char *local_abspath,
const char *url,
const char *copyfrom_url,
const svn_wc_entry_t *entry,
@@ -373,19 +373,17 @@ harvest_committables(apr_hash_t *committ
svn_boolean_t text_mod = FALSE, prop_mod = FALSE;
apr_byte_t state_flags = 0;
svn_node_kind_t kind;
- const char *p_path;
const char *cf_url = NULL;
svn_revnum_t cf_rev = entry->copyfrom_rev;
const svn_string_t *propval;
svn_boolean_t is_special;
apr_pool_t *token_pool = (lock_tokens ? apr_hash_pool_get(lock_tokens)
: NULL);
- const char *local_abspath;
- SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
/* Early out if the item is already marked as committable. */
- if (look_up_committable(committables, path, scratch_pool))
+ if (look_up_committable(committables, local_abspath, scratch_pool))
return SVN_NO_ERROR;
SVN_ERR_ASSERT(entry);
@@ -394,18 +392,16 @@ harvest_committables(apr_hash_t *committ
if (ctx->cancel_func)
SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
- /* Make P_PATH the parent dir. */
- p_path = svn_dirent_dirname(path, scratch_pool);
-
/* Return error on unknown path kinds. We check both the entry and
the node itself, since a path might have changed kind since its
entry was written. */
if ((entry->kind != svn_node_file) && (entry->kind != svn_node_dir))
return svn_error_createf
(SVN_ERR_NODE_UNKNOWN_KIND, NULL, _("Unknown entry kind for '%s'"),
- svn_dirent_local_style(path, scratch_pool));
+ svn_dirent_local_style(local_abspath, scratch_pool));
- SVN_ERR(svn_io_check_special_path(path, &kind, &is_special, scratch_pool));
+ SVN_ERR(svn_io_check_special_path(local_abspath, &kind, &is_special,
+ scratch_pool));
if ((kind != svn_node_file)
&& (kind != svn_node_dir)
@@ -414,7 +410,7 @@ harvest_committables(apr_hash_t *committ
return svn_error_createf
(SVN_ERR_NODE_UNKNOWN_KIND, NULL,
_("Unknown entry kind for '%s'"),
- svn_dirent_local_style(path, scratch_pool));
+ svn_dirent_local_style(local_abspath, scratch_pool));
}
/* Verify that the node's type has not changed before attempting to
@@ -431,7 +427,7 @@ harvest_committables(apr_hash_t *committ
return svn_error_createf
(SVN_ERR_NODE_UNEXPECTED_KIND, NULL,
_("Entry '%s' has unexpectedly changed special status"),
- svn_dirent_local_style(path, scratch_pool));
+ svn_dirent_local_style(local_abspath, scratch_pool));
}
if (entry->file_external_path && copy_mode)
@@ -470,7 +466,7 @@ harvest_committables(apr_hash_t *committ
return svn_error_createf(
SVN_ERR_WC_FOUND_CONFLICT, NULL,
_("Aborting commit: '%s' remains in conflict"),
- svn_dirent_local_style(path, scratch_pool));
+ svn_dirent_local_style(local_abspath, scratch_pool));
}
}
@@ -548,7 +544,7 @@ harvest_committables(apr_hash_t *committ
return svn_error_createf
(SVN_ERR_WC_CORRUPT, NULL,
_("Did not expect '%s' to be a working copy root"),
- svn_dirent_local_style(path, scratch_pool));
+ svn_dirent_local_style(local_abspath, scratch_pool));
/* If the ENTRY's revision differs from that of its parent, we
have to explicitly commit ENTRY as a copy. */
@@ -566,7 +562,7 @@ harvest_committables(apr_hash_t *committ
return svn_error_createf
(SVN_ERR_BAD_URL, NULL,
_("Commit item '%s' has copy flag but no copyfrom URL"),
- svn_dirent_local_style(path, scratch_pool));
+ svn_dirent_local_style(local_abspath, scratch_pool));
}
}
@@ -579,13 +575,13 @@ harvest_committables(apr_hash_t *committ
/* First of all, the working file or directory must exist.
See issue #3198. */
- SVN_ERR(svn_io_check_path(path, &working_kind, scratch_pool));
+ SVN_ERR(svn_io_check_path(local_abspath, &working_kind, scratch_pool));
if (working_kind == svn_node_none)
{
return svn_error_createf
(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
_("'%s' is scheduled for addition, but is missing"),
- svn_dirent_local_style(path, scratch_pool));
+ svn_dirent_local_style(local_abspath, scratch_pool));
}
/* See if there are property modifications to send. */
@@ -653,7 +649,7 @@ harvest_committables(apr_hash_t *committ
scratch_pool))
{
/* Finally, add the committable item. */
- add_committable(committables, path, entry->kind, url,
+ add_committable(committables, local_abspath, entry->kind, url,
entry->revision,
cf_url,
cf_rev,
@@ -771,9 +767,10 @@ harvest_committables(apr_hash_t *committ
this_entry->schedule == svn_wc_schedule_delete)
continue;
- full_path = svn_dirent_join(path, name, iterpool);
+ full_path = svn_dirent_join(local_abspath, name, iterpool);
if (this_cf_url)
- this_cf_url = svn_path_url_add_component2(this_cf_url, name, iterpool);
+ this_cf_url = svn_path_url_add_component2(this_cf_url, name,
+ iterpool);
/* We'll use the entry's URL if it has one and if we aren't
in copy_mode, else, we'll just extend the parent's URL
@@ -925,8 +922,8 @@ validate_dangler(void *baton,
svn_error_t *
svn_client__harvest_committables(apr_hash_t **committables,
apr_hash_t **lock_tokens,
- svn_wc_adm_access_t *parent_adm,
- apr_array_header_t *targets,
+ const char *dir_abspath,
+ const apr_array_header_t *targets,
svn_depth_t depth,
svn_boolean_t just_locked,
const apr_array_header_t *changelists,
@@ -961,6 +958,8 @@ svn_client__harvest_committables(apr_has
*/
apr_hash_t *danglers = apr_hash_make(pool);
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(dir_abspath));
+
/* Create the COMMITTABLES hash. */
*committables = apr_hash_make(pool);
@@ -975,7 +974,6 @@ svn_client__harvest_committables(apr_has
do
{
const svn_wc_entry_t *entry;
- const char *target;
const char *target_abspath;
svn_error_t *err;
@@ -985,13 +983,12 @@ svn_client__harvest_committables(apr_has
relative paths, TARGET will just be PARENT_ADM for a single
iteration). */
if (targets->nelts)
- target = svn_dirent_join(svn_wc_adm_access_path(parent_adm),
- APR_ARRAY_IDX(targets, i, const char *),
- subpool);
+ target_abspath = svn_dirent_join(dir_abspath,
+ APR_ARRAY_IDX(targets, i,
+ const char *),
+ subpool);
else
- target = svn_wc_adm_access_path(parent_adm);
-
- SVN_ERR(svn_dirent_get_absolute(&target_abspath, target, subpool));
+ target_abspath = dir_abspath;
/* No entry? This TARGET isn't even under version control! */
err = svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, target_abspath,
@@ -1019,7 +1016,7 @@ svn_client__harvest_committables(apr_has
if (! entry->url)
return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
_("Entry for '%s' has no URL"),
- svn_dirent_local_style(target, pool));
+ svn_dirent_local_style(target_abspath, pool));
/* We have to be especially careful around entries scheduled for
addition or replacement. */
@@ -1038,7 +1035,7 @@ svn_client__harvest_committables(apr_has
return svn_error_createf(
SVN_ERR_WC_CORRUPT, NULL,
_("'%s' is scheduled for addition within unversioned parent"),
- svn_dirent_local_style(target, pool));
+ svn_dirent_local_style(target_abspath, pool));
}
SVN_ERR(err);
@@ -1047,9 +1044,9 @@ svn_client__harvest_committables(apr_has
/* Copy the parent and target into pool; subpool
lasts only for this loop iteration, and we check
danglers after the loop is over. */
- apr_hash_set(danglers, svn_dirent_dirname(target, pool),
+ apr_hash_set(danglers, svn_dirent_dirname(target_abspath, pool),
APR_HASH_KEY_STRING,
- apr_pstrdup(pool, target));
+ apr_pstrdup(pool, target_abspath));
}
}
@@ -1062,7 +1059,7 @@ svn_client__harvest_committables(apr_has
_("Entry for '%s' is marked as 'copied' but is not itself scheduled"
"\nfor addition. Perhaps you're committing a target that is\n"
"inside an unversioned (or not-yet-versioned) directory?"),
- svn_dirent_local_style(target, pool));
+ svn_dirent_local_style(target_abspath, pool));
/* Handle our TARGET. */
/* Make sure this isn't inside a working copy subtree that is
@@ -1074,7 +1071,7 @@ svn_client__harvest_committables(apr_has
target_abspath, subpool)),
subpool));
- SVN_ERR(harvest_committables(*committables, *lock_tokens, target,
+ SVN_ERR(harvest_committables(*committables, *lock_tokens, target_abspath,
entry->url, NULL,
entry, NULL, FALSE, FALSE, depth,
just_locked, changelist_hash,
@@ -1269,7 +1266,6 @@ struct file_mod_t
/* A baton for use with the path-based editor driver */
struct path_driver_cb_baton
{
- svn_wc_adm_access_t *adm_access; /* top-level access baton */
const svn_delta_editor_t *editor; /* commit editor */
void *edit_baton; /* commit editor's baton */
apr_hash_t *file_mods; /* hash: path->file_mod_t */
@@ -1280,7 +1276,12 @@ struct path_driver_cb_baton
};
-/* This implements svn_delta_path_driver_cb_func_t */
+/* This implements svn_delta_path_driver_cb_func_t.
+ * Act on the item of CALLBACK_BATON->commit_items keyed by PATH.
+ * CALLBACK_BATON->commit_items is an input.
+ * If the item is a file with text mods, then add a mapping of "item-url =>
+ * (commit-item, file-baton)" into CALLBACK_BATON->file_mods.
+ * (That is the sole use of CALLBACK_BATON->file_mods.) */
static svn_error_t *
do_item_commit(void **dir_baton,
void *parent_baton,
@@ -1578,11 +1579,11 @@ static svn_error_t *get_test_editor(cons
svn_error_t *
svn_client__do_commit(const char *base_url,
- apr_array_header_t *commit_items,
+ const apr_array_header_t *commit_items,
const svn_delta_editor_t *editor,
void *edit_baton,
const char *notify_path_prefix,
- apr_hash_t **tempfiles,
+ apr_hash_t **new_text_base_abspaths,
apr_hash_t **checksums,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
@@ -1606,8 +1607,8 @@ svn_client__do_commit(const char *base_u
/* If the caller wants us to track temporary file creation, create a
hash to store those paths in. */
- if (tempfiles)
- *tempfiles = apr_hash_make(pool);
+ if (new_text_base_abspaths)
+ *new_text_base_abspaths = apr_hash_make(pool);
/* Ditto for the md5 checksums. */
if (checksums)
@@ -1640,7 +1641,7 @@ svn_client__do_commit(const char *base_u
/* Transmit outstanding text deltas. */
for (hi = apr_hash_first(pool, file_mods); hi; hi = apr_hash_next(hi))
{
- struct file_mod_t *mod = svn_apr_hash_index_val(hi);
+ struct file_mod_t *mod = svn__apr_hash_index_val(hi);
svn_client_commit_item3_t *item;
void *file_baton;
const char *tempfile;
@@ -1672,15 +1673,14 @@ svn_client__do_commit(const char *base_u
if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)
fulltext = TRUE;
- SVN_ERR(svn_wc_transmit_text_deltas3(tempfiles ? &tempfile : NULL,
+ SVN_ERR(svn_wc_transmit_text_deltas3(new_text_base_abspaths ? &tempfile
+ : NULL,
digest, ctx->wc_ctx, item_abspath,
fulltext, editor, file_baton,
iterpool, iterpool));
- if (tempfiles && tempfile)
- {
- tempfile = apr_pstrdup(pool, tempfile);
- apr_hash_set(*tempfiles, tempfile, APR_HASH_KEY_STRING, (void *)1);
- }
+ if (new_text_base_abspaths && tempfile)
+ apr_hash_set(*new_text_base_abspaths, item->path, APR_HASH_KEY_STRING,
+ apr_pstrdup(pool, tempfile));
if (checksums)
apr_hash_set(*checksums, item->path, APR_HASH_KEY_STRING,
svn_checksum__from_digest(digest, svn_checksum_md5,
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/copy.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/copy.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/copy.c Tue Mar 30 20:57:53 2010
@@ -70,33 +70,30 @@
/* Obtain the implied mergeinfo and the existing mergeinfo of the
source path, combine them and return the result in
- *TARGET_MERGEINFO. ADM_ACCESS may be NULL, if SRC_PATH_OR_URL is an
- URL. If NO_REPOS_ACCESS is set, this function is disallowed from
- consulting the repository about anything. RA_SESSION may be NULL but
- only if NO_REPOS_ACCESS is true. */
+ *TARGET_MERGEINFO. One of LOCAL_ABSPATH and SRC_URL must be valid,
+ the other must be NULL. */
static svn_error_t *
calculate_target_mergeinfo(svn_ra_session_t *ra_session,
apr_hash_t **target_mergeinfo,
- svn_wc_adm_access_t *adm_access,
- const char *src_path_or_url,
+ const char *local_abspath,
+ const char *src_url,
svn_revnum_t src_revnum,
- svn_boolean_t no_repos_access,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
const svn_wc_entry_t *entry = NULL;
svn_boolean_t locally_added = FALSE;
- const char *src_url;
apr_hash_t *src_mergeinfo = NULL;
+ SVN_ERR_ASSERT((local_abspath && !src_url) || (!local_abspath && src_url));
+
/* If we have a schedule-add WC path (which was not copied from
elsewhere), it doesn't have any repository mergeinfo, so don't
bother checking. */
- if (adm_access)
+ if (local_abspath)
{
- const char *local_abspath;
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
- SVN_ERR(svn_dirent_get_absolute(&local_abspath, src_path_or_url, pool));
SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, local_abspath,
svn_node_unknown, FALSE, FALSE,
pool, pool));
@@ -112,42 +109,23 @@ calculate_target_mergeinfo(svn_ra_sessio
pool, pool));
}
}
- else
- {
- src_url = src_path_or_url;
- }
if (! locally_added)
{
- if (! no_repos_access)
- {
- /* Fetch any existing (explicit) mergeinfo. We'll temporarily
- reparent to the target URL here, just to keep the code simple.
- We could, as an alternative, first see if the target URL was a
- child of the session URL and use the relative "remainder",
- falling back to this reparenting as necessary. */
- const char *old_session_url = NULL;
- SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url,
- ra_session, src_url, pool));
- SVN_ERR(svn_client__get_repos_mergeinfo(ra_session, &src_mergeinfo,
- "", src_revnum,
- svn_mergeinfo_inherited,
- TRUE, pool));
- if (old_session_url)
- SVN_ERR(svn_ra_reparent(ra_session, old_session_url, pool));
- }
- else
- {
- svn_boolean_t inherited;
- const char *local_abspath;
-
- SVN_ERR(svn_dirent_get_absolute(&local_abspath, src_path_or_url,
- pool));
- SVN_ERR(svn_client__get_wc_mergeinfo(&src_mergeinfo, &inherited,
- svn_mergeinfo_inherited,
- local_abspath, NULL,
- NULL, ctx, pool, pool));
- }
+ /* Fetch any existing (explicit) mergeinfo. We'll temporarily
+ reparent to the target URL here, just to keep the code simple.
+ We could, as an alternative, first see if the target URL was a
+ child of the session URL and use the relative "remainder",
+ falling back to this reparenting as necessary. */
+ const char *old_session_url = NULL;
+ SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url,
+ ra_session, src_url, pool));
+ SVN_ERR(svn_client__get_repos_mergeinfo(ra_session, &src_mergeinfo,
+ "", src_revnum,
+ svn_mergeinfo_inherited,
+ TRUE, pool));
+ if (old_session_url)
+ SVN_ERR(svn_ra_reparent(ra_session, old_session_url, pool));
}
*target_mergeinfo = src_mergeinfo;
@@ -277,7 +255,6 @@ do_wc_to_wc_copies_with_write_lock(void
for (i = 0; i < b->copy_pairs->nelts; i++)
{
- const char *dst_parent_abspath;
const char *dst_abspath;
svn_client__copy_pair_t *pair = APR_ARRAY_IDX(b->copy_pairs, i,
svn_client__copy_pair_t *);
@@ -288,12 +265,9 @@ do_wc_to_wc_copies_with_write_lock(void
SVN_ERR(b->ctx->cancel_func(b->ctx->cancel_baton));
/* Perform the copy */
- SVN_ERR(svn_dirent_get_absolute(&pair->src_abs, pair->src, scratch_pool));
- SVN_ERR(svn_dirent_get_absolute(&dst_parent_abspath, pair->dst_parent,
- scratch_pool));
- dst_abspath = svn_dirent_join(dst_parent_abspath, pair->base_name,
+ dst_abspath = svn_dirent_join(pair->dst_parent_abspath, pair->base_name,
iterpool);
- err = svn_wc_copy3(b->ctx->wc_ctx, pair->src_abs, dst_abspath,
+ err = svn_wc_copy3(b->ctx->wc_ctx, pair->src, dst_abspath,
b->ctx->cancel_func, b->ctx->cancel_baton,
b->ctx->notify_func2, b->ctx->notify_baton2, iterpool);
if (err)
@@ -352,12 +326,12 @@ do_wc_to_wc_moves_with_locks2(void *bato
dst_abspath = svn_dirent_join(b->dst_parent_abspath, b->pair->base_name,
scratch_pool);
- SVN_ERR(svn_wc_copy3(b->ctx->wc_ctx, b->pair->src_abs, dst_abspath,
+ SVN_ERR(svn_wc_copy3(b->ctx->wc_ctx, b->pair->src, dst_abspath,
b->ctx->cancel_func, b->ctx->cancel_baton,
b->ctx->notify_func2, b->ctx->notify_baton2,
scratch_pool));
- SVN_ERR(svn_wc_delete4(b->ctx->wc_ctx, b->pair->src_abs, FALSE, FALSE,
+ SVN_ERR(svn_wc_delete4(b->ctx->wc_ctx, b->pair->src, FALSE, FALSE,
b->ctx->cancel_func, b->ctx->cancel_baton,
b->ctx->notify_func2, b->ctx->notify_baton2,
scratch_pool));
@@ -397,9 +371,7 @@ do_wc_to_wc_moves(const apr_array_header
for (i = 0; i < copy_pairs->nelts; i++)
{
- const char *src_parent;
const char *src_parent_abspath;
- const char *dst_parent_abspath;
struct do_wc_to_wc_moves_with_locks_baton baton;
svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
@@ -410,13 +382,7 @@ do_wc_to_wc_moves(const apr_array_header
if (ctx->cancel_func)
SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
- src_parent = svn_dirent_dirname(pair->src, iterpool);
- SVN_ERR(svn_dirent_get_absolute(&src_parent_abspath, src_parent,
- iterpool));
- SVN_ERR(svn_dirent_get_absolute(&dst_parent_abspath, pair->dst_parent,
- iterpool));
-
- SVN_ERR(svn_dirent_get_absolute(&pair->src_abs, pair->src, pool));
+ src_parent_abspath = svn_dirent_dirname(pair->src, iterpool);
/* We now need to lock the right combination of batons.
Four cases:
@@ -425,14 +391,14 @@ do_wc_to_wc_moves(const apr_array_header
3) dst_parent is parent of src_parent
4) src_parent and dst_parent are disjoint
We can handle 1) as either 2) or 3) */
- if (strcmp(src_parent_abspath, dst_parent_abspath) == 0
- || svn_dirent_is_child(src_parent_abspath, dst_parent_abspath,
+ if (strcmp(src_parent_abspath, pair->dst_parent_abspath) == 0
+ || svn_dirent_is_child(src_parent_abspath, pair->dst_parent_abspath,
iterpool))
{
baton.lock_src = TRUE;
baton.lock_dst = FALSE;
}
- else if (svn_dirent_is_child(dst_parent_abspath, src_parent_abspath,
+ else if (svn_dirent_is_child(pair->dst_parent_abspath, src_parent_abspath,
iterpool))
{
baton.lock_src = FALSE;
@@ -447,7 +413,7 @@ do_wc_to_wc_moves(const apr_array_header
/* Perform the copy and then the delete. */
baton.ctx = ctx;
baton.pair = pair;
- baton.dst_parent_abspath = dst_parent_abspath;
+ baton.dst_parent_abspath = pair->dst_parent_abspath;
if (baton.lock_src)
SVN_ERR(svn_wc__call_with_write_lock(do_wc_to_wc_moves_with_locks1,
&baton,
@@ -501,22 +467,24 @@ wc_to_wc_copy(const apr_array_header_t *
_("Path '%s' already exists"),
svn_dirent_local_style(pair->dst, pool));
- svn_dirent_split(pair->dst, &pair->dst_parent, &pair->base_name, pool);
+ svn_dirent_split(pair->dst, &pair->dst_parent_abspath, &pair->base_name,
+ pool);
/* Make sure the destination parent is a directory and produce a clear
error message if it is not. */
- SVN_ERR(svn_io_check_path(pair->dst_parent, &dst_parent_kind, iterpool));
+ SVN_ERR(svn_io_check_path(pair->dst_parent_abspath, &dst_parent_kind,
+ iterpool));
if (make_parents && dst_parent_kind == svn_node_none)
{
- SVN_ERR(svn_client__make_local_parents(pair->dst_parent, TRUE, ctx,
- iterpool));
+ SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath,
+ TRUE, ctx, iterpool));
}
else if (dst_parent_kind != svn_node_dir)
{
return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,
_("Path '%s' is not a directory"),
- svn_dirent_local_style(pair->dst_parent,
- pool));
+ svn_dirent_local_style(
+ pair->dst_parent_abspath, pool));
}
}
@@ -699,9 +667,9 @@ find_absent_parents1(svn_ra_session_t *r
found. Push each nonexistent URL onto the array NEW_DIRS,
allocating in POOL. Raise an error if the existing node is not a
directory.
-
+
Set *TOP_DST_URL and the RA session's root to the existing node's URL.
-
+
### Multiple requests for HEAD (SVN_INVALID_REVNUM) make this
### implementation susceptible to race conditions. */
static svn_error_t *
@@ -813,12 +781,13 @@ repos_to_repos_copy(svn_commit_info_t **
pair->src, &pair->src_peg_revision,
&pair->src_op_revision,
&dead_end_rev, ctx, pool));
-
+
/* Go ahead and grab mergeinfo from the source, too. */
SVN_ERR(svn_client__ensure_ra_session_url(&ignored_url, ra_session,
pair->src, pool));
- SVN_ERR(calculate_target_mergeinfo(ra_session, &mergeinfo, NULL, pair->src,
- pair->src_revnum, FALSE, ctx, pool));
+ SVN_ERR(calculate_target_mergeinfo(ra_session, &mergeinfo, NULL,
+ pair->src,
+ pair->src_revnum, ctx, pool));
if (mergeinfo)
SVN_ERR(svn_mergeinfo_to_string(&info->mergeinfo, mergeinfo, pool));
@@ -1173,7 +1142,6 @@ wc_to_repos_copy(svn_commit_info_t **com
void *edit_baton;
void *commit_baton;
apr_hash_t *committables;
- svn_wc_adm_access_t *adm_access;
apr_array_header_t *commit_items;
const svn_wc_entry_t *entry;
apr_pool_t *iterpool;
@@ -1181,15 +1149,13 @@ wc_to_repos_copy(svn_commit_info_t **com
apr_hash_t *commit_revprops;
int i;
- /* Find the common root of all the source paths, and probe the wc. */
+ /* Find the common root of all the source paths */
get_copy_pair_ancestors(copy_pairs, &top_src_path, NULL, NULL, pool);
- SVN_ERR(svn_wc__adm_probe_in_context(&adm_access, ctx->wc_ctx, top_src_path,
- FALSE, -1, ctx->cancel_func,
- ctx->cancel_baton, pool));
-
- /* The commit process uses absolute paths, so we need to open the access
- baton using absolute paths, and so we really need to use absolute
- paths everywhere. */
+
+ /* Do we need to lock the working copy? 1.6 didn't take a write
+ lock, but what happens if the working copy changes during the copy
+ operation? */
+
iterpool = svn_pool_create(pool);
for (i = 0; i < copy_pairs->nelts; i++)
@@ -1198,8 +1164,7 @@ wc_to_repos_copy(svn_commit_info_t **com
svn_client__copy_pair_t *);
svn_pool_clear(iterpool);
/* Sanity check if the source path is versioned. */
- SVN_ERR(svn_dirent_get_absolute(&pair->src_abs, pair->src, pool));
- SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src_abs,
+ SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src,
svn_node_unknown, FALSE, FALSE,
iterpool, iterpool));
}
@@ -1225,8 +1190,7 @@ wc_to_repos_copy(svn_commit_info_t **com
}
SVN_ERR(svn_client__open_ra_session_internal(&ra_session, top_dst_url,
- svn_wc_adm_access_path(
- adm_access),
+ top_src_path,
NULL, TRUE, TRUE, ctx, pool));
/* If requested, determine the nearest existing parent of the destination,
@@ -1248,7 +1212,7 @@ wc_to_repos_copy(svn_commit_info_t **com
svn_pool_clear(iterpool);
- SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src_abs,
+ SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src,
svn_node_unknown, FALSE, FALSE,
iterpool, iterpool));
pair->src_revnum = entry->revision;
@@ -1304,7 +1268,7 @@ wc_to_repos_copy(svn_commit_info_t **com
if (! message)
{
svn_pool_destroy(iterpool);
- return svn_error_return(svn_wc_adm_close2(adm_access, pool));
+ return SVN_NO_ERROR;
}
}
else
@@ -1327,7 +1291,7 @@ wc_to_repos_copy(svn_commit_info_t **com
SVN_CLIENT__SINGLE_REPOS_NAME,
APR_HASH_KEY_STRING)))
{
- return svn_error_return(svn_wc_adm_close2(adm_access, pool));
+ return SVN_NO_ERROR;
}
/* If we are creating intermediate directories, tack them onto the list
@@ -1367,10 +1331,10 @@ wc_to_repos_copy(svn_commit_info_t **com
info known to the WC and the repository. */
item->outgoing_prop_changes = apr_array_make(pool, 1,
sizeof(svn_prop_t *));
- SVN_ERR(calculate_target_mergeinfo(ra_session, &mergeinfo, adm_access,
- pair->src, pair->src_revnum,
- FALSE, ctx, iterpool));
- SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src_abs,
+ SVN_ERR(calculate_target_mergeinfo(ra_session, &mergeinfo, pair->src,
+ NULL, SVN_INVALID_REVNUM,
+ ctx, iterpool));
+ SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src,
svn_node_unknown, FALSE, FALSE,
pool, pool));
SVN_ERR(svn_client__parse_mergeinfo(&wc_mergeinfo, ctx->wc_ctx,
@@ -1429,8 +1393,7 @@ wc_to_repos_copy(svn_commit_info_t **com
svn_pool_destroy(iterpool);
- /* It's only a read lock, so unlocking is harmless. */
- return svn_error_return(svn_wc_adm_close2(adm_access, pool));
+ return SVN_NO_ERROR;
}
/* Peform each individual copy operation for a repos -> wc copy. A
@@ -1506,7 +1469,7 @@ repos_to_wc_copy_single(svn_client__copy
### source path. */
SVN_ERR(calculate_target_mergeinfo(ra_session, &src_mergeinfo, NULL,
pair->src, src_revnum,
- FALSE, ctx, pool));
+ ctx, pool));
SVN_ERR(extend_wc_mergeinfo(dst_abspath, src_mergeinfo, ctx, pool));
}
else /* different repositories */
@@ -1564,7 +1527,7 @@ repos_to_wc_copy_single(svn_client__copy
SVN_ERR(calculate_target_mergeinfo(ra_session, &src_mergeinfo,
NULL, pair->src, src_revnum,
- FALSE, ctx, pool));
+ ctx, pool));
SVN_ERR(extend_wc_mergeinfo(dst_abspath, src_mergeinfo, ctx, pool));
/* Ideally, svn_wc_add_repos_file3() would take a notify function
@@ -1586,6 +1549,137 @@ repos_to_wc_copy_single(svn_client__copy
return SVN_NO_ERROR;
}
+static svn_error_t*
+repos_to_wc_copy_locked(const apr_array_header_t *copy_pairs,
+ const char *top_dst_path,
+ svn_boolean_t ignore_externals,
+ svn_ra_session_t *ra_session,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool)
+{
+ int i;
+ const char *src_uuid = NULL, *dst_uuid = NULL;
+ svn_boolean_t same_repositories;
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+
+ /* We've already checked for physical obstruction by a working file.
+ But there could also be logical obstruction by an entry whose
+ working file happens to be missing.*/
+ for (i = 0; i < copy_pairs->nelts; i++)
+ {
+ svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
+ svn_client__copy_pair_t *);
+ const svn_wc_entry_t *ent;
+ const char *dst_abspath;
+
+ svn_pool_clear(iterpool);
+ SVN_ERR(svn_dirent_get_absolute(&dst_abspath, pair->dst, iterpool));
+
+ SVN_ERR(svn_wc__maybe_get_entry(&ent, ctx->wc_ctx, dst_abspath,
+ svn_node_unknown, TRUE, FALSE,
+ iterpool, iterpool));
+ if (ent)
+ {
+ /* TODO(#2843): Rework the error report. Maybe we can simplify the
+ condition. Currently, the first is about hidden items and the
+ second is for missing items. */
+ if (ent->depth == svn_depth_exclude
+ || ent->absent)
+ {
+ return svn_error_createf
+ (SVN_ERR_ENTRY_EXISTS,
+ NULL, _("'%s' is already under version control"),
+ svn_dirent_local_style(pair->dst, iterpool));
+ }
+ else if ((ent->kind != svn_node_dir) &&
+ (ent->schedule != svn_wc_schedule_delete)
+ && ! ent->deleted)
+ return svn_error_createf
+ (SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
+ _("Entry for '%s' exists (though the working file is missing)"),
+ svn_dirent_local_style(pair->dst, iterpool));
+ }
+ }
+
+ /* Decide whether the two repositories are the same or not. */
+ {
+ svn_error_t *src_err, *dst_err;
+ const char *parent;
+ const char *parent_abspath;
+
+ /* Get the repository uuid of SRC_URL */
+ src_err = svn_ra_get_uuid2(ra_session, &src_uuid, scratch_pool);
+ if (src_err && src_err->apr_err != SVN_ERR_RA_NO_REPOS_UUID)
+ return svn_error_return(src_err);
+
+ /* Get repository uuid of dst's parent directory, since dst may
+ not exist. ### TODO: we should probably walk up the wc here,
+ in case the parent dir has an imaginary URL. */
+ if (copy_pairs->nelts == 1)
+ parent = svn_dirent_dirname(top_dst_path, scratch_pool);
+ else
+ parent = top_dst_path;
+
+ SVN_ERR(svn_dirent_get_absolute(&parent_abspath, parent, scratch_pool));
+ dst_err = svn_client_uuid_from_path2(&dst_uuid, parent_abspath, ctx,
+ scratch_pool, scratch_pool);
+ if (dst_err && dst_err->apr_err != SVN_ERR_RA_NO_REPOS_UUID)
+ return dst_err;
+
+ /* If either of the UUIDs are nonexistent, then at least one of
+ the repositories must be very old. Rather than punish the
+ user, just assume the repositories are different, so no
+ copy-history is attempted. */
+ if (src_err || dst_err || (! src_uuid) || (! dst_uuid))
+ same_repositories = FALSE;
+
+ else
+ same_repositories = (strcmp(src_uuid, dst_uuid) == 0);
+ }
+
+ /* Perform the move for each of the copy_pairs. */
+ for (i = 0; i < copy_pairs->nelts; i++)
+ {
+ /* Check for cancellation */
+ if (ctx->cancel_func)
+ SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
+
+ svn_pool_clear(iterpool);
+
+ SVN_ERR(repos_to_wc_copy_single(APR_ARRAY_IDX(copy_pairs, i,
+ svn_client__copy_pair_t *),
+ same_repositories,
+ ignore_externals,
+ ra_session, ctx, iterpool));
+ }
+ svn_pool_destroy(iterpool);
+
+ return SVN_NO_ERROR;
+}
+
+struct repos_to_wc_copy_baton {
+ const apr_array_header_t *copy_pairs;
+ const char *top_dst_path;
+ svn_boolean_t ignore_externals;
+ svn_ra_session_t *ra_session;
+ svn_client_ctx_t *ctx;
+};
+
+/* Implements svn_wc__with_write_lock_func_t. */
+static svn_error_t *
+repos_to_wc_copy_cb(void *baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct repos_to_wc_copy_baton *b = baton;
+
+ SVN_ERR(repos_to_wc_copy_locked(b->copy_pairs, b->top_dst_path,
+ b->ignore_externals, b->ra_session,
+ b->ctx, scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
static svn_error_t *
repos_to_wc_copy(const apr_array_header_t *copy_pairs,
svn_boolean_t make_parents,
@@ -1594,11 +1688,10 @@ repos_to_wc_copy(const apr_array_header_
apr_pool_t *pool)
{
svn_ra_session_t *ra_session;
- svn_wc_adm_access_t *adm_access;
const char *top_src_url, *top_dst_path;
- const char *src_uuid = NULL, *dst_uuid = NULL;
- svn_boolean_t same_repositories;
apr_pool_t *iterpool = svn_pool_create(pool);
+ const char *lock_abspath;
+ struct repos_to_wc_copy_baton baton;
int i;
/* Get the real path for the source, based upon its peg revision. */
@@ -1626,8 +1719,16 @@ repos_to_wc_copy(const apr_array_header_
}
get_copy_pair_ancestors(copy_pairs, &top_src_url, &top_dst_path, NULL, pool);
+ lock_abspath = top_dst_path;
if (copy_pairs->nelts == 1)
- top_src_url = svn_uri_dirname(top_src_url, pool);
+ {
+ svn_node_kind_t kind;
+ top_src_url = svn_uri_dirname(top_src_url, pool);
+ SVN_ERR(svn_wc__node_get_kind(&kind, ctx->wc_ctx, top_dst_path, FALSE,
+ pool));
+ if (kind != svn_node_dir)
+ lock_abspath = svn_dirent_dirname(top_dst_path, pool);
+ }
/* Open a repository session to the longest common src ancestor. We do not
(yet) have a working copy, so we don't have a corresponding path and
@@ -1702,105 +1803,18 @@ repos_to_wc_copy(const apr_array_header_
svn_dirent_local_style(dst_parent, pool));
}
}
+ svn_pool_destroy(iterpool);
- /* Probe the wc at the longest common dst ancestor. */
- SVN_ERR(svn_wc__adm_probe_in_context(&adm_access, ctx->wc_ctx, top_dst_path,
- TRUE, -1, ctx->cancel_func,
- ctx->cancel_baton, pool));
-
- /* We've already checked for physical obstruction by a working file.
- But there could also be logical obstruction by an entry whose
- working file happens to be missing.*/
- for (i = 0; i < copy_pairs->nelts; i++)
- {
- svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
- svn_client__copy_pair_t *);
- const svn_wc_entry_t *ent;
- const char *dst_abspath;
-
- svn_pool_clear(iterpool);
- SVN_ERR(svn_dirent_get_absolute(&dst_abspath, pair->dst, iterpool));
-
- SVN_ERR(svn_wc__maybe_get_entry(&ent, ctx->wc_ctx, dst_abspath,
- svn_node_unknown, TRUE, FALSE,
- iterpool, iterpool));
- if (ent)
- {
- /* TODO(#2843): Rework the error report. Maybe we can simplify the
- condition. Currently, the first is about hidden items and the
- second is for missing items. */
- if (ent->depth == svn_depth_exclude
- || ent->absent)
- {
- return svn_error_createf
- (SVN_ERR_ENTRY_EXISTS,
- NULL, _("'%s' is already under version control"),
- svn_dirent_local_style(pair->dst, pool));
- }
- else if ((ent->kind != svn_node_dir) &&
- (ent->schedule != svn_wc_schedule_delete)
- && ! ent->deleted)
- return svn_error_createf
- (SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
- _("Entry for '%s' exists (though the working file is missing)"),
- svn_dirent_local_style(pair->dst, pool));
- }
- }
-
- /* Decide whether the two repositories are the same or not. */
- {
- svn_error_t *src_err, *dst_err;
- const char *parent;
- const char *parent_abspath;
-
- /* Get the repository uuid of SRC_URL */
- src_err = svn_ra_get_uuid2(ra_session, &src_uuid, pool);
- if (src_err && src_err->apr_err != SVN_ERR_RA_NO_REPOS_UUID)
- return svn_error_return(src_err);
-
- /* Get repository uuid of dst's parent directory, since dst may
- not exist. ### TODO: we should probably walk up the wc here,
- in case the parent dir has an imaginary URL. */
- if (copy_pairs->nelts == 1)
- parent = svn_dirent_dirname(top_dst_path, pool);
- else
- parent = top_dst_path;
-
- SVN_ERR(svn_dirent_get_absolute(&parent_abspath, parent, pool));
- dst_err = svn_client_uuid_from_path2(&dst_uuid, parent_abspath, ctx, pool,
- pool);
- if (dst_err && dst_err->apr_err != SVN_ERR_RA_NO_REPOS_UUID)
- return dst_err;
-
- /* If either of the UUIDs are nonexistent, then at least one of
- the repositories must be very old. Rather than punish the
- user, just assume the repositories are different, so no
- copy-history is attempted. */
- if (src_err || dst_err || (! src_uuid) || (! dst_uuid))
- same_repositories = FALSE;
-
- else
- same_repositories = (strcmp(src_uuid, dst_uuid) == 0);
- }
-
- /* Perform the move for each of the copy_pairs. */
- for (i = 0; i < copy_pairs->nelts; i++)
- {
- /* Check for cancellation */
- if (ctx->cancel_func)
- SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
-
- svn_pool_clear(iterpool);
-
- SVN_ERR(repos_to_wc_copy_single(APR_ARRAY_IDX(copy_pairs, i,
- svn_client__copy_pair_t *),
- same_repositories,
- ignore_externals,
- ra_session, ctx, iterpool));
- }
+ baton.copy_pairs = copy_pairs;
+ baton.top_dst_path = top_dst_path;
+ baton.ignore_externals = ignore_externals;
+ baton.ra_session = ra_session;
+ baton.ctx = ctx;
- svn_pool_destroy(iterpool);
- return svn_error_return(svn_wc_adm_close2(adm_access, pool));
+ SVN_ERR(svn_wc__call_with_write_lock(repos_to_wc_copy_cb, &baton,
+ ctx->wc_ctx, lock_abspath,
+ pool, pool));
+ return SVN_NO_ERROR;
}
#define NEED_REPOS_REVNUM(revision) \
@@ -1832,6 +1846,8 @@ try_copy(svn_commit_info_t **commit_info
srcs_are_urls = svn_path_is_url(APR_ARRAY_IDX(sources, 0,
svn_client_copy_source_t *)->path);
dst_is_url = svn_path_is_url(dst_path_in);
+ if (!dst_is_url)
+ SVN_ERR(svn_dirent_get_absolute(&dst_path_in, dst_path_in, pool));
/* If we have multiple source paths, it implies the dst_path is a
directory we are moving or copying into. Populate the COPY_PAIRS
@@ -1850,7 +1866,10 @@ try_copy(svn_commit_info_t **commit_info
svn_pool_clear(iterpool);
- pair->src = apr_pstrdup(pool, source->path);
+ if (src_is_url)
+ pair->src = apr_pstrdup(pool, source->path);
+ else
+ SVN_ERR(svn_dirent_get_absolute(&pair->src, source->path, pool));
pair->src_op_revision = *source->revision;
pair->src_peg_revision = *source->peg_revision;
@@ -1885,8 +1904,12 @@ try_copy(svn_commit_info_t **commit_info
svn_client__copy_pair_t *pair = apr_palloc(pool, sizeof(*pair));
svn_client_copy_source_t *source =
APR_ARRAY_IDX(sources, 0, svn_client_copy_source_t *);
+ svn_boolean_t src_is_url = svn_path_is_url(source->path);
- pair->src = apr_pstrdup(pool, source->path);
+ if (src_is_url)
+ pair->src = apr_pstrdup(pool, source->path);
+ else
+ SVN_ERR(svn_dirent_get_absolute(&pair->src, source->path, pool));
pair->src_op_revision = *source->revision;
pair->src_peg_revision = *source->peg_revision;
@@ -2104,7 +2127,7 @@ try_copy(svn_commit_info_t **commit_info
/* Public Interfaces */
svn_error_t *
svn_client_copy5(svn_commit_info_t **commit_info_p,
- apr_array_header_t *sources,
+ const apr_array_header_t *sources,
const char *dst_path,
svn_boolean_t copy_as_child,
svn_boolean_t make_parents,
@@ -2180,7 +2203,7 @@ svn_client_copy5(svn_commit_info_t **com
svn_error_t *
svn_client_move5(svn_commit_info_t **commit_info_p,
- apr_array_header_t *src_paths,
+ const apr_array_header_t *src_paths,
const char *dst_path,
svn_boolean_t force,
svn_boolean_t move_as_child,
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/deprecated.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/deprecated.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/deprecated.c Tue Mar 30 20:57:53 2010
@@ -412,7 +412,7 @@ svn_client_commit(svn_client_commit_info
svn_error_t *
svn_client_copy4(svn_commit_info_t **commit_info_p,
- apr_array_header_t *sources,
+ const apr_array_header_t *sources,
const char *dst_path,
svn_boolean_t copy_as_child,
svn_boolean_t make_parents,
@@ -1823,7 +1823,7 @@ svn_client_mergeinfo_log_merged(const ch
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- return svn_client_mergeinfo_log(path_or_url, TRUE, peg_revision,
+ return svn_client_mergeinfo_log(TRUE, path_or_url, peg_revision,
merge_source_path_or_url,
src_peg_revision,
log_receiver, log_receiver_baton,
@@ -1844,7 +1844,7 @@ svn_client_mergeinfo_log_eligible(const
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- return svn_client_mergeinfo_log(path_or_url, FALSE, peg_revision,
+ return svn_client_mergeinfo_log(FALSE, path_or_url, peg_revision,
merge_source_path_or_url,
src_peg_revision,
log_receiver, log_receiver_baton,
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/diff.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/diff.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/diff.c Tue Mar 30 20:57:53 2010
@@ -126,8 +126,8 @@ display_mergeinfo_diff(const char *old_m
for (hi = apr_hash_first(pool, deleted);
hi; hi = apr_hash_next(hi))
{
- const char *from_path = svn_apr_hash_index_key(hi);
- apr_array_header_t *merge_revarray = svn_apr_hash_index_val(hi);
+ const char *from_path = svn__apr_hash_index_key(hi);
+ apr_array_header_t *merge_revarray = svn__apr_hash_index_val(hi);
svn_string_t *merge_revstr;
SVN_ERR(svn_rangelist_to_string(&merge_revstr, merge_revarray, pool));
@@ -141,8 +141,8 @@ display_mergeinfo_diff(const char *old_m
for (hi = apr_hash_first(pool, added);
hi; hi = apr_hash_next(hi))
{
- const char *from_path = svn_apr_hash_index_key(hi);
- apr_array_header_t *merge_revarray = svn_apr_hash_index_val(hi);
+ const char *from_path = svn__apr_hash_index_key(hi);
+ apr_array_header_t *merge_revarray = svn__apr_hash_index_val(hi);
svn_string_t *merge_revstr;
SVN_ERR(svn_rangelist_to_string(&merge_revstr, merge_revarray, pool));
@@ -1281,7 +1281,7 @@ diff_repos_repos(const struct diff_param
Otherwise, we just use "". */
SVN_ERR(svn_client__get_diff_editor
(drr.base_path ? drr.base_path : "",
- ctx->wc_ctx, callbacks, callback_baton, diff_param->depth,
+ NULL, callbacks, callback_baton, diff_param->depth,
FALSE /* doesn't matter for diff */, extra_ra_session, drr.rev1,
NULL /* no notify_func */, NULL /* no notify_baton */,
ctx->cancel_func, ctx->cancel_baton,
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/export.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/export.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/export.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/export.c Tue Mar 30 20:57:53 2010
@@ -128,23 +128,43 @@ copy_one_versioned_file(const char *from
else if (err)
return svn_error_return(err);
- /* Only export 'added' files when the revision is WORKING.
- Otherwise, skip the 'added' files, since they didn't exist
- in the BASE revision and don't have an associated text-base.
-
- Don't export 'deleted' files and directories unless it's a
+ /* Don't export 'deleted' files and directories unless it's a
revision other than WORKING. These files and directories
don't really exist in WORKING. */
- if ((revision->kind != svn_opt_revision_working &&
- entry->schedule == svn_wc_schedule_add) ||
- (revision->kind == svn_opt_revision_working &&
- entry->schedule == svn_wc_schedule_delete))
+ if (revision->kind == svn_opt_revision_working
+ && entry->schedule == svn_wc_schedule_delete)
return SVN_NO_ERROR;
if (revision->kind != svn_opt_revision_working)
{
+ /* Only export 'added' files when the revision is WORKING. This is not
+ WORKING, so skip the 'added' files, since they didn't exist
+ in the BASE revision and don't have an associated text-base.
+
+ 'replaced' files are technically the same as 'added' files.
+ ### TODO: Handle replaced nodes properly.
+ ### svn_opt_revision_base refers to the "new"
+ ### base of the node. That means, if a node is locally
+ ### replaced, export skips this node, as if it was locally
+ ### added, because svn_opt_revision_base refers to the base
+ ### of the added node, not to the node that was deleted.
+ ### In contrast, when the node is copied-here or moved-here,
+ ### the copy/move source's content will be exported.
+ ### It is currently not possible to export the revert-base
+ ### when a node is locally replaced. We need a new
+ ### svn_opt_revision_ enum value for proper distinction
+ ### between revert-base and commit-base.
+
+ Copied-/moved-here nodes have a base, so export both added and
+ replaced files when they involve a copy-/move-here.
+
+ We get all this for free from evaluating SOURCE == NULL:
+ */
SVN_ERR(svn_wc_get_pristine_contents2(&source, wc_ctx, from_abspath,
scratch_pool, scratch_pool));
+ if (source == NULL)
+ return SVN_NO_ERROR;
+
SVN_ERR(svn_wc_get_prop_diffs2(NULL, &props, wc_ctx, from_abspath,
scratch_pool, scratch_pool));
}
@@ -294,15 +314,23 @@ copy_versioned_files(const char *from,
svn_node_unknown, FALSE, FALSE,
pool, pool));
- /* Only export 'added' files when the revision is WORKING.
- Otherwise, skip the 'added' files, since they didn't exist
- in the BASE revision and don't have an associated text-base.
+ /* Only export 'added' and 'replaced' files when the revision is WORKING;
+ when the revision is BASE (i.e. != WORKING), only export 'added' and
+ 'replaced' files when they are part of a copy-/move-here. Otherwise, skip
+ them, since they don't have an associated text-base. This condition for
+ added/replaced simply is an optimization. Added and replaced files would
+ be handled similarly by svn_wc_get_pristine_contents2(), which would
+ return NULL if they have no base associated.
+ TODO: We may prefer not to duplicate this condition and rather use
+ svn_wc_get_pristine_contents2() or a dedicated new function instead.
Don't export 'deleted' files and directories unless it's a
revision other than WORKING. These files and directories
don't really exist in WORKING. */
- if ((revision->kind != svn_opt_revision_working &&
- entry->schedule == svn_wc_schedule_add) ||
+ if ((revision->kind != svn_opt_revision_working
+ && (entry->schedule == svn_wc_schedule_add
+ || entry->schedule == svn_wc_schedule_replace)
+ && !entry->copied) ||
(revision->kind == svn_opt_revision_working &&
entry->schedule == svn_wc_schedule_delete))
return SVN_NO_ERROR;
@@ -960,8 +988,8 @@ svn_client_export5(svn_revnum_t *result_
* with information. */
for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
{
- const char *propname = svn_apr_hash_index_key(hi);
- const svn_string_t *propval = svn_apr_hash_index_val(hi);
+ const char *propname = svn__apr_hash_index_key(hi);
+ const svn_string_t *propval = svn__apr_hash_index_val(hi);
SVN_ERR(change_file_prop(fb, propname, propval, pool));
}
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/externals.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/externals.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/externals.c Tue Mar 30 20:57:53 2010
@@ -400,7 +400,7 @@ switch_file_external(const char *path,
anchor_abspath, subpool);
if (err)
goto cleanup;
-
+
if (text_conflicted || prop_conflicted || tree_conflicted)
return svn_error_createf
(SVN_ERR_WC_FOUND_CONFLICT, 0,
@@ -897,7 +897,7 @@ handle_external_item_change(const void *
svn_error_t *err;
const char *remove_target_abspath;
- svn_boolean_t lock_existed;
+ svn_boolean_t lock_existed;
SVN_ERR(svn_dirent_get_absolute(&remove_target_abspath,
path,
@@ -909,7 +909,7 @@ handle_external_item_change(const void *
if (! lock_existed)
{
SVN_ERR(svn_wc__acquire_write_lock(NULL, ib->ctx->wc_ctx,
- remove_target_abspath,
+ remove_target_abspath,
ib->iter_pool,
ib->iter_pool));
}
@@ -941,7 +941,7 @@ handle_external_item_change(const void *
if (! lock_existed
&& (! err || err->apr_err == SVN_ERR_WC_LEFT_LOCAL_MOD))
{
- svn_error_t *err2 = svn_wc__release_write_lock(ib->ctx->wc_ctx,
+ svn_error_t *err2 = svn_wc__release_write_lock(ib->ctx->wc_ctx,
remove_target_abspath,
ib->iter_pool);
if (err2)
@@ -1163,13 +1163,13 @@ handle_externals_desc_change(const void
ib.pool = cb->pool;
ib.iter_pool = svn_pool_create(cb->pool);
- SVN_ERR(svn_dirent_get_absolute(&abs_parent_dir, ib.parent_dir,
+ SVN_ERR(svn_dirent_get_absolute(&abs_parent_dir, ib.parent_dir,
cb->pool));
- err = svn_wc__node_get_url(&url, cb->ctx->wc_ctx,
+ err = svn_wc__node_get_url(&url, cb->ctx->wc_ctx,
abs_parent_dir, cb->pool, cb->pool);
- /* If we're doing an 'svn export' the current dir will not be a
+ /* If we're doing an 'svn export' the current dir will not be a
working copy. We can't get the parent_dir. */
if (err)
{
@@ -1190,7 +1190,7 @@ handle_externals_desc_change(const void
cb->pool);
svn_error_clear(err);
}
- else
+ else
return svn_error_return(err);
}
else
@@ -1321,8 +1321,8 @@ svn_client__do_external_status(apr_hash_
hi = apr_hash_next(hi))
{
apr_array_header_t *exts;
- const char *path = svn_apr_hash_index_key(hi);
- const char *propval = svn_apr_hash_index_val(hi);
+ const char *path = svn__apr_hash_index_key(hi);
+ const char *propval = svn__apr_hash_index_val(hi);
apr_pool_t *iterpool;
int i;
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/info.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/info.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/info.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/info.c Tue Mar 30 20:57:53 2010
@@ -219,8 +219,8 @@ push_dir_info(svn_ra_session_t *ra_sessi
{
const char *path, *URL, *fs_path;
svn_lock_t *lock;
- const char *name = svn_apr_hash_index_key(hi);
- svn_dirent_t *the_ent = svn_apr_hash_index_val(hi);
+ const char *name = svn__apr_hash_index_key(hi);
+ svn_dirent_t *the_ent = svn__apr_hash_index_val(hi);
svn_pool_clear(subpool);
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/locking_commands.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/locking_commands.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/locking_commands.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/locking_commands.c Tue Mar 30 20:57:53 2010
@@ -362,7 +362,7 @@ fetch_tokens(svn_ra_session_t *ra_sessio
for (hi = apr_hash_first(pool, path_tokens); hi; hi = apr_hash_next(hi))
{
- const char *path = svn_apr_hash_index_key(hi);
+ const char *path = svn__apr_hash_index_key(hi);
svn_lock_t *lock;
svn_pool_clear(iterpool);
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/merge.c?rev=929279&r1=929278&r2=929279&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/merge.c Tue Mar 30 20:57:53 2010
@@ -694,8 +694,8 @@ split_mergeinfo_on_revision(svn_mergeinf
for (hi = apr_hash_first(pool, *mergeinfo); hi; hi = apr_hash_next(hi))
{
int i;
- const char *merge_source_path = svn_apr_hash_index_key(hi);
- apr_array_header_t *rangelist = svn_apr_hash_index_val(hi);
+ const char *merge_source_path = svn__apr_hash_index_key(hi);
+ apr_array_header_t *rangelist = svn__apr_hash_index_val(hi);
svn_pool_clear(iterpool);
@@ -903,8 +903,8 @@ filter_self_referential_mergeinfo(apr_ar
hi; hi = apr_hash_next(hi))
{
int j;
- const char *source_path = svn_apr_hash_index_key(hi);
- apr_array_header_t *rangelist = svn_apr_hash_index_val(hi);
+ const char *source_path = svn__apr_hash_index_key(hi);
+ apr_array_header_t *rangelist = svn__apr_hash_index_val(hi);
const char *merge_source_url;
apr_array_header_t *adjusted_rangelist =
apr_array_make(pool, 0, sizeof(svn_merge_range_t *));
@@ -1422,9 +1422,8 @@ merge_file_changed(const char *local_dir
return SVN_NO_ERROR;
}
}
- else
- if (prop_state)
- *prop_state = svn_wc_notify_state_unchanged;
+ else if (prop_state)
+ *prop_state = svn_wc_notify_state_unchanged;
/* Easy out: We are only applying mergeinfo differences. */
if (merge_b->record_only)
@@ -2561,7 +2560,7 @@ typedef struct
order of path. Nearest ancestor's index from
CHILDREN_WITH_MERGEINFO is returned. */
static int
-find_nearest_ancestor(apr_array_header_t *children_with_mergeinfo,
+find_nearest_ancestor(const apr_array_header_t *children_with_mergeinfo,
svn_boolean_t path_is_own_ancestor,
const char *path)
{
@@ -3723,7 +3722,7 @@ calculate_remaining_ranges(svn_client__m
const char *url2,
svn_revnum_t revision2,
svn_mergeinfo_t target_mergeinfo,
- apr_array_header_t *implicit_src_gap,
+ const apr_array_header_t *implicit_src_gap,
svn_boolean_t child_inherits_implicit,
svn_ra_session_t *ra_session,
svn_client_ctx_t *ctx,
@@ -3960,7 +3959,7 @@ find_gaps_in_merge_source_history(svn_re
hi;
hi = apr_hash_next(hi))
{
- apr_array_header_t *value = svn_apr_hash_index_val(hi);
+ apr_array_header_t *value = svn__apr_hash_index_val(hi);
SVN_ERR(svn_rangelist_merge(&implicit_rangelist, value,
scratch_pool));
@@ -4290,8 +4289,8 @@ update_wc_mergeinfo(const char *target_a
the WC with its on-disk mergeinfo. */
for (hi = apr_hash_first(scratch_pool, merges); hi; hi = apr_hash_next(hi))
{
- const char *local_abspath = svn_apr_hash_index_key(hi);
- apr_array_header_t *ranges = svn_apr_hash_index_val(hi);
+ const char *local_abspath = svn__apr_hash_index_key(hi);
+ apr_array_header_t *ranges = svn__apr_hash_index_val(hi);
apr_array_header_t *rangelist;
svn_error_t *err;
const char *local_abspath_rel_to_target;
@@ -4410,7 +4409,7 @@ update_wc_mergeinfo(const char *target_a
MERGEINFO_PATH to MERGE_B->TARGET_ABSPATH. */
static svn_error_t *
record_skips(const char *mergeinfo_path,
- apr_array_header_t *rangelist,
+ const apr_array_header_t *rangelist,
svn_boolean_t is_rollback,
notification_receiver_baton_t *notify_b,
merge_cmd_baton_t *merge_b,
@@ -4430,7 +4429,7 @@ record_skips(const char *mergeinfo_path,
for (hi = apr_hash_first(pool, notify_b->skipped_abspaths); hi;
hi = apr_hash_next(hi))
{
- const char *skipped_abspath = svn_apr_hash_index_key(hi);
+ const char *skipped_abspath = svn__apr_hash_index_key(hi);
svn_wc_status2_t *status;
/* Before we override, make sure this is a versioned path, it
@@ -4647,7 +4646,7 @@ drive_merge_report_editor(const char *ta
svn_revnum_t revision1,
const char *url2,
svn_revnum_t revision2,
- apr_array_header_t *children_with_mergeinfo,
+ const apr_array_header_t *children_with_mergeinfo,
svn_depth_t depth,
notification_receiver_baton_t *notify_b,
const svn_wc_diff_callbacks4_t *callbacks,
@@ -4866,7 +4865,7 @@ drive_merge_report_editor(const char *ta
If none of CHILDREN_WITH_MERGEINFO's elements have any remaining ranges
return SVN_INVALID_REVNUM. */
static svn_revnum_t
-get_most_inclusive_start_rev(apr_array_header_t *children_with_mergeinfo,
+get_most_inclusive_start_rev(const apr_array_header_t *children_with_mergeinfo,
svn_boolean_t is_rollback)
{
int i;
@@ -4903,7 +4902,7 @@ get_most_inclusive_start_rev(apr_array_h
If none of CHILDREN_WITH_MERGEINFO's elements have any remaining ranges
return SVN_INVALID_REVNUM. */
static svn_revnum_t
-get_most_inclusive_end_rev(apr_array_header_t *children_with_mergeinfo,
+get_most_inclusive_end_rev(const apr_array_header_t *children_with_mergeinfo,
svn_boolean_t is_rollback)
{
int i;
@@ -5676,7 +5675,7 @@ log_changed_revs(void *baton,
static svn_error_t *
remove_noop_merge_ranges(apr_array_header_t **operative_ranges_p,
svn_ra_session_t *ra_session,
- apr_array_header_t *ranges,
+ const apr_array_header_t *ranges,
apr_pool_t *pool)
{
int i;
@@ -5787,7 +5786,7 @@ compare_merge_source_ts(const void *a,
static svn_error_t *
combine_range_with_segments(apr_array_header_t **merge_source_ts_p,
svn_merge_range_t *range,
- apr_array_header_t *segments,
+ const apr_array_header_t *segments,
const char *source_root_url,
apr_pool_t *pool)
{
@@ -6629,7 +6628,7 @@ process_children_with_new_mergeinfo(merg
hi;
hi = apr_hash_next(hi))
{
- const char *abspath_with_new_mergeinfo = svn_apr_hash_index_key(hi);
+ const char *abspath_with_new_mergeinfo = svn__apr_hash_index_key(hi);
const char *old_session_url = NULL;
const char *path_url;
svn_mergeinfo_t path_inherited_mergeinfo;
@@ -6750,7 +6749,7 @@ path_is_subtree(const char *local_abspat
hi;
hi = apr_hash_next(hi))
{
- const char *path_touched_by_merge = svn_apr_hash_index_key(hi);
+ const char *path_touched_by_merge = svn__apr_hash_index_key(hi);
if (svn_dirent_is_ancestor(local_abspath, path_touched_by_merge))
return TRUE;
}
@@ -7098,7 +7097,7 @@ record_mergeinfo_for_added_subtrees(
for (hi = apr_hash_first(pool, notify_b->added_abspaths); hi;
hi = apr_hash_next(hi))
{
- const char *added_abspath = svn_apr_hash_index_key(hi);
+ const char *added_abspath = svn__apr_hash_index_key(hi);
const char *dir_abspath;
svn_mergeinfo_t parent_mergeinfo;
svn_boolean_t inherited; /* used multiple times, but ignored */
@@ -7240,7 +7239,7 @@ log_noop_revs(void *baton,
hi;
hi = apr_hash_next(hi))
{
- const char *path = svn_apr_hash_index_key(hi);
+ const char *path = svn__apr_hash_index_key(hi);
const char *rel_path;
const char *cwmi_path;
apr_array_header_t *paths_explicit_rangelist = NULL;
@@ -7916,7 +7915,7 @@ ensure_ra_session_url(svn_ra_session_t *
*/
static svn_error_t *
do_merge(apr_hash_t **modified_subtrees,
- apr_array_header_t *merge_sources,
+ const apr_array_header_t *merge_sources,
const char *target_abspath,
svn_boolean_t sources_ancestral,
svn_boolean_t sources_related,
@@ -8647,7 +8646,7 @@ mergeinfo_in_catalog(svn_boolean_t *in_c
scratch_pool, scratch_pool));
SVN_ERR(svn_mergeinfo__equals(in_catalog, mergeinfo_in_cat,
mergeinfo, TRUE, scratch_pool));
- }
+ }
}
return SVN_NO_ERROR;
@@ -8690,7 +8689,7 @@ log_find_operative_revs(void *baton,
hi = apr_hash_next(hi))
{
const char *subtree_missing_this_rev;
- const char *path = svn_apr_hash_index_key(hi);
+ const char *path = svn__apr_hash_index_key(hi);
const char *rel_path;
const char *source_rel_path;
svn_boolean_t in_catalog;
@@ -8699,7 +8698,7 @@ log_find_operative_revs(void *baton,
/* Easy out: The path is not within the tree of interest. */
if (!svn_uri_is_ancestor(log_baton->target_abspath, path))
continue;
-
+
rel_path = svn_uri_skip_ancestor(log_baton->target_abspath, path);
source_rel_path = svn_relpath_join(log_baton->source_repos_rel_path,
rel_path, pool);
@@ -8751,7 +8750,7 @@ log_find_operative_revs(void *baton,
{
SVN_ERR(svn_mergeinfo_merge(unmerged_for_key,
log_entry_as_mergeinfo,
- log_baton->result_pool));
+ log_baton->result_pool));
}
else
{
@@ -8781,7 +8780,7 @@ log_find_operative_revs(void *baton,
Using RA_SESSION, which is pointed at the repository root, check that all
of the unmerged revisions in UNMERGED_CATALOG's mergeinfos are "phantoms",
that is, one of the following conditions holds:
-
+
1) The revision effects no corresponding paths in SOURCE_REPOS_REL_PATH.
2) The revision effects corresponding paths in SOURCE_REPOS_REL_PATH,
@@ -8819,7 +8818,7 @@ find_unsynced_ranges(const char *source_
hi_catalog;
hi_catalog = apr_hash_next(hi_catalog))
{
- svn_mergeinfo_t mergeinfo = svn_apr_hash_index_val(hi_catalog);
+ svn_mergeinfo_t mergeinfo = svn__apr_hash_index_val(hi_catalog);
apr_hash_index_t *hi_mergeinfo;
for (hi_mergeinfo = apr_hash_first(scratch_pool, mergeinfo);
@@ -8827,12 +8826,12 @@ find_unsynced_ranges(const char *source_
hi_mergeinfo = apr_hash_next(hi_mergeinfo))
{
apr_array_header_t *rangelist =
- svn_apr_hash_index_val(hi_mergeinfo);
-
+ svn__apr_hash_index_val(hi_mergeinfo);
+
SVN_ERR(svn_rangelist_merge(&potentially_unmerged_ranges,
rangelist, scratch_pool));
- }
- }
+ }
+ }
}
/* Find any unmerged revisions which both effect the source and
@@ -8950,8 +8949,8 @@ find_unmerged_mergeinfo(svn_mergeinfo_ca
hi;
hi = apr_hash_next(hi))
{
- const char *path = svn_apr_hash_index_key(hi);
- apr_array_header_t *segments = svn_apr_hash_index_val(hi);
+ const char *path = svn__apr_hash_index_key(hi);
+ apr_array_header_t *segments = svn__apr_hash_index_val(hi);
const char *source_path;
svn_mergeinfo_t source_mergeinfo, filtered_mergeinfo;
@@ -9097,8 +9096,8 @@ find_unmerged_mergeinfo(svn_mergeinfo_ca
hi;
hi = apr_hash_next(hi))
{
- const char *source_path = svn_apr_hash_index_key(hi);
- svn_mergeinfo_t source_mergeinfo = svn_apr_hash_index_val(hi);
+ const char *source_path = svn__apr_hash_index_key(hi);
+ svn_mergeinfo_t source_mergeinfo = svn__apr_hash_index_val(hi);
svn_mergeinfo_t filtered_mergeinfo;
const char *target_path;
apr_array_header_t *segments;
@@ -9276,7 +9275,7 @@ calculate_left_hand_side(const char **ur
hi;
hi = apr_hash_next(hi))
{
- const char *path = svn_apr_hash_index_key(hi);
+ const char *path = svn__apr_hash_index_key(hi);
SVN_ERR(svn_client__repos_location_segments(&segments,
ra_session,