Author: rhuijben
Date: Tue Apr 26 12:23:37 2011
New Revision: 1096738
URL: http://svn.apache.org/viewvc?rev=1096738&view=rev
Log:
Various preparations for moving the working copy obstruction handling from
the url<->url diff editor into the merge code.
The old obstruction checks fully relied on the access baton available checks
for all directory checks and we can't map this to wc-ng without some
restructuring.
This patch by itself removes the assumption that the diff editor is for
driving merges only, by removing a baton type expectation.
(This patch is a first part from a larger set which will be applied over the
next few days)
* subversion/include/svn_wc.h
(svn_wc_diff_callbacks4_t): Add file opened event and allow skipping of
files and directories alike.
* subversion/libsvn_client/client.h
(svn_client__dry_run_deletions): Remove function.
(svn_client__get_diff_editor): Move arguments around. Add
walk_deleted_dirs argument.
* subversion/libsvn_client/diff.c
(diff_props_changed,
diff_dir_props_changed): Update arguments.
(diff_file_opened): New function.
(diff_file_changed,
diff_file_added): Update caller.
(diff_dir_added,
diff_dir_opened,
diff_dir_closed): Update arguments.
(diff_repos_repos): Update caller.
* subversion/libsvn_client/merge.c
(svn_client__dry_run_deletions): Remove function.
(merge_dir_props_changed): New function, wrapping merge_props_changed.
(merge_file_opened): New function.
(merge_file_deleted): Record deleted files in dry run mode.
(merge_dir_added): Add new arguments.
(merge_dir_deleted): Record delected directories in dry run mode.
(merge_dir_opened): Add argument.
(merge_dir_closed): Add argument. Clear deleted files hash.
(merge_callbacks): Update list.
(drive_merge_report_editor): Update caller.
* subversion/libsvn_client/repos_diff.c
(edit_baton): Remove dav boolean.
(delete_entry): Don't call into the merge code when performing a dry run.
(add_directory): Update caller.
(open_directory): Update caller.
(open_file): Call new callback to allow skipping the ra file call and other
events on obstructions.
(close_directory): Remove call into merge code. Update caller.
(change_file_prop,
change_dir_prop): Handle binary properties correctly and remove check for dav
as this check is safe anyway.
(svn_client__get_diff_editor): Update arguments. Remove uri parsing.
* subversion/libsvn_wc/deprecated.c
(wrap_4to3_file_opened): New function.
(wrap_4to3_dir_added,
wrap_4to3_dir_props_changed,
wrap_4to3_dir_opened,
wrap_4to3_dir_closed): Add arguments.
(diff_callbacks3_wrapper): Update list.
* subversion/libsvn_wc/diff.c
(walk_local_nodes_diff): Update caller.
(report_wc_directory_as_added): Update caller.
(open_directory): Call callback.
(close_directory): Update caller and call callback.
(open_file): Call callback.
Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/client.h
subversion/trunk/subversion/libsvn_client/diff.c
subversion/trunk/subversion/libsvn_client/merge.c
subversion/trunk/subversion/libsvn_client/repos_diff.c
subversion/trunk/subversion/libsvn_wc/deprecated.c
subversion/trunk/subversion/libsvn_wc/diff.c
Modified: subversion/trunk/subversion/include/svn_wc.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1096738&r1=1096737&r2=1096738&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Apr 26 12:23:37 2011
@@ -2092,6 +2092,18 @@ typedef svn_error_t *(*svn_wc_conflict_r
typedef struct svn_wc_diff_callbacks4_t
{
/**
+ * This function is called before @a file_changed to allow callbacks to
+ * skip the most expensive processing of retrieving the file data.
+ *
+ */
+ svn_error_t *(*file_opened)(svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
+ const char *path,
+ svn_revnum_t rev,
+ void *diff_baton,
+ apr_pool_t *scratch_pool);
+
+ /**
* A file @a path has changed. If @a tmpfile2 is non-NULL, the
* contents have changed and those changes can be seen by comparing
* @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2 of
@@ -2185,9 +2197,40 @@ typedef struct svn_wc_diff_callbacks4_t
apr_pool_t *scratch_pool);
/**
+ * A directory @a path was deleted.
+ */
+ svn_error_t *(*dir_deleted)(const char *local_dir_abspath,
+ svn_wc_notify_state_t *state,
+ svn_boolean_t *tree_conflicted,
+ const char *path,
+ void *diff_baton,
+ apr_pool_t *scratch_pool);
+ /**
+ * A directory @a path has been opened. @a rev is the revision that the
+ * directory came from.
+ *
+ * This function is called for any existing directory @a path before any
+ * of the callbacks are called for a child of @a path.
+ *
+ * If the callback returns @c TRUE in @a *skip_children, children
+ * of this directory will be skipped.
+ */
+ svn_error_t *(*dir_opened)(const char *local_dir_abspath,
+ svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
+ svn_boolean_t *skip_children,
+ const char *path,
+ svn_revnum_t rev,
+ void *diff_baton,
+ apr_pool_t *scratch_pool);
+
+ /**
* A directory @a path was added. @a rev is the revision that the
* directory came from.
*
+ * This function is called for any new directory @a path before any
+ * of the callbacks are called for a child of @a path.
+ *
* If @a copyfrom_path is non-@c NULL, this add has history (i.e., is a
* copy), and the origin of the copy may be recorded as
* @a copyfrom_path under @a copyfrom_revision.
@@ -2195,6 +2238,8 @@ typedef struct svn_wc_diff_callbacks4_t
svn_error_t *(*dir_added)(const char *local_dir_abspath,
svn_wc_notify_state_t *state,
svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
+ svn_boolean_t *skip_children,
const char *path,
svn_revnum_t rev,
const char *copyfrom_path,
@@ -2203,60 +2248,37 @@ typedef struct svn_wc_diff_callbacks4_t
apr_pool_t *scratch_pool);
/**
- * A directory @a path was deleted.
- */
- svn_error_t *(*dir_deleted)(const char *local_dir_abspath,
- svn_wc_notify_state_t *state,
- svn_boolean_t *tree_conflicted,
- const char *path,
- void *diff_baton,
- apr_pool_t *scratch_pool);
-
- /**
* A list of property changes (@a propchanges) was applied to the
* directory @a path.
*
* The array is a list of (#svn_prop_t) structures.
*
- * The original list of properties is provided in @a original_props,
- * which is a hash of #svn_string_t values, keyed on the property
- * name.
+ * @a dir_was_added is set to #TRUE if the directory was added, and
+ * to #FALSE if the directory pre-existed.
*/
svn_error_t *(*dir_props_changed)(const char *local_dir_abspath,
svn_wc_notify_state_t *propstate,
svn_boolean_t *tree_conflicted,
const char *path,
+ svn_boolean_t dir_was_added,
const apr_array_header_t *propchanges,
apr_hash_t *original_props,
void *diff_baton,
apr_pool_t *scratch_pool);
/**
- * A directory @a path has been opened. @a rev is the revision that the
- * directory came from.
- *
- * This function is called for @a path before any of the callbacks are
- * called for a child of @a path.
+ * A directory @a path which has been opened with @a dir_opened or @a
+ * dir_added has been closed.
*
- * If the callback returns @c TRUE in @a *skip_children, children
- * of this directory will be skipped.
- */
- svn_error_t *(*dir_opened)(const char *local_dir_abspath,
- svn_boolean_t *tree_conflicted,
- svn_boolean_t *skip_children,
- const char *path,
- svn_revnum_t rev,
- void *diff_baton,
- apr_pool_t *scratch_pool);
-
- /**
- * A directory @a path has been closed.
+ * @a dir_was_added is set to #TRUE if the directory was added, and
+ * to #FALSE if the directory pre-existed.
*/
svn_error_t *(*dir_closed)(const char *local_dir_abspath,
svn_wc_notify_state_t *contentstate,
svn_wc_notify_state_t *propstate,
svn_boolean_t *tree_conflicted,
const char *path,
+ svn_boolean_t dir_was_added,
void *diff_baton,
apr_pool_t *scratch_pool);
Modified: subversion/trunk/subversion/libsvn_client/client.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1096738&r1=1096737&r2=1096738&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Tue Apr 26 12:23:37 2011
@@ -421,13 +421,6 @@ svn_error_t * svn_client__wc_delete(cons
svn_client_ctx_t *ctx,
apr_pool_t *pool);
-/* Return the set of WC paths to entries which would have been deleted
- by an update/merge if not in "dry run" mode, or NULL if not in "dry
- run" mode. MERGE_CMD_BATON is expected to be of type "struct
- merge_cmd_baton" (from merge.c). It contains the list, which is
- intended for direct modification. */
-apr_hash_t *svn_client__dry_run_deletions(void *merge_cmd_baton);
-
/* Make PATH and add it to the working copy, optionally making all the
intermediate parent directories if MAKE_PARENTS is TRUE. */
svn_error_t *
@@ -649,21 +642,23 @@ svn_client__switch_internal(svn_revnum_t
EDITOR/EDIT_BATON return the newly created editor and baton. */
svn_error_t *
-svn_client__get_diff_editor(const char *target,
+svn_client__get_diff_editor(const svn_delta_editor_t **editor,
+ void **edit_baton,
svn_wc_context_t *wc_ctx,
- const svn_wc_diff_callbacks4_t *diff_cmd,
- void *diff_cmd_baton,
+ const char *target,
svn_depth_t depth,
- svn_boolean_t dry_run,
svn_ra_session_t *ra_session,
svn_revnum_t revision,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
+ svn_boolean_t walk_deleted_dirs,
+ svn_boolean_t dry_run,
+ const svn_wc_diff_callbacks4_t *diff_callbacks,
+ void *diff_cmd_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
- const svn_delta_editor_t **editor,
- void **edit_baton,
- apr_pool_t *pool);
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* ---------------------------------------------------------------- */
Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1096738&r1=1096737&r2=1096738&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Tue Apr 26 12:23:37 2011
@@ -793,6 +793,7 @@ diff_props_changed(const char *local_dir
svn_wc_notify_state_t *state,
svn_boolean_t *tree_conflicted,
const char *path,
+ svn_boolean_t dir_was_added,
const apr_array_header_t *propchanges,
apr_hash_t *original_props,
void *diff_baton,
@@ -852,6 +853,7 @@ diff_dir_props_changed(const char *local
svn_wc_notify_state_t *state,
svn_boolean_t *tree_conflicted,
const char *path,
+ svn_boolean_t dir_was_added,
const apr_array_header_t *propchanges,
apr_hash_t *original_props,
void *diff_baton,
@@ -864,6 +866,7 @@ diff_dir_props_changed(const char *local
return svn_error_return(diff_props_changed(local_dir_abspath, state,
tree_conflicted, path,
+ dir_was_added,
propchanges,
original_props,
diff_baton,
@@ -1049,6 +1052,17 @@ diff_content_changed(const char *path,
return SVN_NO_ERROR;
}
+static svn_error_t *
+diff_file_opened(svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
+ const char *path,
+ svn_revnum_t rev,
+ void *diff_baton,
+ apr_pool_t *scratch_pool)
+{
+ return SVN_NO_ERROR;
+}
+
/* An svn_wc_diff_callbacks4_t function. */
static svn_error_t *
diff_file_changed(const char *local_dir_abspath,
@@ -1077,7 +1091,7 @@ diff_file_changed(const char *local_dir_
svn_diff_op_modified, NULL, diff_baton));
if (prop_changes->nelts > 0)
SVN_ERR(diff_props_changed(local_dir_abspath, prop_state, tree_conflicted,
- path, prop_changes,
+ path, FALSE, prop_changes,
original_props, diff_baton, scratch_pool));
if (content_state)
*content_state = svn_wc_notify_state_unknown;
@@ -1137,7 +1151,7 @@ diff_file_added(const char *local_dir_ab
svn_diff_op_added, NULL, diff_baton));
if (prop_changes->nelts > 0)
SVN_ERR(diff_props_changed(local_dir_abspath, prop_state, tree_conflicted,
- path, prop_changes,
+ path, FALSE, prop_changes,
original_props, diff_baton, scratch_pool));
if (content_state)
*content_state = svn_wc_notify_state_unknown;
@@ -1223,6 +1237,8 @@ static svn_error_t *
diff_dir_added(const char *local_dir_abspath,
svn_wc_notify_state_t *state,
svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
+ svn_boolean_t *skip_children,
const char *path,
svn_revnum_t rev,
const char *copyfrom_path,
@@ -1233,10 +1249,6 @@ diff_dir_added(const char *local_dir_abs
struct diff_cmd_baton *diff_cmd_baton = diff_baton;
if (diff_cmd_baton->anchor)
path = svn_dirent_join(diff_cmd_baton->anchor, path, scratch_pool);
- if (state)
- *state = svn_wc_notify_state_unknown;
- if (tree_conflicted)
- *tree_conflicted = FALSE;
/* Do nothing. */
@@ -1255,10 +1267,6 @@ diff_dir_deleted(const char *local_dir_a
struct diff_cmd_baton *diff_cmd_baton = diff_baton;
if (diff_cmd_baton->anchor)
path = svn_dirent_join(diff_cmd_baton->anchor, path, scratch_pool);
- if (state)
- *state = svn_wc_notify_state_unknown;
- if (tree_conflicted)
- *tree_conflicted = FALSE;
/* Do nothing. */
@@ -1269,19 +1277,16 @@ diff_dir_deleted(const char *local_dir_a
static svn_error_t *
diff_dir_opened(const char *local_dir_abspath,
svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
svn_boolean_t *skip_children,
const char *path,
svn_revnum_t rev,
void *diff_baton,
apr_pool_t *scratch_pool)
{
- struct diff_cmd_baton *diff_cmd_baton = diff_baton;
+ /*struct diff_cmd_baton *diff_cmd_baton = diff_baton;
if (diff_cmd_baton->anchor)
- path = svn_dirent_join(diff_cmd_baton->anchor, path, scratch_pool);
- if (tree_conflicted)
- *tree_conflicted = FALSE;
- if (skip_children)
- *skip_children = FALSE;
+ path = svn_dirent_join(diff_cmd_baton->anchor, path, scratch_pool);*/
/* Do nothing. */
@@ -1295,18 +1300,13 @@ diff_dir_closed(const char *local_dir_ab
svn_wc_notify_state_t *propstate,
svn_boolean_t *tree_conflicted,
const char *path,
+ svn_boolean_t dir_was_added,
void *diff_baton,
apr_pool_t *scratch_pool)
{
- struct diff_cmd_baton *diff_cmd_baton = diff_baton;
+ /*struct diff_cmd_baton *diff_cmd_baton = diff_baton;
if (diff_cmd_baton->anchor)
- path = svn_dirent_join(diff_cmd_baton->anchor, path, scratch_pool);
- if (contentstate)
- *contentstate = svn_wc_notify_state_unknown;
- if (propstate)
- *propstate = svn_wc_notify_state_unknown;
- if (tree_conflicted)
- *tree_conflicted = FALSE;
+ path = svn_dirent_join(diff_cmd_baton->anchor, path, scratch_pool);*/
/* Do nothing. */
@@ -1726,6 +1726,7 @@ diff_repos_repos(const svn_wc_diff_callb
callback_baton->revnum2 = rev2;
callback_baton->ra_session = ra_session;
+ callback_baton->anchor = base_path;
/* Now, we open an extra RA session to the correct anchor
location for URL1. This is used during the editor calls to fetch file
@@ -1736,13 +1737,14 @@ diff_repos_repos(const svn_wc_diff_callb
/* Set up the repos_diff editor on BASE_PATH, if available.
Otherwise, we just use "". */
- SVN_ERR(svn_client__get_diff_editor
- (base_path ? base_path : "",
- NULL, callbacks, callback_baton, depth,
- FALSE /* doesn't matter for diff */, extra_ra_session, rev1,
- NULL /* no notify_func */, NULL /* no notify_baton */,
- ctx->cancel_func, ctx->cancel_baton,
- &diff_editor, &diff_edit_baton, pool));
+ SVN_ERR(svn_client__get_diff_editor(
+ &diff_editor, &diff_edit_baton,
+ NULL, "", depth,
+ extra_ra_session, rev1, TRUE, FALSE,
+ callbacks, callback_baton,
+ ctx->cancel_func, ctx->cancel_baton,
+ NULL /* no notify_func */, NULL /* no notify_baton */,
+ pool, pool));
/* We want to switch our txn into URL2 */
SVN_ERR(svn_ra_do_diff3
@@ -2218,6 +2220,7 @@ svn_client_diff5(const apr_array_header_
peg_revision.kind = svn_opt_revision_unspecified;
/* setup callback and baton */
+ diff_callbacks.file_opened = diff_file_opened;
diff_callbacks.file_changed = diff_file_changed;
diff_callbacks.file_added = diff_file_added;
diff_callbacks.file_deleted = no_diff_deleted ? diff_file_deleted_no_diff :
@@ -2280,6 +2283,7 @@ svn_client_diff_peg5(const apr_array_hea
svn_wc_diff_callbacks4_t diff_callbacks;
/* setup callback and baton */
+ diff_callbacks.file_opened = diff_file_opened;
diff_callbacks.file_changed = diff_file_changed;
diff_callbacks.file_added = diff_file_added;
diff_callbacks.file_deleted = no_diff_deleted ? diff_file_deleted_no_diff :
Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1096738&r1=1096737&r2=1096738&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue Apr 26 12:23:37 2011
@@ -339,14 +339,6 @@ typedef struct merge_cmd_baton_t {
#define RECORD_MERGEINFO(merge_b) (HONOR_MERGEINFO(merge_b) \
&& !(merge_b)->dry_run)
-
-apr_hash_t *
-svn_client__dry_run_deletions(void *merge_cmd_baton)
-{
- merge_cmd_baton_t *merge_b = merge_cmd_baton;
- return merge_b->dry_run_deletions;
-}
-
/* Return true iff we're in dry-run mode and WCPATH would have been
deleted by now if we weren't in dry-run mode.
Used to avoid spurious notifications (e.g. conflicts) from a merge
@@ -1226,6 +1218,28 @@ merge_props_changed(const char *local_di
return SVN_NO_ERROR;
}
+/* An svn_wc_diff_callbacks4_t function. */
+static svn_error_t *
+merge_dir_props_changed(const char *local_dir_abspath,
+ svn_wc_notify_state_t *state,
+ svn_boolean_t *tree_conflicted,
+ const char *path,
+ svn_boolean_t dir_was_added,
+ const apr_array_header_t *propchanges,
+ apr_hash_t *original_props,
+ void *diff_baton,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_return(merge_props_changed(local_dir_abspath,
+ state,
+ tree_conflicted,
+ path,
+ propchanges,
+ original_props,
+ diff_baton,
+ scratch_pool));
+}
+
/* Contains any state collected while resolving conflicts. */
typedef struct conflict_resolver_baton_t
{
@@ -1284,6 +1298,18 @@ conflict_resolver(svn_wc_conflict_result
/* An svn_wc_diff_callbacks4_t function. */
static svn_error_t *
+merge_file_opened(svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
+ const char *path,
+ svn_revnum_t rev,
+ void *diff_baton,
+ apr_pool_t *scratch_pool)
+{
+ return SVN_NO_ERROR;
+}
+
+/* An svn_wc_diff_callbacks4_t function. */
+static svn_error_t *
merge_file_changed(const char *local_dir_abspath,
svn_wc_notify_state_t *content_state,
svn_wc_notify_state_t *prop_state,
@@ -1897,6 +1923,13 @@ merge_file_deleted(const char *local_dir
apr_pool_t *subpool = svn_pool_create(merge_b->pool);
svn_node_kind_t kind;
+ if (merge_b->dry_run)
+ {
+ const char *wcpath = apr_pstrdup(merge_b->pool, mine_abspath);
+ apr_hash_set(merge_b->dry_run_deletions, wcpath,
+ APR_HASH_KEY_STRING, wcpath);
+ }
+
/* Easy out: We are only applying mergeinfo differences. */
if (merge_b->record_only)
{
@@ -2020,6 +2053,8 @@ static svn_error_t *
merge_dir_added(const char *local_dir_abspath,
svn_wc_notify_state_t *state,
svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
+ svn_boolean_t *skip_children,
const char *local_abspath,
svn_revnum_t rev,
const char *copyfrom_path,
@@ -2252,6 +2287,13 @@ merge_dir_deleted(const char *local_dir_
svn_boolean_t is_versioned;
svn_boolean_t is_deleted;
+ if (merge_b->dry_run)
+ {
+ const char *wcpath = apr_pstrdup(merge_b->pool, local_abspath);
+ apr_hash_set(merge_b->dry_run_deletions, wcpath,
+ APR_HASH_KEY_STRING, wcpath);
+ }
+
/* Easy out: We are only applying mergeinfo differences. */
if (merge_b->record_only)
{
@@ -2262,7 +2304,6 @@ merge_dir_deleted(const char *local_dir_
*tree_conflicted = FALSE;
return SVN_NO_ERROR;
}
-
if (tree_conflicted)
*tree_conflicted = FALSE;
@@ -2402,6 +2443,7 @@ merge_dir_deleted(const char *local_dir_
static svn_error_t *
merge_dir_opened(const char *local_dir_abspath,
svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
svn_boolean_t *skip_children,
const char *path,
svn_revnum_t rev,
@@ -2558,9 +2600,11 @@ merge_dir_closed(const char *local_dir_a
svn_wc_notify_state_t *propstate,
svn_boolean_t *tree_conflicted,
const char *path,
+ svn_boolean_t dir_was_added,
void *baton,
apr_pool_t *scratch_pool)
{
+ merge_cmd_baton_t *merge_b = baton;
if (contentstate)
*contentstate = svn_wc_notify_state_unknown;
if (propstate)
@@ -2568,7 +2612,8 @@ merge_dir_closed(const char *local_dir_a
if (tree_conflicted)
*tree_conflicted = FALSE;
- /* Nothing to be done. */
+ if (merge_b->dry_run)
+ svn_hash__clear(merge_b->dry_run_deletions, scratch_pool);
return SVN_NO_ERROR;
}
@@ -2577,13 +2622,14 @@ merge_dir_closed(const char *local_dir_a
static const svn_wc_diff_callbacks4_t
merge_callbacks =
{
+ merge_file_opened,
merge_file_changed,
merge_file_added,
merge_file_deleted,
- merge_dir_added,
merge_dir_deleted,
- merge_props_changed,
merge_dir_opened,
+ merge_dir_added,
+ merge_dir_props_changed,
merge_dir_closed
};
@@ -5046,15 +5092,16 @@ drive_merge_report_editor(const char *ta
/* Get the diff editor and a reporter with which to, ultimately,
drive it. */
- SVN_ERR(svn_client__get_diff_editor(target_abspath, merge_b->ctx->wc_ctx,
- &merge_callbacks, merge_b, depth,
- merge_b->dry_run,
+ SVN_ERR(svn_client__get_diff_editor(&diff_editor, &diff_edit_baton,
+ merge_b->ctx->wc_ctx, target_abspath,
+ depth,
merge_b->ra_session2, revision1,
- notification_receiver, notify_b,
+ FALSE, merge_b->dry_run,
+ &merge_callbacks, merge_b,
merge_b->ctx->cancel_func,
merge_b->ctx->cancel_baton,
- &diff_editor, &diff_edit_baton,
- pool));
+ notification_receiver, notify_b,
+ pool, pool));
SVN_ERR(svn_ra_do_diff3(merge_b->ra_session1,
&reporter, &report_baton, revision2,
"", depth, merge_b->ignore_ancestry,
Modified: subversion/trunk/subversion/libsvn_client/repos_diff.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/repos_diff.c?rev=1096738&r1=1096737&r2=1096738&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/repos_diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/repos_diff.c Tue Apr 26 12:23:37
2011
@@ -70,10 +70,6 @@ struct edit_baton {
/* RA_SESSION is the open session for making requests to the RA layer */
svn_ra_session_t *ra_session;
- /* TRUE if RA_SESSION is open to a repository URL using the http or https
- scheme. */
- svn_boolean_t is_dav_session;
-
/* The rev1 from the '-r Rev1:Rev2' command line option */
svn_revnum_t revision;
@@ -637,24 +633,13 @@ delete_entry(const char *path,
&& !tree_conflicted)
{
action = svn_wc_notify_update_delete;
- if (eb->dry_run)
- {
- /* Remember what we _would've_ deleted (issue #2584). */
- const char *wcpath = svn_dirent_join(eb->target, path, pb->pool);
- apr_hash_set(svn_client__dry_run_deletions(eb->diff_cmd_baton),
- wcpath, APR_HASH_KEY_STRING, wcpath);
-
- /* ### TODO: if (kind == svn_node_dir), record all
- ### children as deleted to avoid collisions from
- ### subsequent edits. */
- }
}
}
if (eb->notify_func)
{
const char* deleted_path;
- deleted_path_notify_t *dpn = apr_palloc(eb->pool, sizeof(*dpn));
+ deleted_path_notify_t *dpn = apr_pcalloc(eb->pool, sizeof(*dpn));
deleted_path = svn_dirent_join(eb->target, path, eb->pool);
dpn->kind = kind;
dpn->action = tree_conflicted ? svn_wc_notify_tree_conflict : action;
@@ -699,10 +684,11 @@ add_directory(const char *path,
SVN_ERR(get_dir_abspath(&local_dir_abspath, eb->wc_ctx, pb->wcpath, TRUE,
pool));
- SVN_ERR(eb->diff_callbacks->dir_added
- (local_dir_abspath, &state, &b->tree_conflicted, b->wcpath,
- eb->target_revision, copyfrom_path, copyfrom_revision,
- eb->diff_cmd_baton, pool));
+ SVN_ERR(eb->diff_callbacks->dir_added(
+ local_dir_abspath, &state, &b->tree_conflicted,
+ &b->skip, &b->skip_children, b->wcpath,
+ eb->target_revision, copyfrom_path, copyfrom_revision,
+ eb->diff_cmd_baton, pool));
/* Notifications for directories are done at close_directory time.
* But for paths at which the editor drive adds directories, we make an
@@ -788,9 +774,10 @@ open_directory(const char *path,
SVN_ERR(get_dir_abspath(&local_dir_abspath, eb->wc_ctx, pb->wcpath, TRUE,
pool));
- SVN_ERR(eb->diff_callbacks->dir_opened
- (local_dir_abspath, &b->tree_conflicted, &b->skip_children,
- b->wcpath, base_revision, b->edit_baton->diff_cmd_baton, pool));
+ SVN_ERR(eb->diff_callbacks->dir_opened(
+ local_dir_abspath, &b->tree_conflicted, &b->skip,
+ &b->skip_children, b->wcpath, base_revision,
+ b->edit_baton->diff_cmd_baton, pool));
return SVN_NO_ERROR;
}
@@ -837,6 +824,7 @@ open_file(const char *path,
{
struct dir_baton *pb = parent_baton;
struct file_baton *b;
+ struct edit_baton *eb = pb->edit_baton;
b = make_file_baton(path, FALSE, pb->edit_baton, pool);
*file_baton = b;
@@ -848,6 +836,13 @@ open_file(const char *path,
return SVN_NO_ERROR;
}
+ SVN_ERR(eb->diff_callbacks->file_opened(
+ &b->tree_conflicted, &b->skip,
+ b->wcpath, base_revision, eb->diff_cmd_baton, pool));
+
+ if (b->skip)
+ return SVN_NO_ERROR;
+
SVN_ERR(get_file_from_ra(b, base_revision));
return SVN_NO_ERROR;
@@ -1104,10 +1099,6 @@ close_directory(void *dir_baton,
if (b->skip)
return SVN_NO_ERROR;
- if (eb->dry_run)
- SVN_ERR(svn_hash__clear(svn_client__dry_run_deletions(eb->diff_cmd_baton),
- pool));
-
err = get_dir_abspath(&local_dir_abspath, eb->wc_ctx, b->wcpath,
FALSE, b->pool);
@@ -1141,19 +1132,20 @@ close_directory(void *dir_baton,
have been recognised as added, in which case they cannot conflict. */
if ((b->propchanges->nelts > 0) && (! eb->dry_run || local_dir_abspath))
{
- svn_boolean_t tree_conflicted;
- SVN_ERR(eb->diff_callbacks->dir_props_changed
- (local_dir_abspath, &prop_state, &tree_conflicted,
- b->wcpath,
+ svn_boolean_t tree_conflicted = FALSE;
+ SVN_ERR(eb->diff_callbacks->dir_props_changed(
+ local_dir_abspath, &prop_state, &tree_conflicted,
+ b->wcpath, b->added,
b->propchanges, b->pristine_props,
b->edit_baton->diff_cmd_baton, pool));
if (tree_conflicted)
b->tree_conflicted = TRUE;
}
- SVN_ERR(eb->diff_callbacks->dir_closed
- (local_dir_abspath, NULL, NULL, NULL,
- b->wcpath, b->edit_baton->diff_cmd_baton, pool));
+ SVN_ERR(eb->diff_callbacks->dir_closed(
+ local_dir_abspath, NULL, NULL, NULL,
+ b->wcpath, b->added,
+ b->edit_baton->diff_cmd_baton, pool));
/* Don't notify added directories as they triggered notification
in add_directory. */
@@ -1239,10 +1231,12 @@ change_file_prop(void *file_baton,
See http://subversion.tigris.org/issues/show_bug.cgi?id=3657#desc9 and
http://svn.haxx.se/dev/archive-2010-08/0351.shtml for more details. */
- if (value && b->edit_baton->is_dav_session)
+ if (value)
{
- const char *current_prop = svn_prop_get_value(b->pristine_props, name);
- if (current_prop && strcmp(current_prop, value->data) == 0)
+ svn_string_t *old_val = apr_hash_get(b->pristine_props, name,
+ APR_HASH_KEY_STRING);
+
+ if (old_val && svn_string_compare(old_val, value) == 0)
return SVN_NO_ERROR;
}
@@ -1268,11 +1262,12 @@ change_dir_prop(void *dir_baton,
return SVN_NO_ERROR;
/* See the comment re issue #3657 in the change_file_prop() callback. */
- if (value && db->edit_baton->is_dav_session)
+ if (value)
{
- const char *current_prop = svn_prop_get_value(db->pristine_props,
- name);
- if (current_prop && strcmp(current_prop, value->data) == 0)
+ svn_string_t *old_val = apr_hash_get(db->pristine_props, name,
+ APR_HASH_KEY_STRING);
+
+ if (old_val && svn_string_compare(old_val, value) == 0)
return SVN_NO_ERROR;
}
@@ -1355,32 +1350,32 @@ absent_file(const char *path,
/* Create a repository diff editor and baton. */
svn_error_t *
-svn_client__get_diff_editor(const char *target,
+svn_client__get_diff_editor(const svn_delta_editor_t **editor,
+ void **edit_baton,
svn_wc_context_t *wc_ctx,
- const svn_wc_diff_callbacks4_t *diff_callbacks,
- void *diff_cmd_baton,
+ const char *target,
svn_depth_t depth,
- svn_boolean_t dry_run,
svn_ra_session_t *ra_session,
svn_revnum_t revision,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
+ svn_boolean_t walk_deleted_dirs,
+ svn_boolean_t dry_run,
+ const svn_wc_diff_callbacks4_t *diff_callbacks,
+ void *diff_cmd_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
- const svn_delta_editor_t **editor,
- void **edit_baton,
- apr_pool_t *pool)
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- apr_pool_t *subpool = svn_pool_create(pool);
- svn_delta_editor_t *tree_editor = svn_delta_default_editor(subpool);
- struct edit_baton *eb = apr_palloc(subpool, sizeof(*eb));
+ apr_pool_t *editor_pool = svn_pool_create(result_pool);
+ svn_delta_editor_t *tree_editor = svn_delta_default_editor(editor_pool);
+ struct edit_baton *eb = apr_pcalloc(editor_pool, sizeof(*eb));
const char *target_abspath;
- const char *session_url;
- apr_status_t status;
- apr_uri_t apr_uri;
- SVN_ERR(svn_dirent_get_absolute(&target_abspath, target, pool));
+ SVN_ERR(svn_dirent_get_absolute(&target_abspath, target, editor_pool));
+ eb->pool = editor_pool;
eb->target = target;
eb->wc_ctx = wc_ctx;
eb->diff_callbacks = diff_callbacks;
@@ -1388,30 +1383,13 @@ svn_client__get_diff_editor(const char *
eb->dry_run = dry_run;
eb->ra_session = ra_session;
- SVN_ERR(svn_ra_get_session_url(ra_session, &session_url, subpool));
- status = apr_uri_parse(subpool, session_url, &apr_uri);
- if (status)
- {
- return svn_error_createf(SVN_ERR_BAD_URL, NULL,
- _("Unable to parse URL '%s'"), session_url);
- }
- else
- {
- if (svn_cstring_casecmp(apr_uri.scheme, "https") == 0
- || svn_cstring_casecmp(apr_uri.scheme, "http") == 0)
- eb->is_dav_session = TRUE;
- else
- eb->is_dav_session = FALSE;
- }
-
eb->revision = revision;
eb->empty_file = NULL;
- eb->empty_hash = apr_hash_make(subpool);
- eb->deleted_paths = apr_hash_make(subpool);
- eb->pool = subpool;
+ eb->empty_hash = apr_hash_make(eb->pool);
+ eb->deleted_paths = apr_hash_make(eb->pool);
eb->notify_func = notify_func;
eb->notify_baton = notify_baton;
- eb->walk_deleted_repos_dirs = TRUE;
+ eb->walk_deleted_repos_dirs = walk_deleted_dirs;
eb->cancel_func = cancel_func;
eb->cancel_baton = cancel_baton;
@@ -1437,7 +1415,5 @@ svn_client__get_diff_editor(const char *
eb,
editor,
edit_baton,
- pool);
-
- /* We don't destroy subpool, as it's managed by the edit baton. */
+ eb->pool);
}
Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1096738&r1=1096737&r2=1096738&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Tue Apr 26 12:23:37 2011
@@ -1579,6 +1579,17 @@ struct diff_callbacks3_wrapper_baton {
const char *anchor_abspath;
};
+static svn_error_t *
+wrap_4to3_file_opened(svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
+ const char *path,
+ svn_revnum_t rev,
+ void *diff_baton,
+ apr_pool_t *scratch_pool)
+{
+ return SVN_NO_ERROR;
+}
+
/* An svn_wc_diff_callbacks4_t function for wrapping
* svn_wc_diff_callbacks3_t. */
static svn_error_t *
@@ -1693,6 +1704,8 @@ static svn_error_t *
wrap_4to3_dir_added(const char *local_dir_abspath,
svn_wc_notify_state_t *state,
svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
+ svn_boolean_t *skip_children,
const char *path,
svn_revnum_t rev,
const char *copyfrom_path,
@@ -1745,6 +1758,7 @@ wrap_4to3_dir_props_changed(const char *
svn_wc_notify_state_t *propstate,
svn_boolean_t *tree_conflicted,
const char *path,
+ svn_boolean_t dir_was_added,
const apr_array_header_t *propchanges,
apr_hash_t *original_props,
void *diff_baton,
@@ -1771,6 +1785,7 @@ wrap_4to3_dir_props_changed(const char *
static svn_error_t *
wrap_4to3_dir_opened(const char *local_dir_abspath,
svn_boolean_t *tree_conflicted,
+ svn_boolean_t *skip,
svn_boolean_t *skip_children,
const char *path,
svn_revnum_t rev,
@@ -1801,6 +1816,7 @@ wrap_4to3_dir_closed(const char *local_d
svn_wc_notify_state_t *propstate,
svn_boolean_t *tree_conflicted,
const char *path,
+ svn_boolean_t dir_was_added,
void *diff_baton,
apr_pool_t *scratch_pool)
{
@@ -1822,13 +1838,14 @@ wrap_4to3_dir_closed(const char *local_d
/* Used to wrap svn_diff_callbacks3_t as an svn_wc_diff_callbacks4_t. */
static struct svn_wc_diff_callbacks4_t diff_callbacks3_wrapper = {
+ wrap_4to3_file_opened,
wrap_4to3_file_changed,
wrap_4to3_file_added,
wrap_4to3_file_deleted,
- wrap_4to3_dir_added,
wrap_4to3_dir_deleted,
- wrap_4to3_dir_props_changed,
wrap_4to3_dir_opened,
+ wrap_4to3_dir_added,
+ wrap_4to3_dir_props_changed,
wrap_4to3_dir_closed
};
Modified: subversion/trunk/subversion/libsvn_wc/diff.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff.c?rev=1096738&r1=1096737&r2=1096738&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff.c Tue Apr 26 12:23:37 2011
@@ -826,7 +826,7 @@ walk_local_nodes_diff(struct edit_baton
SVN_ERR(eb->callbacks->dir_props_changed(local_abspath,
NULL, NULL,
- path,
+ path, FALSE /* ### ? */,
propchanges, baseprops,
eb->callback_baton,
scratch_pool));
@@ -1072,7 +1072,7 @@ report_wc_directory_as_added(struct edit
if (propchanges->nelts > 0)
SVN_ERR(eb->callbacks->dir_props_changed(local_abspath,
NULL, NULL,
- path,
+ path, TRUE,
propchanges, emptyprops,
eb->callback_baton,
scratch_pool));
@@ -1311,6 +1311,10 @@ open_directory(const char *path,
db = make_dir_baton(path, pb, pb->eb, FALSE, subdir_depth, dir_pool);
*child_baton = db;
+ SVN_ERR(db->eb->callbacks->dir_opened(NULL, NULL, NULL, NULL,
+ path, base_revision,
+ db->eb->callback_baton, dir_pool));
+
return SVN_NO_ERROR;
}
@@ -1373,6 +1377,7 @@ close_directory(void *dir_baton,
SVN_ERR(eb->callbacks->dir_props_changed(NULL, NULL, NULL,
db->path,
+ db->added,
db->propchanges,
originalprops,
eb->callback_baton,
@@ -1401,6 +1406,10 @@ close_directory(void *dir_baton,
apr_hash_set(pb->compared, apr_pstrdup(pb->pool, db->path),
APR_HASH_KEY_STRING, "");
+ SVN_ERR(db->eb->callbacks->dir_closed(NULL, NULL, NULL, NULL, db->path,
+ db->added, db->eb->callback_baton,
+ db->pool));
+
return SVN_NO_ERROR;
}
@@ -1455,6 +1464,9 @@ open_file(const char *path,
eb->db, fb->local_abspath,
fb->pool, fb->pool));
+ SVN_ERR(eb->callbacks->file_opened(NULL, NULL, fb->path, base_revision,
+ eb->callback_baton, fb->pool));
+
return SVN_NO_ERROR;
}