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

Re: svn commit: r1152026 - /subversion/trunk/subversion/libsvn_client/commit.c

From: Hyrum K Wright <hyrum.wright_at_wandisco.com>
Date: Thu, 28 Jul 2011 23:06:46 -0700

On Thu, Jul 28, 2011 at 3:35 PM, <stsp_at_apache.org> wrote:
> Author: stsp
> Date: Thu Jul 28 22:35:57 2011
> New Revision: 1152026
>
> URL: http://svn.apache.org/viewvc?rev=1152026&view=rev
> Log:
> Make commit refuse to commit the copied-half of a move independently of
> the delete-half.
>
> It is still possible to commit the delete-half independently of the
> copied-half. That will be fixed soon.
>
> This is the first visible behaviour change for moves.
> None of our existing tests trigger the new error condition so writing
> new tests wouldn't be a bad idea. I'll add some if nobody beats me to it.

See r1152115.

-Hyrum

>
> * subversion/libsvn_client/commit.c
>  (svn_client_commit5): Raise an error if the delete-half corresponding
>   to the copied-half of a moved commit target does not appear in the
>   commit target list.
>
> Modified:
>    subversion/trunk/subversion/libsvn_client/commit.c
>
> Modified: subversion/trunk/subversion/libsvn_client/commit.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1152026&r1=1152025&r2=1152026&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/commit.c (original)
> +++ subversion/trunk/subversion/libsvn_client/commit.c Thu Jul 28 22:35:57 2011
> @@ -1356,6 +1356,47 @@ svn_client_commit5(const apr_array_heade
>       goto cleanup;
>   }
>
> +  /* For every target that was moved verify that both halves of the
> +   * move are part of the commit. */
> +  for (i = 0; i < commit_items->nelts; i++)
> +    {
> +      svn_client_commit_item3_t *item =
> +        APR_ARRAY_IDX(commit_items, i, svn_client_commit_item3_t *);
> +
> +      svn_pool_clear(iterpool);
> +
> +      if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_IS_COPY)
> +        {
> +          const char *moved_from_abspath;
> +          const char *delete_op_root_abspath;
> +
> +          cmt_err = svn_error_trace(svn_wc__node_was_moved_here(
> +                                      &moved_from_abspath,
> +                                      &delete_op_root_abspath,
> +                                      ctx->wc_ctx, item->path,
> +                                      iterpool, iterpool));
> +          if (cmt_err)
> +            goto cleanup;
> +
> +          if (moved_from_abspath && delete_op_root_abspath &&
> +              strcmp(moved_from_abspath, delete_op_root_abspath) == 0 &&
> +              apr_hash_get(committables->by_path, delete_op_root_abspath,
> +                           APR_HASH_KEY_STRING) == NULL)
> +            {
> +              cmt_err = svn_error_createf(
> +                          SVN_ERR_ILLEGAL_TARGET, NULL,
> +                          _("Cannot commit '%s' because it was moved from "
> +                            "'%s' which is not part of the commit; both "
> +                            "sides of the move must be committed together"),
> +                          svn_dirent_local_style(item->path, iterpool),
> +                          svn_dirent_local_style(delete_op_root_abspath,
> +                                                 iterpool));
> +              goto cleanup;
> +            }
> +        }
> +      /* ### TODO: check the delete-half, too */
> +    }
> +
>   /* Go get a log message.  If an error occurs, or no log message is
>      specified, abort the operation. */
>   if (SVN_CLIENT__HAS_LOG_MSG_FUNC(ctx))
>
>
>

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Received on 2011-07-29 08:07:37 CEST

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