You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/08/11 18:43:31 UTC
svn commit: r984468 [5/25] - in /subversion/branches/ignore-mergeinfo: ./
build/ build/generator/ build/generator/templates/ notes/
notes/tree-conflicts/ notes/wc-ng/ subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversi...
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_client/diff.c?rev=984468&r1=984467&r2=984468&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_client/diff.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_client/diff.c Wed Aug 11 16:43:22 2010
@@ -190,6 +190,118 @@ maybe_append_eol(const svn_string_t *tok
}
}
+/* Adjust PATH, ORIG_PATH_1 and ORIG_PATH_2, representing the changed file
+ * and the two original targets passed to the diff command, to handle the
+ * case when we're dealing with different anchors. RELATIVE_TO_DIR is the
+ * directory the diff target should be considered relative to. All
+ * allocations are done in POOL. */
+static svn_error_t *
+adjust_paths_for_diff_labels(const char **path,
+ const char **orig_path_1,
+ const char **orig_path_2,
+ const char *relative_to_dir,
+ apr_pool_t *pool)
+{
+ apr_size_t len;
+ const char *new_path = *path;
+ const char *new_path1 = *orig_path_1;
+ const char *new_path2 = *orig_path_2;
+
+ /* ### Holy cow. Due to anchor/target weirdness, we can't
+ simply join diff_cmd_baton->orig_path_1 with path, ditto for
+ orig_path_2. That will work when they're directory URLs, but
+ not for file URLs. Nor can we just use anchor1 and anchor2
+ from do_diff(), at least not without some more logic here.
+ What a nightmare.
+
+ For now, to distinguish the two paths, we'll just put the
+ unique portions of the original targets in parentheses after
+ the received path, with ellipses for handwaving. This makes
+ the labels a bit clumsy, but at least distinctive. Better
+ solutions are possible, they'll just take more thought. */
+
+ len = strlen(svn_dirent_get_longest_ancestor(new_path1, new_path2, pool));
+ new_path1 = new_path1 + len;
+ new_path2 = new_path2 + len;
+
+ /* ### Should diff labels print paths in local style? Is there
+ already a standard for this? In any case, this code depends on
+ a particular style, so not calling svn_dirent_local_style() on the
+ paths below.*/
+ if (new_path1[0] == '\0')
+ new_path1 = apr_psprintf(pool, "%s", new_path);
+ else if (new_path1[0] == '/')
+ new_path1 = apr_psprintf(pool, "%s\t(...%s)", new_path, new_path1);
+ else
+ new_path1 = apr_psprintf(pool, "%s\t(.../%s)", new_path, new_path1);
+
+ if (new_path2[0] == '\0')
+ new_path2 = apr_psprintf(pool, "%s", new_path);
+ else if (new_path2[0] == '/')
+ new_path2 = apr_psprintf(pool, "%s\t(...%s)", new_path, new_path2);
+ else
+ new_path2 = apr_psprintf(pool, "%s\t(.../%s)", new_path, new_path2);
+
+ if (relative_to_dir)
+ {
+ /* Possibly adjust the paths shown in the output (see issue #2723). */
+ const char *child_path = svn_dirent_is_child(relative_to_dir, new_path,
+ pool);
+
+ if (child_path)
+ new_path = child_path;
+ else if (!svn_path_compare_paths(relative_to_dir, new_path))
+ new_path = ".";
+ else
+ return MAKE_ERR_BAD_RELATIVE_PATH(new_path, relative_to_dir);
+
+ child_path = svn_dirent_is_child(relative_to_dir, new_path1, pool);
+
+ if (child_path)
+ new_path1 = child_path;
+ else if (!svn_path_compare_paths(relative_to_dir, new_path1))
+ new_path1 = ".";
+ else
+ return MAKE_ERR_BAD_RELATIVE_PATH(new_path1, relative_to_dir);
+
+ child_path = svn_dirent_is_child(relative_to_dir, new_path2, pool);
+
+ if (child_path)
+ new_path2 = child_path;
+ else if (!svn_path_compare_paths(relative_to_dir, new_path2))
+ new_path2 = ".";
+ else
+ return MAKE_ERR_BAD_RELATIVE_PATH(new_path2, relative_to_dir);
+ }
+ *path = new_path;
+ *orig_path_1 = new_path1;
+ *orig_path_2 = new_path2;
+
+ return SVN_NO_ERROR;
+}
+
+
+/* Generate a label for the diff output for file PATH at revision REVNUM.
+ If REVNUM is invalid then it is assumed to be the current working
+ copy. Assumes the paths are already in the desired style (local
+ vs internal). Allocate the label in POOL. */
+static const char *
+diff_label(const char *path,
+ svn_revnum_t revnum,
+ apr_pool_t *pool)
+{
+ const char *label;
+ if (revnum != SVN_INVALID_REVNUM)
+ label = apr_psprintf(pool, _("%s\t(revision %ld)"), path, revnum);
+ else
+ label = apr_psprintf(pool, _("%s\t(working copy)"), path);
+
+ return label;
+}
+
+
+
+
/* A helper func that writes out verbal descriptions of property diffs
to FILE. Of course, the apr_file_t will probably be the 'outfile'
passed to svn_client_diff5, which is probably stdout. */
@@ -197,28 +309,61 @@ static svn_error_t *
display_prop_diffs(const apr_array_header_t *propchanges,
apr_hash_t *original_props,
const char *path,
+ const char *orig_path1,
+ const char *orig_path2,
+ svn_revnum_t rev1,
+ svn_revnum_t rev2,
const char *encoding,
apr_file_t *file,
const char *relative_to_dir,
+ svn_boolean_t show_diff_header,
apr_hash_t *ignored_props,
apr_pool_t *pool)
{
int i;
svn_boolean_t header_printed = FALSE;
- if (relative_to_dir)
- {
- /* Possibly adjust the path shown in the output (see issue #2723). */
- const char *child_path = svn_dirent_is_child(relative_to_dir, path,
- pool);
+ /* If we're creating a diff on the wc root, path would be empty. */
+ if (path[0] == '\0')
+ path = apr_psprintf(pool, ".");
- if (child_path)
- path = child_path;
- else if (!svn_path_compare_paths(relative_to_dir, path))
- path = ".";
- else
- return MAKE_ERR_BAD_RELATIVE_PATH(path, relative_to_dir);
- }
+ if (show_diff_header)
+ {
+ const char *path1 = orig_path1;
+ const char *path2 = orig_path2;
+ const char *label1;
+ const char *label2;
+
+ SVN_ERR(adjust_paths_for_diff_labels(&path, &path1, &path2,
+ relative_to_dir, pool));
+
+ label1 = diff_label(path1, rev1, pool);
+ label2 = diff_label(path2, rev2, pool);
+
+ /* ### Should we show the paths in platform specific format,
+ * ### diff_content_changed() does not! */
+
+ SVN_ERR(file_printf_from_utf8 (file, encoding,
+ "Index: %s" APR_EOL_STR
+ "%s" APR_EOL_STR,
+ path,
+ equal_string));
+
+ SVN_ERR(file_printf_from_utf8(file, encoding,
+ "--- %s" APR_EOL_STR
+ "+++ %s" APR_EOL_STR,
+ label1,
+ label2));
+ }
+
+ SVN_ERR(file_printf_from_utf8(file, encoding,
+ _("%sProperty changes on: %s%s"),
+ APR_EOL_STR,
+ path,
+ APR_EOL_STR));
+
+ SVN_ERR(file_printf_from_utf8(file, encoding, "%s" APR_EOL_STR,
+ under_string));
for (i = 0; i < propchanges->nelts; i++)
{
@@ -470,25 +615,13 @@ struct diff_cmd_baton {
svn_boolean_t use_git_diff_format;
svn_wc_context_t *wc_ctx;
-};
-/* Generate a label for the diff output for file PATH at revision REVNUM.
- If REVNUM is invalid then it is assumed to be the current working
- copy. Assumes the paths are already in the desired style (local
- vs internal). Allocate the label in POOL. */
-static const char *
-diff_label(const char *path,
- svn_revnum_t revnum,
- apr_pool_t *pool)
-{
- const char *label;
- if (revnum != SVN_INVALID_REVNUM)
- label = apr_psprintf(pool, _("%s\t(revision %ld)"), path, revnum);
- else
- label = apr_psprintf(pool, _("%s\t(working copy)"), path);
+ /* A hashtable using the visited paths as keys.
+ * ### This is needed for us to know if we need to print a diff header for
+ * ### a path that has property changes. */
+ apr_hash_t *visited_paths;
+};
- return label;
-}
/* An svn_wc_diff_callbacks4_t function. Used for both file and directory
property diffs. */
@@ -504,17 +637,39 @@ diff_props_changed(const char *local_dir
{
struct diff_cmd_baton *diff_cmd_baton = diff_baton;
apr_array_header_t *props;
+ svn_boolean_t show_diff_header;
apr_pool_t *subpool = svn_pool_create(diff_cmd_baton->pool);
SVN_ERR(svn_categorize_props(propchanges, NULL, NULL, &props, subpool));
+ if (apr_hash_get(diff_cmd_baton->visited_paths, path, APR_HASH_KEY_STRING))
+ show_diff_header = FALSE;
+ else
+ show_diff_header = TRUE;
+
if (props->nelts > 0)
- SVN_ERR(display_prop_diffs(props, original_props, path,
- diff_cmd_baton->header_encoding,
- diff_cmd_baton->outfile,
- diff_cmd_baton->relative_to_dir,
- diff_cmd_baton->ignored_props,
- subpool));
+ {
+ /* We're using the revnums from the diff_cmd_baton since there's
+ * no revision argument to the svn_wc_diff_callback_t
+ * dir_props_changed(). */
+ SVN_ERR(display_prop_diffs(props, original_props, path,
+ diff_cmd_baton->orig_path_1,
+ diff_cmd_baton->orig_path_2,
+ diff_cmd_baton->revnum1,
+ diff_cmd_baton->revnum2,
+ diff_cmd_baton->header_encoding,
+ diff_cmd_baton->outfile,
+ diff_cmd_baton->relative_to_dir,
+ show_diff_header,
+ diff_cmd_baton->ignored_props,
+ subpool));
+
+ /* We've printed the diff header so now we can mark the path as
+ * visited. */
+ if (show_diff_header)
+ apr_hash_set(diff_cmd_baton->visited_paths, path,
+ APR_HASH_KEY_STRING, path);
+ }
if (state)
*state = svn_wc_notify_state_unknown;
@@ -550,80 +705,17 @@ diff_content_changed(const char *path,
const char *label1, *label2;
svn_boolean_t mt1_binary = FALSE, mt2_binary = FALSE;
const char *path1, *path2;
- apr_size_t len;
/* Get a stream from our output file. */
os = svn_stream_from_aprfile2(diff_cmd_baton->outfile, TRUE, subpool);
/* Generate the diff headers. */
- /* ### Holy cow. Due to anchor/target weirdness, we can't
- simply join diff_cmd_baton->orig_path_1 with path, ditto for
- orig_path_2. That will work when they're directory URLs, but
- not for file URLs. Nor can we just use anchor1 and anchor2
- from do_diff(), at least not without some more logic here.
- What a nightmare.
-
- For now, to distinguish the two paths, we'll just put the
- unique portions of the original targets in parentheses after
- the received path, with ellipses for handwaving. This makes
- the labels a bit clumsy, but at least distinctive. Better
- solutions are possible, they'll just take more thought. */
-
path1 = diff_cmd_baton->orig_path_1;
path2 = diff_cmd_baton->orig_path_2;
- len = strlen(svn_dirent_get_longest_ancestor(path1, path2, subpool));
- path1 = path1 + len;
- path2 = path2 + len;
-
- /* ### Should diff labels print paths in local style? Is there
- already a standard for this? In any case, this code depends on
- a particular style, so not calling svn_dirent_local_style() on the
- paths below.*/
- if (path1[0] == '\0')
- path1 = apr_psprintf(subpool, "%s", path);
- else if (path1[0] == '/')
- path1 = apr_psprintf(subpool, "%s\t(...%s)", path, path1);
- else
- path1 = apr_psprintf(subpool, "%s\t(.../%s)", path, path1);
- if (path2[0] == '\0')
- path2 = apr_psprintf(subpool, "%s", path);
- else if (path2[0] == '/')
- path2 = apr_psprintf(subpool, "%s\t(...%s)", path, path2);
- else
- path2 = apr_psprintf(subpool, "%s\t(.../%s)", path, path2);
-
- if (diff_cmd_baton->relative_to_dir)
- {
- /* Possibly adjust the paths shown in the output (see issue #2723). */
- const char *child_path = svn_dirent_is_child(rel_to_dir, path, subpool);
-
- if (child_path)
- path = child_path;
- else if (!svn_path_compare_paths(rel_to_dir, path))
- path = ".";
- else
- return MAKE_ERR_BAD_RELATIVE_PATH(path, rel_to_dir);
-
- child_path = svn_dirent_is_child(rel_to_dir, path1, subpool);
-
- if (child_path)
- path1 = child_path;
- else if (!svn_path_compare_paths(rel_to_dir, path1))
- path1 = ".";
- else
- return MAKE_ERR_BAD_RELATIVE_PATH(path1, rel_to_dir);
-
- child_path = svn_dirent_is_child(rel_to_dir, path2, subpool);
-
- if (child_path)
- path2 = child_path;
- else if (!svn_path_compare_paths(rel_to_dir, path2))
- path2 = ".";
- else
- return MAKE_ERR_BAD_RELATIVE_PATH(path2, rel_to_dir);
- }
+ SVN_ERR(adjust_paths_for_diff_labels(&path, &path1, &path2,
+ rel_to_dir, subpool));
label1 = diff_label(path1, rev1, subpool);
label2 = diff_label(path2, rev2, subpool);
@@ -786,6 +878,11 @@ diff_content_changed(const char *path,
diff_cmd_baton->header_encoding, rel_to_dir,
diff_cmd_baton->options.for_internal->show_c_function,
subpool));
+
+ /* We have a printed a diff for this path, mark it as visited. */
+ apr_hash_set(diff_cmd_baton->visited_paths, path,
+ APR_HASH_KEY_STRING, path);
+
}
}
@@ -1305,7 +1402,7 @@ diff_prepare_repos_repos(const struct di
if (strcmp(drr->url2, params->path2) != 0)
drr->base_path = params->path2;
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session, drr->url2,
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, drr->url2,
NULL, NULL, FALSE,
TRUE, ctx, pool));
@@ -1342,7 +1439,7 @@ diff_prepare_repos_repos(const struct di
/* Do the same for the first target. */
SVN_ERR(svn_ra_reparent(ra_session, drr->url1, pool));
SVN_ERR(svn_client__get_revision_number(&drr->rev1, NULL, ctx->wc_ctx,
- (params->path1 == drr->url1) ? NULL : params_path1_abspath,
+ (strcmp(params->path1, drr->url1) == 0) ? NULL : params_path1_abspath,
ra_session, params->revision1, pool));
SVN_ERR(svn_ra_check_path(ra_session, "", drr->rev1, &kind1, pool));
if (kind1 == svn_node_none)
@@ -1523,9 +1620,9 @@ diff_repos_repos(const struct diff_param
/* Now, we open an extra RA session to the correct anchor
location for URL1. This is used during the editor calls to fetch file
contents. */
- SVN_ERR(svn_client__open_ra_session_internal(&extra_ra_session, drr.anchor1,
- NULL, NULL, FALSE, TRUE, ctx,
- pool));
+ SVN_ERR(svn_client__open_ra_session_internal(&extra_ra_session, NULL,
+ drr.anchor1, NULL, NULL, FALSE,
+ TRUE, ctx, pool));
/* Set up the repos_diff editor on BASE_PATH, if available.
Otherwise, we just use "". */
@@ -1645,7 +1742,7 @@ diff_repos_wc(const char *path1,
}
/* Establish RA session to path2's anchor */
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session, anchor_url,
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, anchor_url,
NULL, NULL, FALSE, TRUE,
ctx, pool));
@@ -1665,7 +1762,7 @@ diff_repos_wc(const char *path1,
/* Tell the RA layer we want a delta to change our txn to URL1 */
SVN_ERR(svn_client__get_revision_number(&rev, NULL, ctx->wc_ctx,
- (path1 == url1) ? NULL : abspath1,
+ (strcmp(path1, url1) == 0) ? NULL : abspath1,
ra_session, revision1, pool));
if (!reverse)
@@ -1781,9 +1878,9 @@ diff_summarize_repos_repos(const struct
/* Now, we open an extra RA session to the correct anchor
location for URL1. This is used to get the kind of deleted paths. */
- SVN_ERR(svn_client__open_ra_session_internal(&extra_ra_session, drr.anchor1,
- NULL, NULL, FALSE, TRUE,
- ctx, pool));
+ SVN_ERR(svn_client__open_ra_session_internal(&extra_ra_session, NULL,
+ drr.anchor1, NULL, NULL, FALSE,
+ TRUE, ctx, pool));
/* Set up the repos_diff editor. */
SVN_ERR(svn_client__get_diff_summarize_editor
@@ -1999,6 +2096,7 @@ svn_client_diff5(const apr_array_header_
diff_cmd_baton.relative_to_dir = relative_to_dir;
diff_cmd_baton.use_git_diff_format = use_git_diff_format;
diff_cmd_baton.wc_ctx = ctx->wc_ctx;
+ diff_cmd_baton.visited_paths = apr_hash_make(pool);
if (ignore_mergeinfo)
{
@@ -2078,6 +2176,7 @@ svn_client_diff_peg5(const apr_array_hea
diff_cmd_baton.relative_to_dir = relative_to_dir;
diff_cmd_baton.use_git_diff_format = use_git_diff_format;
diff_cmd_baton.wc_ctx = ctx->wc_ctx;
+ diff_cmd_baton.visited_paths = apr_hash_make(pool);
if (ignore_mergeinfo)
{
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_client/export.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_client/export.c?rev=984468&r1=984467&r2=984468&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_client/export.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_client/export.c Wed Aug 11 16:43:22 2010
@@ -349,21 +349,26 @@ copy_versioned_files(const char *from,
if (from_kind == svn_node_dir)
{
+ apr_fileperms_t perm = APR_OS_DEFAULT;
+
/* Try to make the new directory. If this fails because the
directory already exists, check our FORCE flag to see if we
care. */
- /* Skip retrieving the umask on windows. Apr does not implement setting
+ /* Keep the source directory's permissions if applicable.
+ Skip retrieving the umask on windows. Apr does not implement setting
filesystem privileges on Windows.
Retrieving the file permissions with APR_FINFO_PROT | APR_FINFO_OWNER
is documented to be 'incredibly expensive' */
-#ifdef WIN32
- err = svn_io_dir_make(to, APR_OS_DEFAULT, pool);
-#else
- apr_finfo_t finfo;
- SVN_ERR(svn_io_stat(&finfo, from, APR_FINFO_PROT, pool));
- err = svn_io_dir_make(to, finfo.protection, pool);
+#ifndef WIN32
+ if (revision->kind == svn_opt_revision_working)
+ {
+ apr_finfo_t finfo;
+ SVN_ERR(svn_io_stat(&finfo, from, APR_FINFO_PROT, pool));
+ perm = finfo.protection;
+ }
#endif
+ err = svn_io_dir_make(to, perm, pool);
if (err)
{
if (! APR_STATUS_IS_EEXIST(err->apr_err))
@@ -937,6 +942,11 @@ svn_client_export5(svn_revnum_t *result_
SVN_ERR_ASSERT(peg_revision != NULL);
SVN_ERR_ASSERT(revision != NULL);
+ if (svn_path_is_url(to))
+ return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"),
+ to));
+
peg_revision = svn_cl__rev_default_to_head_or_working(peg_revision, from);
revision = svn_cl__rev_default_to_peg(revision, peg_revision);
@@ -1083,7 +1093,8 @@ svn_client_export5(svn_revnum_t *result_
SVN_ERR(svn_client__fetch_externals(eb->externals,
from, to_abspath,
repos_root_url, depth, TRUE,
- &use_sleep, ctx, pool));
+ native_eol, &use_sleep,
+ ctx, pool));
}
}
else if (kind == svn_node_none)
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_client/externals.c?rev=984468&r1=984467&r2=984468&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_client/externals.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_client/externals.c Wed Aug 11 16:43:22 2010
@@ -62,6 +62,9 @@ struct handle_external_item_change_baton
/* Passed through to svn_client_* functions. */
svn_client_ctx_t *ctx;
+ /* Passed to svn_client_exportX() */
+ const char *native_eol;
+
svn_boolean_t *timestamp_sleep;
svn_boolean_t is_export;
@@ -221,8 +224,8 @@ switch_dir_external(const char *path,
/* Get the repos root of the new URL. */
SVN_ERR(svn_client__open_ra_session_internal
- (&ra_session, url, NULL, NULL, FALSE, TRUE,
- ctx, subpool));
+ (&ra_session, NULL, url, NULL, NULL,
+ FALSE, TRUE, ctx, subpool));
SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root,
subpool));
@@ -274,9 +277,10 @@ switch_dir_external(const char *path,
baton.cancel_baton = ctx->cancel_baton;
/* Buh-bye, old and busted ... */
- SVN_ERR(svn_wc__call_with_write_lock(relegate_dir_external, &baton,
- ctx->wc_ctx, local_abspath,
- pool, pool));
+ SVN_ERR(svn_wc__acquire_write_lock(NULL, ctx->wc_ctx, local_abspath,
+ FALSE, pool, pool));
+
+ SVN_ERR(relegate_dir_external(&baton, pool, pool));
}
else
{
@@ -362,7 +366,7 @@ switch_file_external(const char *path,
url, dest_wc_repos_root_url);
SVN_ERR(svn_wc__acquire_write_lock(NULL, ctx->wc_ctx, anchor_abspath,
- subpool, subpool));
+ FALSE, subpool, subpool));
}
err = svn_wc_read_kind(&kind, ctx->wc_ctx, local_abspath, FALSE, subpool);
@@ -854,7 +858,8 @@ handle_external_item_change(const void *
SVN_ERR(svn_client_export4(NULL, new_item->url, local_abspath,
&(new_item->peg_revision),
&(new_item->revision),
- TRUE, FALSE, svn_depth_infinity, NULL,
+ TRUE, FALSE, svn_depth_infinity,
+ ib->native_eol,
ib->ctx, ib->iter_pool));
else
SVN_ERR(svn_client__checkout_internal
@@ -872,7 +877,8 @@ handle_external_item_change(const void *
SVN_ERR(svn_client_export4(NULL, new_item->url, local_abspath,
&(new_item->peg_revision),
&(new_item->revision),
- FALSE, TRUE, svn_depth_infinity, NULL,
+ FALSE, TRUE, svn_depth_infinity,
+ ib->native_eol,
ib->ctx, ib->iter_pool));
else
SVN_ERR(switch_file_external(local_abspath,
@@ -909,7 +915,7 @@ handle_external_item_change(const void *
if (! lock_existed)
{
SVN_ERR(svn_wc__acquire_write_lock(NULL, ib->ctx->wc_ctx,
- local_abspath,
+ local_abspath, FALSE,
ib->iter_pool,
ib->iter_pool));
}
@@ -1067,6 +1073,9 @@ struct handle_externals_desc_change_bato
svn_boolean_t *timestamp_sleep;
svn_boolean_t is_export;
+ /* Passed to svn_client_exportX() */
+ const char *native_eol;
+
apr_pool_t *pool;
};
@@ -1157,6 +1166,7 @@ handle_externals_desc_change(const void
ib.repos_root_url = cb->repos_root_url;
ib.ctx = cb->ctx;
ib.is_export = cb->is_export;
+ ib.native_eol = cb->native_eol;
ib.timestamp_sleep = cb->timestamp_sleep;
ib.pool = cb->pool;
ib.iter_pool = svn_pool_create(cb->pool);
@@ -1261,6 +1271,7 @@ svn_client__handle_externals(apr_hash_t
cb.ctx = ctx;
cb.timestamp_sleep = timestamp_sleep;
cb.is_export = FALSE;
+ cb.native_eol = NULL;
cb.pool = pool;
return svn_hash_diff(cb.externals_old, cb.externals_new,
@@ -1275,6 +1286,7 @@ svn_client__fetch_externals(apr_hash_t *
const char *repos_root_url,
svn_depth_t requested_depth,
svn_boolean_t is_export,
+ const char *native_eol,
svn_boolean_t *timestamp_sleep,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
@@ -1292,6 +1304,7 @@ svn_client__fetch_externals(apr_hash_t *
cb.to_abspath = to_abspath;
cb.repos_root_url = repos_root_url;
cb.timestamp_sleep = timestamp_sleep;
+ cb.native_eol = native_eol;
cb.is_export = is_export;
cb.pool = pool;
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_client/info.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_client/info.c?rev=984468&r1=984467&r2=984468&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_client/info.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_client/info.c Wed Aug 11 16:43:22 2010
@@ -570,7 +570,7 @@ svn_client_info3(const char *abspath_or_
url, rev);
/* Open a new RA session to the item's parent. */
- SVN_ERR(svn_client__open_ra_session_internal(&parent_ra_session,
+ SVN_ERR(svn_client__open_ra_session_internal(&parent_ra_session, NULL,
parent_url, NULL,
NULL, FALSE, TRUE,
ctx, pool));
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_client/list.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_client/list.c?rev=984468&r1=984467&r2=984468&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_client/list.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_client/list.c Wed Aug 11 16:43:22 2010
@@ -178,8 +178,8 @@ svn_client_list2(const char *path_or_url
base_name = svn_path_uri_decode(base_name, pool);
SVN_ERR(svn_client__open_ra_session_internal(&parent_session,
- parent_url, NULL,
- NULL, FALSE,
+ NULL, parent_url,
+ NULL, NULL, FALSE,
TRUE, ctx, pool));
/* Get all parent's entries, no props. */
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_client/locking_commands.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_client/locking_commands.c?rev=984468&r1=984467&r2=984468&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_client/locking_commands.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_client/locking_commands.c Wed Aug 11 16:43:22 2010
@@ -415,8 +415,10 @@ svn_client_lock(const apr_array_header_t
/* Open an RA session to the common parent of TARGETS. */
if (base_dir)
SVN_ERR(svn_dirent_get_absolute(&base_dir_abspath, base_dir, pool));
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session, common_parent_url,
- base_dir, NULL, FALSE, FALSE, ctx, pool));
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
+ common_parent_url, base_dir,
+ NULL, FALSE, FALSE,
+ ctx, pool));
cb.base_path = base_dir;
cb.urls_to_paths = urls_to_paths;
@@ -453,8 +455,10 @@ svn_client_unlock(const apr_array_header
/* Open an RA session. */
if (base_dir)
SVN_ERR(svn_dirent_get_absolute(&base_dir_abspath, base_dir, pool));
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session, common_parent_url,
- base_dir_abspath, NULL, FALSE, FALSE, ctx, pool));
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
+ common_parent_url,
+ base_dir_abspath, NULL, FALSE,
+ FALSE, ctx, pool));
/* If break_lock is not set, lock tokens are required by the server.
If the targets were all URLs, ensure that we provide lock tokens,
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_client/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_client/log.c?rev=984468&r1=984467&r2=984468&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_client/log.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_client/log.c Wed Aug 11 16:43:22 2010
@@ -44,38 +44,6 @@
/*** Getting misc. information ***/
-/* A log callback conforming to the svn_log_entry_receiver_t
- interface for obtaining the last revision of a node at a path and
- storing it in *BATON (an svn_revnum_t). */
-static svn_error_t *
-revnum_receiver(void *baton,
- svn_log_entry_t *log_entry,
- apr_pool_t *pool)
-{
- if (SVN_IS_VALID_REVNUM(log_entry->revision))
- *((svn_revnum_t *) baton) = log_entry->revision;
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_client__oldest_rev_at_path(svn_revnum_t *oldest_rev,
- svn_ra_session_t *ra_session,
- const char *rel_path,
- svn_revnum_t rev,
- apr_pool_t *pool)
-{
- apr_array_header_t *rel_paths = apr_array_make(pool, 1, sizeof(rel_path));
- apr_array_header_t *revprops = apr_array_make(pool, 0, sizeof(char *));
- *oldest_rev = SVN_INVALID_REVNUM;
- APR_ARRAY_PUSH(rel_paths, const char *) = rel_path;
-
- /* Trace back in history to find the revision at which this node
- was created (copied or added). */
- return svn_ra_get_log2(ra_session, rel_paths, 1, rev, 1, FALSE, TRUE,
- FALSE, revprops, revnum_receiver, oldest_rev, pool);
-}
-
/* The baton for use with copyfrom_info_receiver(). */
typedef struct
{
@@ -423,8 +391,17 @@ svn_client_log5(const apr_array_header_t
{
/* We have some paths, let's use them. Start after the URL. */
for (i = 1; i < targets->nelts; i++)
- APR_ARRAY_PUSH(condensed_targets, const char *) =
- APR_ARRAY_IDX(targets, i, const char *);
+ {
+ const char *target;
+
+ target = APR_ARRAY_IDX(targets, i, const char *);
+ if (svn_path_is_url(target) || svn_dirent_is_absolute(target))
+ return svn_error_return(svn_error_createf(
+ SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a relative path"),
+ target));
+ APR_ARRAY_PUSH(condensed_targets, const char *) = target;
+ }
}
else
{
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_client/merge.c?rev=984468&r1=984467&r2=984468&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_client/merge.c Wed Aug 11 16:43:22 2010
@@ -378,8 +378,9 @@ is_path_conflicted_by_merge(merge_cmd_ba
* different kind is expected, or if the disk node cannot be read.
* - Return 'missing' if there is no node on disk but one is expected.
* Also return 'missing' for absent nodes (not here due to authz).*/
-static svn_wc_notify_state_t
-obstructed_or_missing(const char *local_abspath,
+static svn_error_t *
+obstructed_or_missing(svn_wc_notify_state_t *obstr_state,
+ const char *local_abspath,
const char *local_dir_abspath,
const merge_cmd_baton_t *merge_b,
apr_pool_t *pool)
@@ -391,20 +392,14 @@ obstructed_or_missing(const char *local_
/* In a dry run, make as if nodes "deleted" by the dry run appear so. */
if (merge_b->dry_run && dry_run_deleted_p(merge_b, local_abspath))
- return svn_wc_notify_state_inapplicable;
-
- /* Since this function returns no svn_error_t, we make all errors look like
- * no node found in the wc. */
-
- err = svn_wc_read_kind(&kind_expected, merge_b->ctx->wc_ctx,
- local_abspath, FALSE, pool);
-
- if (err)
{
- svn_error_clear(err);
- kind_expected = svn_node_none;
+ *obstr_state = svn_wc_notify_state_inapplicable;
+ return SVN_NO_ERROR;
}
+ SVN_ERR(svn_wc_read_kind(&kind_expected, merge_b->ctx->wc_ctx,
+ local_abspath, FALSE, pool));
+
/* Report absent nodes as 'missing'. First of all, they count as 'hidden',
* and since we pass show_hidden == FALSE above, they will show up as
* 'none' here. */
@@ -413,44 +408,66 @@ obstructed_or_missing(const char *local_
svn_boolean_t is_absent;
err = svn_wc__node_is_status_absent(&is_absent, merge_b->ctx->wc_ctx,
local_abspath, pool);
- if (err)
- svn_error_clear(err);
- else if (is_absent)
- return svn_wc_notify_state_missing;
+ if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+ return svn_error_return(err);
+ else if (!err && is_absent)
+ {
+ *obstr_state = svn_wc_notify_state_missing;
+ return SVN_NO_ERROR;
+ }
+
+ svn_error_clear(err);
}
- /* If a node is deleted, we will still get its kind from the working copy.
+ SVN_ERR(svn_io_check_path(local_abspath, &kind_on_disk, pool));
+
+ /* If a node is deleted, the node might be gone in the working copy (and
+ * it probably is gone after we switch to single-db
+ *
* But to compare with disk state, we want to consider deleted nodes as
- * svn_node_none instead of their original kind.
- * ### Not necessary with central DB:
- * Because deleted directories are expected to remain on disk until commit
- * to keep the metadata available, we only do this for files, not dirs. */
- if (kind_expected == svn_node_file)
+ * svn_node_none instead of their original kind. */
+
+ if (kind_expected == svn_node_file
+ || kind_expected == svn_node_dir)
{
svn_boolean_t is_deleted;
- err = svn_wc__node_is_status_deleted(&is_deleted,
- merge_b->ctx->wc_ctx,
- local_abspath,
- pool);
- if (err)
- svn_error_clear(err);
- else if (is_deleted)
- kind_expected = svn_node_none;
- }
- err = svn_io_check_path(local_abspath, &kind_on_disk, pool);
- if (err)
- {
- svn_error_clear(err);
- kind_on_disk = svn_node_unknown;
+ SVN_ERR(svn_wc__node_is_status_deleted(&is_deleted,
+ merge_b->ctx->wc_ctx,
+ local_abspath,
+ pool));
+ if (is_deleted)
+ {
+ /* ### While we are not at single-db: detect missing .svn dirs.
+ ### Once we switch to single db expected kind should be always
+ ### none, just like for files */
+ if (kind_expected == svn_node_dir)
+ {
+ if (kind_on_disk == svn_node_none)
+ {
+ svn_boolean_t is_obstructed;
+
+ SVN_ERR(svn_wc__node_is_status_obstructed(&is_obstructed,
+ merge_b->ctx->wc_ctx,
+ local_abspath,
+ pool));
+ if (!is_obstructed)
+ kind_expected = svn_node_none;
+ }
+ }
+ else
+ kind_expected = svn_node_none;
+ }
}
if (kind_expected == kind_on_disk)
- return svn_wc_notify_state_inapplicable;
+ *obstr_state = svn_wc_notify_state_inapplicable;
else if (kind_on_disk == svn_node_none)
- return svn_wc_notify_state_missing;
+ *obstr_state = svn_wc_notify_state_missing;
else
- return svn_wc_notify_state_obstructed;
+ *obstr_state = svn_wc_notify_state_obstructed;
+
+ return SVN_NO_ERROR;
}
/* Create *LEFT and *RIGHT conflict versions for conflict victim
@@ -1083,8 +1100,9 @@ merge_props_changed(const char *local_di
{
svn_wc_notify_state_t obstr_state;
- obstr_state = obstructed_or_missing(local_abspath, local_dir_abspath,
- merge_b, subpool);
+ SVN_ERR(obstructed_or_missing(&obstr_state,
+ local_abspath, local_dir_abspath,
+ merge_b, subpool));
if (obstr_state != svn_wc_notify_state_inapplicable)
{
if (state)
@@ -1126,8 +1144,12 @@ merge_props_changed(const char *local_di
int i;
/* If this is a forward merge then don't add new mergeinfo to
- PATH that is already part of PATH's own history. */
- if (merge_b->merge_source.rev1 < merge_b->merge_source.rev2)
+ PATH that is already part of PATH's own history, see
+ http://svn.haxx.se/dev/archive-2008-09/0006.shtml. If the
+ merge sources are not ancestral then there is no concept of a
+ 'forward' or 'reverse' merge and we filter unconditionally. */
+ if (merge_b->merge_source.rev1 < merge_b->merge_source.rev2
+ || !merge_b->sources_ancestral)
SVN_ERR(filter_self_referential_mergeinfo(&props,
local_abspath,
HONOR_MERGEINFO(merge_b),
@@ -1315,8 +1337,9 @@ merge_file_changed(const char *local_dir
{
svn_wc_notify_state_t obstr_state;
- obstr_state = obstructed_or_missing(mine_abspath, local_dir_abspath,
- merge_b, subpool);
+ SVN_ERR(obstructed_or_missing(&obstr_state,
+ mine_abspath, local_dir_abspath,
+ merge_b, subpool));
if (obstr_state != svn_wc_notify_state_inapplicable)
{
if (content_state)
@@ -1345,7 +1368,9 @@ merge_file_changed(const char *local_dir
SVN_ERR(svn_wc__node_get_depth(&parent_depth, merge_b->ctx->wc_ctx,
svn_dirent_dirname(mine_abspath, subpool),
subpool));
- if (wc_kind == svn_node_none && parent_depth < svn_depth_files)
+ if (wc_kind == svn_node_none
+ && parent_depth < svn_depth_files
+ && parent_depth != svn_depth_unknown)
{
if (content_state)
*content_state = svn_wc_notify_state_missing;
@@ -1631,8 +1656,9 @@ merge_file_added(const char *local_dir_a
{
svn_wc_notify_state_t obstr_state;
- obstr_state = obstructed_or_missing(mine_abspath, local_dir_abspath,
- merge_b, subpool);
+ SVN_ERR(obstructed_or_missing(&obstr_state,
+ mine_abspath, local_dir_abspath,
+ merge_b, subpool));
if (obstr_state != svn_wc_notify_state_inapplicable)
{
if (content_state)
@@ -1846,12 +1872,24 @@ files_same_p(svn_boolean_t *same,
scratch_pool));
if (*same)
{
- svn_boolean_t modified;
+ svn_stream_t *mine_stream;
+ svn_stream_t *older_stream;
+ svn_opt_revision_t working_rev;
+
+ working_rev.kind = svn_opt_revision_working;
/* Compare the file content, translating 'mine' to 'normal' form. */
- SVN_ERR(svn_wc__versioned_file_modcheck(&modified, wc_ctx, mine_abspath,
- older_abspath, scratch_pool));
- *same = !modified;
+ SVN_ERR(svn_client__get_normalized_stream(&mine_stream, wc_ctx,
+ mine_abspath, &working_rev,
+ FALSE, NULL, NULL,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(svn_stream_open_readonly(&older_stream, older_abspath,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(svn_stream_contents_same2(same, mine_stream, older_stream,
+ scratch_pool));
+
}
return SVN_NO_ERROR;
@@ -1905,8 +1943,9 @@ merge_file_deleted(const char *local_dir
{
svn_wc_notify_state_t obstr_state;
- obstr_state = obstructed_or_missing(mine_abspath, local_dir_abspath,
- merge_b, subpool);
+ SVN_ERR(obstructed_or_missing(&obstr_state,
+ mine_abspath, local_dir_abspath,
+ merge_b, subpool));
if (obstr_state != svn_wc_notify_state_inapplicable)
{
if (state)
@@ -2093,8 +2132,9 @@ merge_dir_added(const char *local_dir_ab
{
svn_wc_notify_state_t obstr_state;
- obstr_state = obstructed_or_missing(local_abspath, local_dir_abspath,
- merge_b, subpool);
+ SVN_ERR(obstructed_or_missing(&obstr_state,
+ local_abspath, local_dir_abspath,
+ merge_b, subpool));
/* In this case of adding a directory, we have an exception to the usual
* "skip if it's inconsistent" rule. If the directory exists on disk
@@ -2122,7 +2162,7 @@ merge_dir_added(const char *local_dir_ab
merge_b->added_path = apr_pstrdup(merge_b->pool, local_abspath);
else
{
- SVN_ERR(svn_io_make_dir_recursively(local_abspath, subpool));
+ SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, subpool));
SVN_ERR(svn_wc_add4(merge_b->ctx->wc_ctx, local_abspath,
svn_depth_infinity,
copyfrom_url, copyfrom_rev,
@@ -2282,8 +2322,9 @@ merge_dir_deleted(const char *local_dir_
{
svn_wc_notify_state_t obstr_state;
- obstr_state = obstructed_or_missing(local_abspath, local_dir_abspath,
- merge_b, subpool);
+ SVN_ERR(obstructed_or_missing(&obstr_state,
+ local_abspath, local_dir_abspath,
+ merge_b, subpool));
if (obstr_state != svn_wc_notify_state_inapplicable)
{
if (state)
@@ -2414,8 +2455,9 @@ merge_dir_opened(const char *local_dir_a
}
/* Check for an obstructed or missing node on disk. */
- obstr_state = obstructed_or_missing(path, local_dir_abspath, merge_b,
- subpool);
+ SVN_ERR(obstructed_or_missing(&obstr_state,
+ path, local_dir_abspath,
+ merge_b, subpool));
if (obstr_state != svn_wc_notify_state_inapplicable)
{
if (skip_children)
@@ -3353,7 +3395,7 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
}
else
{
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url,
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url,
NULL, NULL,
FALSE, TRUE,
ctx, scratch_pool));
@@ -4382,12 +4424,21 @@ calculate_merge_inheritance(apr_array_he
return SVN_NO_ERROR;
}
-/* Calculate the new mergeinfo for the target tree based on the merge
- info for TARGET_ABSPATH and MERGES (a mapping of absolute WC paths to
- rangelists), and record it in the WC (at, and possibly below,
- TARGET_ABSPATH). */
+/* Calculate the new mergeinfo for the target tree rooted at TARGET_ABSPATH
+ based on MERGES (a mapping of absolute WC paths to rangelists representing
+ a merge from the source REPOS_REL_PATH).
+
+ If RESULT_CATALOG is NULL, then record the new mergeinfo in the WC (at,
+ and possibly below, TARGET_ABSPATH).
+
+ If RESULT_CATALOG is not NULL, then don't record the new mergeinfo on the
+ WC, but instead record it in RESULT_CATALOG, where the keys are absolute
+ working copy paths and the values are the new mergeinfos for each.
+ Allocate additions to RESULT_CATALOG in pool which RESULT_CATALOG was
+ created in. */
static svn_error_t *
-update_wc_mergeinfo(const char *target_abspath,
+update_wc_mergeinfo(svn_mergeinfo_catalog_t result_catalog,
+ const char *target_abspath,
const char *repos_rel_path,
apr_hash_t *merges,
svn_boolean_t is_rollback,
@@ -4482,25 +4533,42 @@ update_wc_mergeinfo(const char *target_a
svn_mergeinfo__remove_empty_rangelists(mergeinfo, scratch_pool);
- err = svn_client__record_wc_mergeinfo(local_abspath, mergeinfo,
- TRUE, ctx, iterpool);
-
- if (err && err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
+ if (result_catalog)
{
- /* PATH isn't just missing, it's not even versioned as far
- as this working copy knows. But it was included in
- MERGES, which means that the server knows about it.
- Likely we don't have access to the source due to authz
- restrictions. For now just clear the error and
- continue...
-
- ### TODO: Set non-inheritable mergeinfo on PATH's immediate
- ### parent and normal mergeinfo on PATH's siblings which we
- ### do have access to. */
- svn_error_clear(err);
+ svn_mergeinfo_t existing_mergeinfo =
+ apr_hash_get(result_catalog, local_abspath, APR_HASH_KEY_STRING);
+ apr_pool_t *result_catalog_pool = apr_hash_pool_get(result_catalog);
+
+ if (existing_mergeinfo)
+ SVN_ERR(svn_mergeinfo_merge(mergeinfo, existing_mergeinfo,
+ result_catalog_pool));
+ apr_hash_set(result_catalog,
+ apr_pstrdup(result_catalog_pool, local_abspath),
+ APR_HASH_KEY_STRING,
+ svn_mergeinfo_dup(mergeinfo, result_catalog_pool));
}
else
- SVN_ERR(err);
+ {
+ err = svn_client__record_wc_mergeinfo(local_abspath, mergeinfo,
+ TRUE, ctx, iterpool);
+
+ if (err && err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
+ {
+ /* PATH isn't just missing, it's not even versioned as far
+ as this working copy knows. But it was included in
+ MERGES, which means that the server knows about it.
+ Likely we don't have access to the source due to authz
+ restrictions. For now just clear the error and
+ continue...
+
+ ### TODO: Set non-inheritable mergeinfo on PATH's immediate
+ ### parent and normal mergeinfo on PATH's siblings which we
+ ### do have access to. */
+ svn_error_clear(err);
+ }
+ else
+ SVN_ERR(err);
+ }
}
svn_pool_destroy(iterpool);
@@ -4575,7 +4643,7 @@ record_skips(const char *mergeinfo_path,
### skipped? */
;
}
- SVN_ERR(update_wc_mergeinfo(merge_b->target_abspath,
+ SVN_ERR(update_wc_mergeinfo(NULL, merge_b->target_abspath,
mergeinfo_path, merges,
is_rollback, merge_b->ctx, pool));
@@ -6342,11 +6410,18 @@ filter_natural_history_from_mergeinfo(ap
cousins thrice removed, etc...). (This is used to simulate the
history checks that the repository logic does in the directory case.)
+ If mergeinfo is being recorded to describe this merge, and RESULT_CATALOG
+ is not NULL, then don't record the new mergeinfo on the TARGET_ABSPATH,
+ but instead record it in RESULT_CATALOG, where the key is TARGET_ABSPATH
+ and the value is the new mergeinfo for that path. Allocate additions
+ to RESULT_CATALOG in pool which RESULT_CATALOG was created in.
+
Note: MERGE_B->RA_SESSION1 must be associated with URL1 and
MERGE_B->RA_SESSION2 with URL2.
*/
static svn_error_t *
-do_file_merge(const char *url1,
+do_file_merge(svn_mergeinfo_catalog_t result_catalog,
+ const char *url1,
svn_revnum_t revision1,
const char *url2,
svn_revnum_t revision2,
@@ -6681,8 +6756,8 @@ do_file_merge(const char *url1,
notify, subpool);
}
- SVN_ERR(update_wc_mergeinfo(target_abspath, mergeinfo_path,
- merges, is_rollback,
+ SVN_ERR(update_wc_mergeinfo(result_catalog, target_abspath,
+ mergeinfo_path, merges, is_rollback,
ctx, subpool));
}
}
@@ -7045,19 +7120,25 @@ get_inoperative_immediate_children(apr_h
/* Helper for do_directory_merge().
- Record mergeinfo describing a merge of MERGED_RANGE->START:
- MERGED_RANGE->END from the repository relative path MERGEINFO_PATH
- to the merge target (and possibly its subtrees) described by
- NOTIFY_B->CHILDREN_WITH_MERGEINFO -- see the global comment
+ If RESULT_CATALOG is NULL then record mergeinfo describing a merge of
+ MERGED_RANGE->START:MERGED_RANGE->END from the repository relative path
+ MERGEINFO_PATH to the merge target (and possibly its subtrees) described
+ by NOTIFY_B->CHILDREN_WITH_MERGEINFO -- see the global comment
'THE CHILDREN_WITH_MERGEINFO ARRAY'. Obviously this should only
- be called if recording mergeinfo -- see doc string for
- RECORD_MERGEINFO().
+ be called if recording mergeinfo -- see doc string for RECORD_MERGEINFO().
+
+ If RESULT_CATALOG is not NULL, then don't record the new mergeinfo on the
+ WC, but instead record it in RESULT_CATALOG, where the keys are absolute
+ working copy paths and the values are the new mergeinfos for each.
+ Allocate additions to RESULT_CATALOG in pool which RESULT_CATALOG was
+ created in.
DEPTH, NOTIFY_B, MERGE_B, and SQUELCH_MERGEINFO_NOTIFICATIONS are all
cascaded from do_directory_merge's arguments of the same names.
*/
static svn_error_t *
-record_mergeinfo_for_dir_merge(const svn_merge_range_t *merged_range,
+record_mergeinfo_for_dir_merge(svn_mergeinfo_catalog_t result_catalog,
+ const svn_merge_range_t *merged_range,
const char *mergeinfo_path,
svn_depth_t depth,
svn_boolean_t squelch_mergeinfo_notifications,
@@ -7267,7 +7348,8 @@ record_mergeinfo_for_dir_merge(const svn
child_merges = apr_hash_make(iterpool);
apr_hash_set(child_merges, child->abspath, APR_HASH_KEY_STRING,
child_merge_rangelist);
- SVN_ERR(update_wc_mergeinfo(child->abspath,
+ SVN_ERR(update_wc_mergeinfo(result_catalog,
+ child->abspath,
child_merge_src_canon_path,
child_merges, is_rollback,
merge_b->ctx, iterpool));
@@ -7767,6 +7849,12 @@ remove_noop_subtree_ranges(const char *u
svn_wc_notify_merge_record_info_begin notification before any mergeinfo
changes are made to describe the merge performed.
+ If mergeinfo is being recorded to describe this merge, and RESULT_CATALOG
+ is not NULL, then don't record the new mergeinfo on the WC, but instead
+ record it in RESULT_CATALOG, where the keys are absolute working copy
+ paths and the values are the new mergeinfos for each. Allocate additions
+ to RESULT_CATALOG in pool which RESULT_CATALOG was created in.
+
Handle DEPTH as documented for svn_client_merge3().
NOTE: This is a wrapper around drive_merge_report_editor() which
@@ -7775,7 +7863,8 @@ remove_noop_subtree_ranges(const char *u
meet one or more of the criteria described in get_mergeinfo_paths()).
*/
static svn_error_t *
-do_directory_merge(const char *url1,
+do_directory_merge(svn_mergeinfo_catalog_t result_catalog,
+ const char *url1,
svn_revnum_t revision1,
const char *url2,
svn_revnum_t revision2,
@@ -8050,7 +8139,8 @@ do_directory_merge(const char *url1,
/* Record mergeinfo where appropriate.*/
if (record_mergeinfo)
{
- SVN_ERR(record_mergeinfo_for_dir_merge(&range,
+ SVN_ERR(record_mergeinfo_for_dir_merge(result_catalog,
+ &range,
mergeinfo_path,
depth,
squelch_mergeinfo_notifications,
@@ -8109,9 +8199,8 @@ ensure_ra_session_url(svn_ra_session_t *
if (! *ra_session || (err && err->apr_err == SVN_ERR_RA_ILLEGAL_URL))
{
svn_error_clear(err);
- err = svn_client__open_ra_session_internal(ra_session, url,
- NULL, NULL,
- FALSE, TRUE, ctx, pool);
+ err = svn_client__open_ra_session_internal(ra_session, NULL, url, NULL,
+ NULL, FALSE, TRUE, ctx, pool);
}
SVN_ERR(err);
@@ -8149,6 +8238,12 @@ ensure_ra_session_url(svn_ra_session_t *
notification before any mergeinfo changes are made to describe the merge
performed.
+ If mergeinfo is being recorded to describe this merge, and RESULT_CATALOG
+ is not NULL, then don't record the new mergeinfo on the WC, but instead
+ record it in RESULT_CATALOG, where the keys are absolute working copy
+ paths and the values are the new mergeinfos for each. Allocate additions
+ to RESULT_CATALOG in pool which RESULT_CATALOG was created in.
+
FORCE, DRY_RUN, RECORD_ONLY, IGNORE_ANCESTRY, DEPTH, MERGE_OPTIONS,
and CTX are as described in the docstring for svn_client_merge_peg3().
@@ -8166,6 +8261,7 @@ ensure_ra_session_url(svn_ra_session_t *
*/
static svn_error_t *
do_merge(apr_hash_t **modified_subtrees,
+ svn_mergeinfo_catalog_t result_catalog,
const apr_array_header_t *merge_sources,
const char *target_abspath,
svn_boolean_t sources_ancestral,
@@ -8323,7 +8419,8 @@ do_merge(apr_hash_t **modified_subtrees,
/* Call our merge helpers based on TARGET_ABSPATH's kind. */
if (target_kind == svn_node_file)
{
- SVN_ERR(do_file_merge(url1, rev1, url2, rev2, target_abspath,
+ SVN_ERR(do_file_merge(result_catalog,
+ url1, rev1, url2, rev2, target_abspath,
sources_related,
squelch_mergeinfo_notifications,
¬ify_baton,
@@ -8331,7 +8428,8 @@ do_merge(apr_hash_t **modified_subtrees,
}
else if (target_kind == svn_node_dir)
{
- SVN_ERR(do_directory_merge(url1, rev1, url2, rev2, target_abspath,
+ SVN_ERR(do_directory_merge(result_catalog,
+ url1, rev1, url2, rev2, target_abspath,
depth, squelch_mergeinfo_notifications,
¬ify_baton, &merge_cmd_baton,
subpool));
@@ -8478,7 +8576,7 @@ merge_cousins_and_supplement_mergeinfo(c
faux_source->rev1 = rev1;
faux_source->rev2 = rev2;
APR_ARRAY_PUSH(faux_sources, merge_source_t *) = faux_source;
- SVN_ERR(do_merge(&modified_subtrees, faux_sources, target_abspath,
+ SVN_ERR(do_merge(&modified_subtrees, NULL, faux_sources, target_abspath,
FALSE, TRUE, same_repos,
ignore_ancestry, force, dry_run, FALSE, NULL, TRUE,
FALSE, depth, merge_options, use_sleep, ctx,
@@ -8495,22 +8593,66 @@ merge_cousins_and_supplement_mergeinfo(c
pair of record-only merges using the real sources we've
calculated. (We know that each tong in our fork of our merge
source history tree has an ancestral relationship with the common
- ancestral, so we force ancestral=TRUE here.) */
+ ancestral, so we force ancestral=TRUE here.)
+
+ Issue #3648: We don't actually perform these two record-only merges
+ on the WC at first, but rather see what each would do and store that
+ in two mergeinfo catalogs. We then merge the catalogs together and
+ then record the result in the WC. This prevents the second record
+ only merge from removing legitimate mergeinfo history, from the same
+ source, that was made in prior merges. */
if (same_repos && !dry_run)
{
svn_wc_notify_t *notify = svn_wc_create_notify(
target_abspath, svn_wc_notify_merge_record_info_begin, pool);
+ svn_mergeinfo_catalog_t add_result_catalog = apr_hash_make(pool);
+ svn_mergeinfo_catalog_t remove_result_catalog = apr_hash_make(pool);
+
ctx->notify_func2(ctx->notify_baton2, notify, pool);
- SVN_ERR(do_merge(NULL, add_sources, target_abspath,
+ SVN_ERR(do_merge(NULL, add_result_catalog, add_sources, target_abspath,
TRUE, TRUE, same_repos,
ignore_ancestry, force, dry_run, TRUE,
modified_subtrees, TRUE,
TRUE, depth, merge_options, use_sleep, ctx, pool));
- SVN_ERR(do_merge(NULL, remove_sources, target_abspath,
- TRUE, TRUE, same_repos,
+ SVN_ERR(do_merge(NULL, remove_result_catalog, remove_sources,
+ target_abspath, TRUE, TRUE, same_repos,
ignore_ancestry, force, dry_run, TRUE,
modified_subtrees, TRUE,
TRUE, depth, merge_options, use_sleep, ctx, pool));
+ SVN_ERR(svn_mergeinfo_catalog_merge(add_result_catalog,
+ remove_result_catalog,
+ pool, pool));
+
+ if (apr_hash_count(add_result_catalog))
+ {
+ int i;
+ apr_array_header_t *sorted_cat;
+
+ sorted_cat = svn_sort__hash(add_result_catalog,
+ svn_sort_compare_items_as_paths, pool);
+ for (i = 0; i < sorted_cat->nelts; i++)
+ {
+ svn_sort__item_t elt = APR_ARRAY_IDX(sorted_cat, i,
+ svn_sort__item_t);
+ svn_error_t *err = svn_client__record_wc_mergeinfo(elt.key,
+ elt.value,
+ TRUE, ctx,
+ pool);
+
+ if (err && err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
+ {
+ /* PATH isn't just missing, it's not even versioned as far
+ as this working copy knows. But it was included in
+ MERGES, which means that the server knows about it.
+ Likely we don't have access to the source due to authz
+ restrictions. For now just clear the error and
+ continue... */
+ svn_error_clear(err);
+ }
+ else
+ SVN_ERR(err);
+ }
+ }
}
return SVN_NO_ERROR;
@@ -8592,12 +8734,12 @@ merge_locked(const char *source1,
/* Open some RA sessions to our merge source sides. */
sesspool = svn_pool_create(scratch_pool);
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session1,
- URL1, NULL, NULL,
- FALSE, TRUE, ctx, sesspool));
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session2,
- URL2, NULL, NULL,
- FALSE, TRUE, ctx, sesspool));
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session1, NULL, URL1,
+ NULL, NULL, FALSE, TRUE,
+ ctx, sesspool));
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session2, NULL, URL2,
+ NULL, NULL, FALSE, TRUE,
+ ctx, sesspool));
/* Resolve revisions to real numbers. */
SVN_ERR(svn_client__get_revision_number(&rev1, &youngest_rev, ctx->wc_ctx,
@@ -8756,7 +8898,7 @@ merge_locked(const char *source1,
/* Close our temporary RA sessions. */
svn_pool_destroy(sesspool);
- err = do_merge(NULL, merge_sources, target_abspath,
+ err = do_merge(NULL, NULL, merge_sources, target_abspath,
ancestral, related, same_repos,
ignore_ancestry, force, dry_run,
record_only, NULL, FALSE, FALSE, depth, merge_options,
@@ -8857,8 +8999,9 @@ svn_client_merge3(const char *source1,
baton.ctx = ctx;
if (!dry_run)
- SVN_ERR(svn_wc__call_with_write_lock(merge_cb, &baton, ctx->wc_ctx,
- lock_abspath, pool, pool));
+ SVN_ERR(svn_wc__call_with_write_lock(merge_cb, &baton,
+ ctx->wc_ctx, lock_abspath, FALSE,
+ pool, pool));
else
SVN_ERR(merge_cb(&baton, pool, pool));
@@ -9883,13 +10026,13 @@ merge_reintegrate_locked(const char *sou
/* Open two RA sessions, one to our source and one to our target. */
SVN_ERR(svn_wc__node_get_url(&target_url, ctx->wc_ctx, target_abspath,
scratch_pool, scratch_pool));
- SVN_ERR(svn_client__open_ra_session_internal(&target_ra_session, target_url,
- NULL, NULL, FALSE, FALSE, ctx,
- scratch_pool));
- SVN_ERR(svn_client__open_ra_session_internal(&source_ra_session, url2,
- NULL, NULL,
- FALSE, FALSE, ctx,
- scratch_pool));
+ SVN_ERR(svn_client__open_ra_session_internal(&target_ra_session, NULL,
+ target_url,
+ NULL, NULL, FALSE, FALSE,
+ ctx, scratch_pool));
+ SVN_ERR(svn_client__open_ra_session_internal(&source_ra_session, NULL,
+ url2, NULL, NULL, FALSE, FALSE,
+ ctx, scratch_pool));
SVN_ERR(svn_client__get_revision_number(&rev2, NULL, ctx->wc_ctx,
"",
@@ -10041,7 +10184,7 @@ svn_client_merge_reintegrate(const char
if (!dry_run)
SVN_ERR(svn_wc__call_with_write_lock(merge_reintegrate_cb, &baton,
- ctx->wc_ctx, lock_abspath,
+ ctx->wc_ctx, lock_abspath, FALSE,
pool, pool));
else
SVN_ERR(merge_reintegrate_cb(&baton, pool, pool));
@@ -10092,8 +10235,9 @@ merge_peg_locked(const char *source,
/* Open an RA session to our source URL, and determine its root URL. */
sesspool = svn_pool_create(scratch_pool);
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session, URL, NULL, NULL,
- FALSE, TRUE, ctx, sesspool));
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL, NULL,
+ NULL, FALSE, TRUE,
+ ctx, sesspool));
SVN_ERR(svn_ra_get_repos_root2(ra_session, &source_repos_root, scratch_pool));
/* Normalize our merge sources. */
@@ -10121,7 +10265,7 @@ merge_peg_locked(const char *source,
/* Do the real merge! (We say with confidence that our merge
sources are both ancestral and related.) */
- err = do_merge(NULL, merge_sources, target_abspath,
+ err = do_merge(NULL, NULL, merge_sources, target_abspath,
TRUE, TRUE, same_repos, ignore_ancestry, force, dry_run,
record_only, NULL, FALSE, FALSE, depth, merge_options,
&use_sleep, ctx, scratch_pool);
@@ -10200,8 +10344,9 @@ svn_client_merge_peg3(const char *source
baton.ctx = ctx;
if (!dry_run)
- SVN_ERR(svn_wc__call_with_write_lock(merge_peg_cb, &baton, ctx->wc_ctx,
- lock_abspath, pool, pool));
+ SVN_ERR(svn_wc__call_with_write_lock(merge_peg_cb, &baton,
+ ctx->wc_ctx, lock_abspath, FALSE,
+ pool, pool));
else
SVN_ERR(merge_peg_cb(&baton, pool, pool));
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_client/mergeinfo.c?rev=984468&r1=984467&r2=984468&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_client/mergeinfo.c Wed Aug 11 16:43:22 2010
@@ -616,11 +616,9 @@ svn_client__get_wc_or_repos_mergeinfo_ca
else
{
sesspool = svn_pool_create(scratch_pool);
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session,
- url, NULL, NULL,
- FALSE, TRUE,
- ctx,
- sesspool));
+ SVN_ERR(svn_client__open_ra_session_internal(
+ &ra_session, NULL, url, NULL, NULL, FALSE,
+ TRUE, ctx, sesspool));
}
SVN_ERR(svn_client__get_repos_mergeinfo_catalog(
@@ -725,9 +723,9 @@ svn_client__get_history_as_mergeinfo(svn
if (session == NULL)
{
sesspool = svn_pool_create(pool);
- SVN_ERR(svn_client__open_ra_session_internal(&session, url, NULL, NULL,
- FALSE, TRUE, ctx,
- sesspool));
+ SVN_ERR(svn_client__open_ra_session_internal(&session, NULL, url, NULL,
+ NULL, FALSE, TRUE,
+ ctx, sesspool));
}
/* Fetch the location segments for our URL@PEG_REVNUM. */
@@ -1031,9 +1029,10 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
svn_mergeinfo_catalog_t tmp_catalog;
SVN_ERR(svn_dirent_get_absolute(&local_abspath, "", scratch_pool));
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session, path_or_url,
- NULL, NULL, FALSE,
- TRUE, ctx, scratch_pool));
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
+ path_or_url, NULL, NULL,
+ FALSE, TRUE, ctx,
+ scratch_pool));
SVN_ERR(svn_client__get_revision_number(&rev, NULL, ctx->wc_ctx,
local_abspath, ra_session,
&peg_rev, scratch_pool));
@@ -1081,9 +1080,9 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
svn_boolean_t indirect;
/* Check server Merge Tracking capability. */
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url,
- NULL, NULL, FALSE,
- TRUE, ctx, scratch_pool));
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url,
+ NULL, NULL, FALSE, TRUE,
+ ctx, scratch_pool));
SVN_ERR(svn_ra__assert_mergeinfo_capable_server(ra_session, path_or_url,
scratch_pool));