diff options
Diffstat (limited to 'subversion/libsvn_wc/revert.c')
-rw-r--r-- | subversion/libsvn_wc/revert.c | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/subversion/libsvn_wc/revert.c b/subversion/libsvn_wc/revert.c index bba1799864ab..28a17f091a82 100644 --- a/subversion/libsvn_wc/revert.c +++ b/subversion/libsvn_wc/revert.c @@ -62,6 +62,18 @@ the addition of all the directory's children. Again, svn_wc_remove_from_revision_control() should do the trick. + - For a copy, we remove the item from disk as well. The thinking here + is that Subversion is responsible for the existence of the item: it + must have been created by something like 'svn copy' or 'svn merge'. + + - For a plain add, removing the file or directory from disk is optional. + The user's idea of Subversion's involvement could be either that + Subversion was just responsible for adding an existing item to version + control, as with 'svn add', and so should not be responsible for + deleting it from disk; or that Subversion is responsible for the + existence of the item, e.g. if created by 'svn patch' or svn mkdir'. + It depends on the use case. + Deletes - Restore properties to their unmodified state. @@ -285,6 +297,7 @@ revert_restore(svn_boolean_t *run_wq, svn_boolean_t metadata_only, svn_boolean_t use_commit_times, svn_boolean_t revert_root, + svn_boolean_t added_keep_local, const struct svn_wc__db_info_t *info, svn_cancel_func_t cancel_func, void *cancel_baton, @@ -344,8 +357,9 @@ revert_restore(svn_boolean_t *run_wq, } else { - if (!copied_here) + if (added_keep_local && !copied_here) { + /* It is a plain add, and we want to keep the local file/dir. */ if (notify_func && notify_required) notify_func(notify_baton, svn_wc_create_notify(local_abspath, @@ -359,8 +373,17 @@ revert_restore(svn_boolean_t *run_wq, scratch_pool)); return SVN_NO_ERROR; } + else if (!copied_here) + { + /* It is a plain add, and we don't want to keep the local file/dir. */ + status = svn_wc__db_status_not_present; + kind = svn_node_none; + recorded_size = SVN_INVALID_FILESIZE; + recorded_time = 0; + } else { + /* It is a copy, so we don't want to keep the local file/dir. */ /* ### Initialise to values which prevent the code below from * ### trying to restore anything to disk. * ### 'status' should be status_unknown but that doesn't exist. */ @@ -429,6 +452,7 @@ revert_restore(svn_boolean_t *run_wq, SVN_ERR(revert_restore(run_wq, db, child_abspath, depth, metadata_only, use_commit_times, FALSE /* revert root */, + added_keep_local, apr_hash_this_val(hi), cancel_func, cancel_baton, notify_func, notify_baton, @@ -536,11 +560,7 @@ revert_wc_data(svn_boolean_t *run_wq, /* If we expect a versioned item to be present then check that any item on disk matches the versioned item, if it doesn't match then fix it or delete it. */ - if (on_disk != svn_node_none - && status != svn_wc__db_status_server_excluded - && status != svn_wc__db_status_deleted - && status != svn_wc__db_status_excluded - && status != svn_wc__db_status_not_present) + if (on_disk != svn_node_none) { if (on_disk == svn_node_dir && kind != svn_node_dir) { @@ -560,7 +580,11 @@ revert_wc_data(svn_boolean_t *run_wq, on_disk = svn_node_none; } } - else if (on_disk == svn_node_file) + else if (on_disk == svn_node_file + && status != svn_wc__db_status_server_excluded + && status != svn_wc__db_status_deleted + && status != svn_wc__db_status_excluded + && status != svn_wc__db_status_not_present) { svn_boolean_t modified; apr_hash_t *props; @@ -712,6 +736,7 @@ revert(svn_wc__db_t *db, svn_boolean_t use_commit_times, svn_boolean_t clear_changelists, svn_boolean_t metadata_only, + svn_boolean_t added_keep_local, svn_cancel_func_t cancel_func, void *cancel_baton, svn_wc_notify_func2_t notify_func, @@ -762,6 +787,7 @@ revert(svn_wc__db_t *db, err = svn_error_trace( revert_restore(&run_queue, db, local_abspath, depth, metadata_only, use_commit_times, TRUE /* revert root */, + added_keep_local, info, cancel_func, cancel_baton, notify_func, notify_baton, scratch_pool)); @@ -791,6 +817,7 @@ revert_changelist(svn_wc__db_t *db, apr_hash_t *changelist_hash, svn_boolean_t clear_changelists, svn_boolean_t metadata_only, + svn_boolean_t added_keep_local, svn_cancel_func_t cancel_func, void *cancel_baton, svn_wc_notify_func2_t notify_func, @@ -809,7 +836,7 @@ revert_changelist(svn_wc__db_t *db, scratch_pool)) SVN_ERR(revert(db, local_abspath, svn_depth_empty, use_commit_times, clear_changelists, - metadata_only, + metadata_only, added_keep_local, cancel_func, cancel_baton, notify_func, notify_baton, scratch_pool)); @@ -845,6 +872,7 @@ revert_changelist(svn_wc__db_t *db, SVN_ERR(revert_changelist(db, child_abspath, depth, use_commit_times, changelist_hash, clear_changelists, metadata_only, + added_keep_local, cancel_func, cancel_baton, notify_func, notify_baton, iterpool)); @@ -871,6 +899,7 @@ revert_partial(svn_wc__db_t *db, svn_boolean_t use_commit_times, svn_boolean_t clear_changelists, svn_boolean_t metadata_only, + svn_boolean_t added_keep_local, svn_cancel_func_t cancel_func, void *cancel_baton, svn_wc_notify_func2_t notify_func, @@ -892,6 +921,7 @@ revert_partial(svn_wc__db_t *db, children. */ SVN_ERR(revert(db, local_abspath, svn_depth_empty, use_commit_times, clear_changelists, metadata_only, + added_keep_local, cancel_func, cancel_baton, notify_func, notify_baton, iterpool)); @@ -926,7 +956,7 @@ revert_partial(svn_wc__db_t *db, /* Revert just this node (depth=empty). */ SVN_ERR(revert(db, child_abspath, svn_depth_empty, use_commit_times, clear_changelists, - metadata_only, + metadata_only, added_keep_local, cancel_func, cancel_baton, notify_func, notify_baton, iterpool)); @@ -939,13 +969,14 @@ revert_partial(svn_wc__db_t *db, svn_error_t * -svn_wc_revert5(svn_wc_context_t *wc_ctx, +svn_wc_revert6(svn_wc_context_t *wc_ctx, const char *local_abspath, svn_depth_t depth, svn_boolean_t use_commit_times, const apr_array_header_t *changelist_filter, svn_boolean_t clear_changelists, svn_boolean_t metadata_only, + svn_boolean_t added_keep_local, svn_cancel_func_t cancel_func, void *cancel_baton, svn_wc_notify_func2_t notify_func, @@ -963,6 +994,7 @@ svn_wc_revert5(svn_wc_context_t *wc_ctx, changelist_hash, clear_changelists, metadata_only, + added_keep_local, cancel_func, cancel_baton, notify_func, notify_baton, scratch_pool)); @@ -972,6 +1004,7 @@ svn_wc_revert5(svn_wc_context_t *wc_ctx, return svn_error_trace(revert(wc_ctx->db, local_abspath, depth, use_commit_times, clear_changelists, metadata_only, + added_keep_local, cancel_func, cancel_baton, notify_func, notify_baton, scratch_pool)); @@ -986,6 +1019,7 @@ svn_wc_revert5(svn_wc_context_t *wc_ctx, return svn_error_trace(revert_partial(wc_ctx->db, local_abspath, depth, use_commit_times, clear_changelists, metadata_only, + added_keep_local, cancel_func, cancel_baton, notify_func, notify_baton, scratch_pool)); |