[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] "move" shouldn't take a revision argument

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2004-11-09 16:24:54 CET

Julian Foad wrote:
> I'll do something about deprecating it.

The attached patch deprecates svn_client_move because of its "src_revision"
argument. (A future patch should deprecate the command-line option "-r" with
"svn move".)

I don't think it is right for us to deprecate an API and then go on using it,
so I duplicate the "if (!HEAD) return ERROR;" logic in the caller to preserve
the current command-line behaviour until we can lose the "-r" option in version 2.

I'll commit this if there are no adverse comments.

- Julian

Phase out the unwanted "src_revision" argument of "svn_client_move".

* subversion/include/svn_client.h
  (svn_client_move): Deprecate.
  (svn_client_move2): New function, as svn_client_move without src_revision.

* subversion/libsvn_client/copy.c
  (setup_copy): Don't check the source revision for a move here.
  (svn_client_move): Check the source revision for a move here instead.
  (svn_client_move2): New function, as svn_client_move without src_revision.

* subversion/clients/cmdline/move-cmd.c
  (svn_cl__move): Call svn_client_move2 instead of svn_client_move. Check the
    revision here, because we are no longer having svn_client_move check it.

Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h (revision 11796)
+++ subversion/include/svn_client.h (working copy)
@@ -1088,7 +1088,10 @@
                  apr_pool_t *pool);
 
 
-/** Move @a src_path to @a dst_path.
+/**
+ * @since New in 1.2.
+ *
+ * Move @a src_path to @a dst_path.
  *
  * @a src_path must be a file or directory under version control, or the
  * URL of a versioned item in the repository.
@@ -1097,9 +1100,6 @@
  *
  * - @a dst_path must also be a repository URL (existent or not).
  *
- * - @a src_revision is used to choose the revision from which to copy
- * the @a src_path.
- *
  * - the authentication baton in @a ctx and @a ctx->log_msg_func/@a
  * ctx->log_msg_baton are used to commit the move.
  *
@@ -1110,8 +1110,7 @@
  *
  * - @a dst_path must also be a working copy path (existent or not).
  *
- * - @a src_revision, and @a ctx->log_msg_func/@a ctx->log_msg_baton are
- * ignored.
+ * - @a ctx->log_msg_func and @a ctx->log_msg_baton are ignored.
  *
  * - This is a scheduling operation. No changes will happen to the
  * repository until a commit occurs. This scheduling can be removed
@@ -1135,6 +1134,22 @@
  * ### Is this really true? What about @c svn_wc_notify_commit_replaced? ###
  */
 svn_error_t *
+svn_client_move2 (svn_client_commit_info_t **commit_info,
+ const char *src_path,
+ const char *dst_path,
+ svn_boolean_t force,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool);
+
+/**
+ * @deprecated Provided for backward compatibility with the 1.1.0 API.
+ *
+ * Similar to @c svn_client_move2, but an extra argument @a src_revision
+ * must be passed. This has no effect, but must be of kind
+ * @c svn_opt_revision_unspecified or @c svn_opt_revision_head,
+ * otherwise error @c SVN_ERR_UNSUPPORTED_FEATURE is returned.
+ */
+svn_error_t *
 svn_client_move (svn_client_commit_info_t **commit_info,
                  const char *src_path,
                  const svn_opt_revision_t *src_revision,
Index: subversion/libsvn_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c (revision 11796)
+++ subversion/libsvn_client/copy.c (working copy)
@@ -1039,21 +1039,6 @@
             (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
              _("No support for repos <--> working copy moves"));
         }
-
- /* It doesn't make sense to specify revisions in a move. */
-
- /* ### todo: this check could fail wrongly. For example,
- someone could pass in an svn_opt_revision_number that just
- happens to be the HEAD. It's fair enough to punt then, IMHO,
- and just demand that the user not specify a revision at all;
- beats mucking up this function with RA calls and such. */
- if (src_revision->kind != svn_opt_revision_unspecified
- && src_revision->kind != svn_opt_revision_head)
- {
- return svn_error_create
- (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
- _("Cannot specify revisions with move operations"));
- }
     }
   else
     {
@@ -1140,6 +1125,25 @@
 
 
 svn_error_t *
+svn_client_move2 (svn_client_commit_info_t **commit_info,
+ const char *src_path,
+ const char *dst_path,
+ svn_boolean_t force,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
+ const svn_opt_revision_t src_revision
+ = { svn_opt_revision_unspecified, { 0 } };
+
+ return setup_copy (commit_info,
+ src_path, &src_revision, dst_path,
+ TRUE /* is_move */,
+ force,
+ ctx,
+ pool);
+}
+
+svn_error_t *
 svn_client_move (svn_client_commit_info_t **commit_info,
                  const char *src_path,
                  const svn_opt_revision_t *src_revision,
@@ -1148,6 +1152,21 @@
                  svn_client_ctx_t *ctx,
                  apr_pool_t *pool)
 {
+ /* It doesn't make sense to specify revisions in a move. */
+
+ /* ### todo: this check could fail wrongly. For example,
+ someone could pass in an svn_opt_revision_number that just
+ happens to be the HEAD. It's fair enough to punt then, IMHO,
+ and just demand that the user not specify a revision at all;
+ beats mucking up this function with RA calls and such. */
+ if (src_revision->kind != svn_opt_revision_unspecified
+ && src_revision->kind != svn_opt_revision_head)
+ {
+ return svn_error_create
+ (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("Cannot specify revisions (except HEAD) with move operations"));
+ }
+
   return setup_copy (commit_info,
                      src_path, src_revision, dst_path,
                      TRUE /* is_move */,
Index: subversion/clients/cmdline/move-cmd.c
===================================================================
--- subversion/clients/cmdline/move-cmd.c (revision 11796)
+++ subversion/clients/cmdline/move-cmd.c (working copy)
@@ -30,6 +30,8 @@
 #include "svn_error.h"
 #include "cl.h"
 
+#include "svn_private_config.h"
+
 
 
 /*** Code. ***/
@@ -65,12 +67,17 @@
 
   SVN_ERR (svn_cl__make_log_msg_baton (&(ctx->log_msg_baton), opt_state,
                                        NULL, ctx->config, pool));
- err = svn_client_move
- (&commit_info,
- src_path, &(opt_state->start_revision), dst_path,
- opt_state->force,
- ctx,
- pool);
+
+ if (opt_state->start_revision.kind != svn_opt_revision_unspecified
+ && opt_state->start_revision.kind != svn_opt_revision_head)
+ {
+ return svn_error_create
+ (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("Cannot specify revisions (except HEAD) with move operations"));
+ }
+
+ err = svn_client_move2 (&commit_info, src_path, dst_path,
+ opt_state->force, ctx, pool);
 
   if (err)
     err = svn_cl__may_need_force (err);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 9 16:25:15 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.