You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/02/04 09:36:21 UTC
svn commit: r1657026 - in /subversion/trunk/subversion:
bindings/javahl/native/ bindings/javahl/src/org/apache/subversion/javahl/
include/ libsvn_client/ libsvn_wc/ svn/ tests/libsvn_wc/
Author: rhuijben
Date: Wed Feb 4 08:36:20 2015
New Revision: 1657026
URL: http://svn.apache.org/r1657026
Log:
As we are revving svn_client_revert() for 1.9 anyway, now is the time to
give it a 'metadata_only' flag, like we have on copy and move.
This helps gui clients that should record changes after they occured, who
don't want to revert local changes just to re-apply them using the Subversion
function. (And thereby avoiding file lock challenges on Windows)
Note that some of the refactoring in this patch is preparation for a
followup performance patch for reverting huge trees (like entire WC).
* subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
(Java_org_apache_subversion_javahl_SVNClient_revert): Add another boolean.
* subversion/bindings/javahl/native/SVNClient.cpp
(SVNClient::revert): Forward metadata_only.
* subversion/bindings/javahl/native/SVNClient.h
(SVNClient::revert): Add metadata_only boolean.
* subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
(revert): Add and document argument.
* subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
(revert): Add argument (3*)
* subversion/include/svn_client.h
(svn_client_revert3): Add and document argument.
(svn_client_revert2): Document behavior of new argument.
* subversion/include/svn_wc.h
(svn_wc_revert5): Add and document argument.
(svn_wc_revert4): Document behavior of new argument.
* subversion/libsvn_client/deprecated.c
(svn_client_revert2): Update caller.
* subversion/libsvn_client/revert.c
(revert_with_write_lock_baton): Add flag.
(revert): Update caller. Pass error to notify.
(svn_client_revert3): Add argument. Properly use iterpool.
Update caller.
* subversion/libsvn_wc/deprecated.c
(svn_wc_revert4): Update caller.
* subversion/libsvn_wc/revert.c
(revert_wc_data): Add prototype.
(revert_restore): Add argument. Extract the non metadata work
code to revert_wc_data.
(revert_wc_data): New function. Placed below revert_restore to
minimize changes to this file in this patch.
* subversion/svn/revert-cmd.c
(svn_cl__revert): Update caller.
* subversion/tests/libsvn_wc/utils.c
(sbox_wc_revert): Update caller.
Modified:
subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
subversion/trunk/subversion/bindings/javahl/native/SVNClient.h
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
subversion/trunk/subversion/include/svn_client.h
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/deprecated.c
subversion/trunk/subversion/libsvn_client/revert.c
subversion/trunk/subversion/libsvn_wc/deprecated.c
subversion/trunk/subversion/libsvn_wc/revert.c
subversion/trunk/subversion/svn/revert-cmd.c
subversion/trunk/subversion/tests/libsvn_wc/utils.c
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Wed Feb 4 08:36:20 2015
@@ -339,7 +339,8 @@ void SVNClient::remove(Targets &targets,
void SVNClient::revert(StringArray &paths, svn_depth_t depth,
StringArray &changelists,
- bool clear_changelists)
+ bool clear_changelists,
+ bool metadata_only)
{
SVN::Pool subPool(pool);
@@ -352,6 +353,7 @@ void SVNClient::revert(StringArray &path
SVN_JNI_ERR(svn_client_revert3(targets.array(subPool), depth,
changelists.array(subPool),
clear_changelists,
+ metadata_only,
ctx, subPool.getPool()), );
}
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.h?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.h Wed Feb 4 08:36:20 2015
@@ -161,7 +161,7 @@ class SVNClient :public SVNBase
void add(const char *path, svn_depth_t depth, bool force,
bool no_ignore, bool no_autoprops, bool add_parents);
void revert(StringArray &paths, svn_depth_t depth, StringArray &changelists,
- bool clear_changelists);
+ bool clear_changelists, bool metadata_only);
void remove(Targets &targets, CommitMessage *message, bool force,
bool keep_local, PropertyTable &revprops,
CommitCallback *callback);
Modified: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Wed Feb 4 08:36:20 2015
@@ -439,7 +439,7 @@ Java_org_apache_subversion_javahl_SVNCli
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_revert
(JNIEnv *env, jobject jthis, jobject jpaths, jobject jdepth,
- jobject jchangelists, jboolean jclear_changelists)
+ jobject jchangelists, jboolean jclear_changelists, jboolean jmetadata_only)
{
JNIEntry(SVNClient, revert);
SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -459,7 +459,7 @@ Java_org_apache_subversion_javahl_SVNCli
return;
cl->revert(paths, EnumMapper::toDepth(jdepth),
- changelists, bool(jclear_changelists));
+ changelists, bool(jclear_changelists), bool(jmetadata_only));
}
JNIEXPORT void JNICALL
Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Wed Feb 4 08:36:20 2015
@@ -261,12 +261,15 @@ public interface ISVNClient
* @param changelists changelists to filter by
* @param clearChangelists If set, will clear changelist association
* from the reverted paths.
+ * @param metadataOnly Revert just the metadata (including conflict data)
+ * and not the working files/dirs
* @throws ClientException
* @since 1.9
*/
void revert(Set<String> paths, Depth depth,
Collection<String> changelists,
- boolean clearChangelists)
+ boolean clearChangelists,
+ boolean metadataOnly)
throws ClientException;
/**
Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Wed Feb 4 08:36:20 2015
@@ -194,21 +194,22 @@ public class SVNClient implements ISVNCl
public native void revert(Set<String> paths, Depth depth,
Collection<String> changelists,
- boolean clearChangelists)
+ boolean clearChangelists,
+ boolean metadataOnly)
throws ClientException;
public void revert(Set<String> paths, Depth depth,
Collection<String> changelists)
throws ClientException
{
- revert(paths, depth, changelists, false);
+ revert(paths, depth, changelists, false, false);
}
public void revert(String path, Depth depth,
Collection<String> changelists)
throws ClientException
{
- revert(Collections.singleton(path), depth, changelists, false);
+ revert(Collections.singleton(path), depth, changelists, false, false);
}
public native void add(String path, Depth depth, boolean force,
Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Wed Feb 4 08:36:20 2015
@@ -4289,6 +4289,10 @@ svn_client_relocate(const char *dir,
* If @a clear_changelists is TRUE, then changelist information for the
* paths is cleared while reverting.
*
+ * If @a metadata_only is TRUE, the files and directories aren't changed
+ * by the operation. If there are conflict marker files attached to the
+ * targets these are removed.
+ *
* If @a ctx->notify_func2 is non-NULL, then for each item reverted,
* call @a ctx->notify_func2 with @a ctx->notify_baton2 and the path of
* the reverted item.
@@ -4304,11 +4308,12 @@ svn_client_revert3(const apr_array_heade
svn_depth_t depth,
const apr_array_header_t *changelists,
svn_boolean_t clear_changelists,
+ svn_boolean_t metadata_only,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
/** Similar to svn_client_revert2, but with @a clear_changelists set to
- * FALSE.
+ * FALSE and @a metadata_only set to FALSE.
*
* @since New in 1.5.
* @deprecated Provided for backwards compatibility with the 1.8 API.
Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Wed Feb 4 08:36:20 2015
@@ -7539,6 +7539,10 @@ svn_wc_relocate(const char *path,
* If @a clear_changelists is TRUE, then changelist information for the
* paths is cleared.
*
+ * If @a metadata_only is TRUE, the working copy files are untouched, but
+ * if there are conflict marker files attached to these files these
+ * markers are removed.
+ *
* If @a cancel_func is non-NULL, call it with @a cancel_baton at
* various points during the reversion process. If it returns an
* error (typically #SVN_ERR_CANCELLED), return that error
@@ -7564,6 +7568,7 @@ svn_wc_revert5(svn_wc_context_t *wc_ctx,
svn_boolean_t use_commit_times,
const apr_array_header_t *changelist_filter,
svn_boolean_t clear_changelists,
+ svn_boolean_t metadata_only,
svn_cancel_func_t cancel_func,
void *cancel_baton,
svn_wc_notify_func2_t notify_func,
@@ -7571,7 +7576,7 @@ svn_wc_revert5(svn_wc_context_t *wc_ctx,
apr_pool_t *scratch_pool);
/** Similar to svn_wc_revert5() but with @a clear_changelists always set to
- * FALSE.
+ * FALSE and @a metadata_only set to FALSE.
*
* @since New in 1.7.
* @deprecated Provided for backward compatibility with the 1.8 API.
Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Wed Feb 4 08:36:20 2015
@@ -2821,6 +2821,7 @@ svn_client_revert2(const apr_array_heade
depth,
changelists,
FALSE /* clear_changelists */,
+ FALSE /* metadata_only */,
ctx,
pool));
}
Modified: subversion/trunk/subversion/libsvn_client/revert.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/revert.c?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/revert.c (original)
+++ subversion/trunk/subversion/libsvn_client/revert.c Wed Feb 4 08:36:20 2015
@@ -50,6 +50,7 @@ struct revert_with_write_lock_baton {
svn_boolean_t use_commit_times;
const apr_array_header_t *changelists;
svn_boolean_t clear_changelists;
+ svn_boolean_t metadata_only;
svn_client_ctx_t *ctx;
};
@@ -85,6 +86,7 @@ revert(void *baton, apr_pool_t *result_p
b->use_commit_times,
b->changelists,
b->clear_changelists,
+ b->metadata_only,
b->ctx->cancel_func, b->ctx->cancel_baton,
b->ctx->notify_func2, b->ctx->notify_baton2,
scratch_pool);
@@ -98,11 +100,18 @@ revert(void *baton, apr_pool_t *result_p
|| err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
{
if (b->ctx->notify_func2)
- b->ctx->notify_func2(
- b->ctx->notify_baton2,
- svn_wc_create_notify(b->local_abspath, svn_wc_notify_skip,
- scratch_pool),
- scratch_pool);
+ {
+ svn_wc_notify_t *notify;
+
+ notify = svn_wc_create_notify(b->local_abspath,
+ svn_wc_notify_skip,
+ scratch_pool);
+
+ notify->err = err;
+
+ b->ctx->notify_func2(b->ctx->notify_baton2,
+ notify, scratch_pool);
+ }
svn_error_clear(err);
}
else
@@ -118,10 +127,11 @@ svn_client_revert3(const apr_array_heade
svn_depth_t depth,
const apr_array_header_t *changelists,
svn_boolean_t clear_changelists,
+ svn_boolean_t metadata_only,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- apr_pool_t *subpool;
+ apr_pool_t *iterpool;
svn_error_t *err = SVN_NO_ERROR;
int i;
svn_config_t *cfg;
@@ -148,7 +158,7 @@ svn_client_revert3(const apr_array_heade
SVN_CONFIG_OPTION_USE_COMMIT_TIMES,
FALSE));
- subpool = svn_pool_create(pool);
+ iterpool = svn_pool_create(pool);
for (i = 0; i < paths->nelts; i++)
{
@@ -156,14 +166,14 @@ svn_client_revert3(const apr_array_heade
const char *local_abspath, *lock_target;
svn_boolean_t wc_root;
- svn_pool_clear(subpool);
+ svn_pool_clear(iterpool);
/* See if we've been asked to cancel this operation. */
if ((ctx->cancel_func)
&& ((err = ctx->cancel_func(ctx->cancel_baton))))
goto errorful;
- err = svn_dirent_get_absolute(&local_abspath, path, pool);
+ err = svn_dirent_get_absolute(&local_abspath, path, iterpool);
if (err)
goto errorful;
@@ -172,15 +182,17 @@ svn_client_revert3(const apr_array_heade
baton.use_commit_times = use_commit_times;
baton.changelists = changelists;
baton.clear_changelists = clear_changelists;
+ baton.metadata_only = metadata_only;
baton.ctx = ctx;
- err = svn_wc__is_wcroot(&wc_root, ctx->wc_ctx, local_abspath, pool);
+ err = svn_wc__is_wcroot(&wc_root, ctx->wc_ctx, local_abspath, iterpool);
if (err)
goto errorful;
lock_target = wc_root ? local_abspath
: svn_dirent_dirname(local_abspath, pool);
err = svn_wc__call_with_write_lock(revert, &baton, ctx->wc_ctx,
- lock_target, FALSE, pool, pool);
+ lock_target, FALSE,
+ iterpool, iterpool);
if (err)
goto errorful;
}
@@ -196,10 +208,10 @@ svn_client_revert3(const apr_array_heade
if (paths->nelts == 1)
sleep_path = APR_ARRAY_IDX(paths, 0, const char *);
- svn_io_sleep_for_timestamps(sleep_path, subpool);
+ svn_io_sleep_for_timestamps(sleep_path, iterpool);
}
- svn_pool_destroy(subpool);
+ svn_pool_destroy(iterpool);
return svn_error_trace(err);
}
Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Wed Feb 4 08:36:20 2015
@@ -1076,7 +1076,8 @@ svn_wc_revert4(svn_wc_context_t *wc_ctx,
depth,
use_commit_times,
changelist_filter,
- FALSE /* clear_changelists*/,
+ FALSE /* clear_changelists */,
+ FALSE /* metadata_only */,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));
Modified: subversion/trunk/subversion/libsvn_wc/revert.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/revert.c?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/revert.c (original)
+++ subversion/trunk/subversion/libsvn_wc/revert.c Wed Feb 4 08:36:20 2015
@@ -246,6 +246,21 @@ revert_restore_handle_copied_dirs(svn_bo
return SVN_NO_ERROR;
}
+/* Forward definition */
+static svn_error_t *
+revert_wc_data(svn_boolean_t *notify_required,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_wc__db_status_t status,
+ svn_node_kind_t kind,
+ svn_node_kind_t reverted_kind,
+ svn_filesize_t recorded_size,
+ apr_time_t recorded_time,
+ svn_boolean_t copied_here,
+ svn_boolean_t use_commit_times,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *scratch_pool);
/* Make the working tree under LOCAL_ABSPATH to depth DEPTH match the
versioned tree. This function is called after svn_wc__db_op_revert
@@ -259,6 +274,7 @@ static svn_error_t *
revert_restore(svn_wc__db_t *db,
const char *local_abspath,
svn_depth_t depth,
+ svn_boolean_t metadata_only,
svn_boolean_t use_commit_times,
svn_boolean_t revert_root,
svn_cancel_func_t cancel_func,
@@ -270,15 +286,10 @@ revert_restore(svn_wc__db_t *db,
svn_error_t *err;
svn_wc__db_status_t status;
svn_node_kind_t kind;
- svn_node_kind_t on_disk;
svn_boolean_t notify_required;
const apr_array_header_t *conflict_files;
svn_filesize_t recorded_size;
apr_time_t recorded_time;
- apr_finfo_t finfo;
-#ifdef HAVE_SYMLINK
- svn_boolean_t special;
-#endif
svn_boolean_t copied_here;
svn_node_kind_t reverted_kind;
svn_boolean_t is_wcroot;
@@ -349,8 +360,98 @@ revert_restore(svn_wc__db_t *db,
recorded_time = 0;
}
}
- else if (err)
- return svn_error_trace(err);
+ else
+ SVN_ERR(err);
+
+ if (!metadata_only)
+ {
+ SVN_ERR(revert_wc_data(¬ify_required,
+ db, local_abspath, status, kind,
+ reverted_kind, recorded_size, recorded_time,
+ copied_here, use_commit_times,
+ cancel_func, cancel_baton, scratch_pool));
+ }
+
+ if (conflict_files)
+ {
+ int i;
+ for (i = 0; i < conflict_files->nelts; i++)
+ {
+ SVN_ERR(remove_conflict_file(¬ify_required,
+ APR_ARRAY_IDX(conflict_files, i,
+ const char *),
+ local_abspath, scratch_pool));
+ }
+ }
+
+ if (notify_func && notify_required)
+ notify_func(notify_baton,
+ svn_wc_create_notify(local_abspath, svn_wc_notify_revert,
+ scratch_pool),
+ scratch_pool);
+
+ if (depth == svn_depth_infinity && kind == svn_node_dir)
+ {
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+ const apr_array_header_t *children;
+ int i;
+
+ SVN_ERR(revert_restore_handle_copied_dirs(NULL, db, local_abspath, FALSE,
+ cancel_func, cancel_baton,
+ iterpool));
+
+ SVN_ERR(svn_wc__db_read_children_of_working_node(&children, db,
+ local_abspath,
+ scratch_pool,
+ iterpool));
+ for (i = 0; i < children->nelts; ++i)
+ {
+ const char *child_abspath;
+
+ svn_pool_clear(iterpool);
+
+ child_abspath = svn_dirent_join(local_abspath,
+ APR_ARRAY_IDX(children, i,
+ const char *),
+ iterpool);
+
+ SVN_ERR(revert_restore(db, child_abspath, depth, metadata_only,
+ use_commit_times, FALSE /* revert root */,
+ cancel_func, cancel_baton,
+ notify_func, notify_baton,
+ iterpool));
+ }
+
+ svn_pool_destroy(iterpool);
+ }
+
+ if (notify_func)
+ SVN_ERR(svn_wc__db_revert_list_notify(notify_func, notify_baton,
+ db, local_abspath, scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+revert_wc_data(svn_boolean_t *notify_required,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_wc__db_status_t status,
+ svn_node_kind_t kind,
+ svn_node_kind_t reverted_kind,
+ svn_filesize_t recorded_size,
+ apr_time_t recorded_time,
+ svn_boolean_t copied_here,
+ svn_boolean_t use_commit_times,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *scratch_pool)
+{
+ svn_error_t *err;
+ apr_finfo_t finfo;
+ svn_node_kind_t on_disk;
+#ifdef HAVE_SYMLINK
+ svn_boolean_t special;
+#endif
err = svn_io_stat(&finfo, local_abspath,
APR_FINFO_TYPE | APR_FINFO_LINK
@@ -504,14 +605,14 @@ revert_restore(svn_wc__db_t *db,
SVN_ERR(svn_io_set_file_read_only(local_abspath,
FALSE,
scratch_pool));
- notify_required = TRUE;
+ *notify_required = TRUE;
}
else if (!needs_lock_prop && read_only)
{
SVN_ERR(svn_io_set_file_read_write(local_abspath,
FALSE,
scratch_pool));
- notify_required = TRUE;
+ *notify_required = TRUE;
}
}
@@ -572,65 +673,9 @@ revert_restore(svn_wc__db_t *db,
SVN_ERR(svn_wc__wq_run(db, local_abspath, cancel_func, cancel_baton,
scratch_pool));
}
- notify_required = TRUE;
- }
-
- if (conflict_files)
- {
- int i;
- for (i = 0; i < conflict_files->nelts; i++)
- {
- SVN_ERR(remove_conflict_file(¬ify_required,
- APR_ARRAY_IDX(conflict_files, i,
- const char *),
- local_abspath, scratch_pool));
- }
- }
-
- if (notify_func && notify_required)
- notify_func(notify_baton,
- svn_wc_create_notify(local_abspath, svn_wc_notify_revert,
- scratch_pool),
- scratch_pool);
-
- if (depth == svn_depth_infinity && kind == svn_node_dir)
- {
- apr_pool_t *iterpool = svn_pool_create(scratch_pool);
- const apr_array_header_t *children;
- int i;
-
- SVN_ERR(revert_restore_handle_copied_dirs(NULL, db, local_abspath, FALSE,
- cancel_func, cancel_baton,
- iterpool));
-
- SVN_ERR(svn_wc__db_read_children_of_working_node(&children, db,
- local_abspath,
- scratch_pool,
- iterpool));
- for (i = 0; i < children->nelts; ++i)
- {
- const char *child_abspath;
-
- svn_pool_clear(iterpool);
-
- child_abspath = svn_dirent_join(local_abspath,
- APR_ARRAY_IDX(children, i,
- const char *),
- iterpool);
-
- SVN_ERR(revert_restore(db, child_abspath, depth,
- use_commit_times, FALSE /* revert root */,
- cancel_func, cancel_baton,
- notify_func, notify_baton,
- iterpool));
- }
-
- svn_pool_destroy(iterpool);
+ *notify_required = TRUE;
}
- if (notify_func)
- SVN_ERR(svn_wc__db_revert_list_notify(notify_func, notify_baton,
- db, local_abspath, scratch_pool));
return SVN_NO_ERROR;
}
@@ -641,6 +686,7 @@ revert(svn_wc__db_t *db,
svn_depth_t depth,
svn_boolean_t use_commit_times,
svn_boolean_t clear_changelists,
+ svn_boolean_t metadata_only,
svn_cancel_func_t cancel_func,
void *cancel_baton,
svn_wc_notify_func2_t notify_func,
@@ -671,7 +717,7 @@ revert(svn_wc__db_t *db,
scratch_pool, scratch_pool);
if (!err)
- err = revert_restore(db, local_abspath, depth,
+ err = revert_restore(db, local_abspath, depth, metadata_only,
use_commit_times, TRUE /* revert root */,
cancel_func, cancel_baton,
notify_func, notify_baton,
@@ -695,6 +741,7 @@ revert_changelist(svn_wc__db_t *db,
svn_boolean_t use_commit_times,
apr_hash_t *changelist_hash,
svn_boolean_t clear_changelists,
+ svn_boolean_t metadata_only,
svn_cancel_func_t cancel_func,
void *cancel_baton,
svn_wc_notify_func2_t notify_func,
@@ -713,6 +760,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,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));
@@ -747,7 +795,7 @@ revert_changelist(svn_wc__db_t *db,
SVN_ERR(revert_changelist(db, child_abspath, depth,
use_commit_times, changelist_hash,
- clear_changelists,
+ clear_changelists, metadata_only,
cancel_func, cancel_baton,
notify_func, notify_baton,
iterpool));
@@ -773,6 +821,7 @@ revert_partial(svn_wc__db_t *db,
svn_depth_t depth,
svn_boolean_t use_commit_times,
svn_boolean_t clear_changelists,
+ svn_boolean_t metadata_only,
svn_cancel_func_t cancel_func,
void *cancel_baton,
svn_wc_notify_func2_t notify_func,
@@ -793,7 +842,7 @@ revert_partial(svn_wc__db_t *db,
/* Revert the root node itself (depth=empty), then move on to the
children. */
SVN_ERR(revert(db, local_abspath, svn_depth_empty,
- use_commit_times, clear_changelists,
+ use_commit_times, clear_changelists, metadata_only,
cancel_func, cancel_baton,
notify_func, notify_baton, iterpool));
@@ -828,6 +877,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,
cancel_func, cancel_baton,
notify_func, notify_baton,
iterpool));
@@ -846,6 +896,7 @@ svn_wc_revert5(svn_wc_context_t *wc_ctx,
svn_boolean_t use_commit_times,
const apr_array_header_t *changelist_filter,
svn_boolean_t clear_changelists,
+ svn_boolean_t metadata_only,
svn_cancel_func_t cancel_func,
void *cancel_baton,
svn_wc_notify_func2_t notify_func,
@@ -862,6 +913,7 @@ svn_wc_revert5(svn_wc_context_t *wc_ctx,
depth, use_commit_times,
changelist_hash,
clear_changelists,
+ metadata_only,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));
@@ -870,6 +922,7 @@ svn_wc_revert5(svn_wc_context_t *wc_ctx,
if (depth == svn_depth_empty || depth == svn_depth_infinity)
return svn_error_trace(revert(wc_ctx->db, local_abspath,
depth, use_commit_times, clear_changelists,
+ metadata_only,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));
@@ -883,7 +936,7 @@ svn_wc_revert5(svn_wc_context_t *wc_ctx,
if (depth == svn_depth_files || depth == svn_depth_immediates)
return svn_error_trace(revert_partial(wc_ctx->db, local_abspath,
depth, use_commit_times,
- clear_changelists,
+ clear_changelists, metadata_only,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));
Modified: subversion/trunk/subversion/svn/revert-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/revert-cmd.c?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/revert-cmd.c (original)
+++ subversion/trunk/subversion/svn/revert-cmd.c Wed Feb 4 08:36:20 2015
@@ -70,6 +70,7 @@ svn_cl__revert(apr_getopt_t *os,
err = svn_client_revert3(targets, opt_state->depth,
opt_state->changelists,
FALSE /* clear_changelists */,
+ FALSE /* metadata_only */,
ctx, scratch_pool);
if (err
&& (err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH)
Modified: subversion/trunk/subversion/tests/libsvn_wc/utils.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/utils.c?rev=1657026&r1=1657025&r2=1657026&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/utils.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/utils.c Wed Feb 4 08:36:20 2015
@@ -297,7 +297,11 @@ sbox_wc_revert(svn_test__sandbox_t *b, c
SVN_ERR(svn_wc__acquire_write_lock(&lock_root_abspath, b->wc_ctx,
dir_abspath, FALSE /* lock_anchor */,
b->pool, b->pool));
- SVN_ERR(svn_wc_revert5(b->wc_ctx, abspath, depth, FALSE, NULL, FALSE,
+ SVN_ERR(svn_wc_revert5(b->wc_ctx, abspath, depth,
+ FALSE /* use_commit_times */,
+ NULL /* changelist_filter */,
+ FALSE /* clear_changelists */,
+ FALSE /* metadata_only */,
NULL, NULL, /* cancel baton + func */
NULL, NULL, /* notify baton + func */
b->pool));
RE: svn commit: r1657026 - in /subversion/trunk/subversion: bindings/javahl/native/ bindings/javahl/src/org/apache/subversion/javahl/ include/ libsvn_client/ libsvn_wc/ svn/ tests/libsvn_wc/
Posted by Bert Huijben <be...@qqmail.nl>.
> -----Original Message-----
> From: Branko Čibej [mailto:brane@wandisco.com]
> Sent: woensdag 4 februari 2015 10:23
> To: dev@subversion.apache.org
> Subject: Re: svn commit: r1657026 - in /subversion/trunk/subversion:
> bindings/javahl/native/ bindings/javahl/src/org/apache/subversion/javahl/
> include/ libsvn_client/ libsvn_wc/ svn/ tests/libsvn_wc/
>
> On 04.02.2015 09:36, rhuijben@apache.org wrote:
> > Author: rhuijben
> > Date: Wed Feb 4 08:36:20 2015
> > New Revision: 1657026
> >
> > URL: http://svn.apache.org/r1657026
> > Log:
> > As we are revving svn_client_revert() for 1.9 anyway, now is the time to
> > give it a 'metadata_only' flag, like we have on copy and move.
>
> I understand the case for a metadata-only copy and/or move.
> What's the use case for doing a metadata-only revert?
In my particular case:
Users automatically replacing files like .dll's (shared libraries) and .xls document files.
The delete is automatically handled and properly recorded as a delete in Subversion. (The --keep-local flag is essentially delete's metadata only, as it allows deleting without error)
But then the file is replaced, by some outside process. The current worst case is the NuGet Visual Studio addin, that just tells me that the user does things (who doesn't) and sometimes blocks access.
The user goes on with his work and locks the file... (opens excel, starts debugging, whatever)
Now the user wants to commit his workspace, but explicitly doesn't want to record the delete + add as a delete, but as a normal file update.
To change the in-wc state to a normal update I have to call revert... But that currently requires replacing the in-wc file with the old version.
(And moving around the file to keep the copy has all those other nice side effects)
This patch allows handling this workflow with a single call to revert, that typically can't fail unless another Subversion client changes the same wc at the same time.
TortoiseSVN has a similar workflow, somewhere in its context menus.
Bert
Re: svn commit: r1657026 - in /subversion/trunk/subversion: bindings/javahl/native/
bindings/javahl/src/org/apache/subversion/javahl/ include/ libsvn_client/
libsvn_wc/ svn/ tests/libsvn_wc/
Posted by Branko Čibej <br...@wandisco.com>.
On 04.02.2015 09:36, rhuijben@apache.org wrote:
> Author: rhuijben
> Date: Wed Feb 4 08:36:20 2015
> New Revision: 1657026
>
> URL: http://svn.apache.org/r1657026
> Log:
> As we are revving svn_client_revert() for 1.9 anyway, now is the time to
> give it a 'metadata_only' flag, like we have on copy and move.
I understand the case for a metadata-only copy and/or move.
What's the use case for doing a metadata-only revert?
-- Brane