Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/libsvn_client/copy.c  view on Meta::CPAN

      /* Perform the copy and then the delete. */
      if (lock_src)
        SVN_WC__CALL_WITH_WRITE_LOCK(
          do_wc_to_wc_moves_with_locks1(pair, pair->dst_parent_abspath,
                                        lock_src, lock_dst,
                                        allow_mixed_revisions,
                                        metadata_only,
                                        ctx, iterpool),
          ctx->wc_ctx, src_parent_abspath,
          FALSE, iterpool);
      else
        SVN_ERR(do_wc_to_wc_moves_with_locks1(pair, pair->dst_parent_abspath,
                                              lock_src, lock_dst,
                                              allow_mixed_revisions,
                                              metadata_only,
                                              ctx, iterpool));

    }
  svn_pool_destroy(iterpool);

  return svn_error_trace(err);
}

/* Verify that the destinations stored in COPY_PAIRS are valid working copy
   destinations and set pair->dst_parent_abspath and pair->base_name for each
   item to the resulting location if they do */
static svn_error_t *
verify_wc_dsts(const apr_array_header_t *copy_pairs,
               svn_boolean_t make_parents,
               svn_boolean_t is_move,
               svn_boolean_t metadata_only,
               svn_client_ctx_t *ctx,
               apr_pool_t *result_pool,
               apr_pool_t *scratch_pool)
{
  int i;
  apr_pool_t *iterpool = svn_pool_create(scratch_pool);

  /* Check that DST does not exist, but its parent does */
  for (i = 0; i < copy_pairs->nelts; i++)
    {
      svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
                                                    svn_client__copy_pair_t *);
      svn_node_kind_t dst_kind, dst_parent_kind;

      svn_pool_clear(iterpool);

      /* If DST_PATH does not exist, then its basename will become a new
         file or dir added to its parent (possibly an implicit '.').
         Else, just error out. */
      SVN_ERR(svn_wc_read_kind2(&dst_kind, ctx->wc_ctx,
                                pair->dst_abspath_or_url,
                                FALSE /* show_deleted */,
                                TRUE /* show_hidden */,
                                iterpool));
      if (dst_kind != svn_node_none)
        {
          svn_boolean_t is_excluded;
          svn_boolean_t is_server_excluded;

          SVN_ERR(svn_wc__node_is_not_present(NULL, &is_excluded,
                                              &is_server_excluded, ctx->wc_ctx,
                                              pair->dst_abspath_or_url, FALSE,
                                              iterpool));

          if (is_excluded || is_server_excluded)
            {
              return svn_error_createf(
                  SVN_ERR_WC_OBSTRUCTED_UPDATE,
                  NULL, _("Path '%s' exists, but is excluded"),
                  svn_dirent_local_style(pair->dst_abspath_or_url, iterpool));
            }
          else
            return svn_error_createf(
                            SVN_ERR_ENTRY_EXISTS, NULL,
                            _("Path '%s' already exists"),
                            svn_dirent_local_style(pair->dst_abspath_or_url,
                                                   scratch_pool));
        }

      /* Check that there is no unversioned obstruction */
      if (metadata_only)
        dst_kind = svn_node_none;
      else
        SVN_ERR(svn_io_check_path(pair->dst_abspath_or_url, &dst_kind,
                                  iterpool));

      if (dst_kind != svn_node_none)
        {
          if (is_move
              && copy_pairs->nelts == 1
              && strcmp(svn_dirent_dirname(pair->src_abspath_or_url, iterpool),
                        svn_dirent_dirname(pair->dst_abspath_or_url,
                                           iterpool)) == 0)
            {
              const char *dst;
              char *dst_apr;
              apr_status_t apr_err;
              /* We have a rename inside a directory, which might collide
                 just because the case insensivity of the filesystem makes
                 the source match the destination. */

              SVN_ERR(svn_path_cstring_from_utf8(&dst,
                                                 pair->dst_abspath_or_url,
                                                 scratch_pool));

              apr_err = apr_filepath_merge(&dst_apr, NULL, dst,
                                           APR_FILEPATH_TRUENAME, iterpool);

              if (!apr_err)
                {
                  /* And now bring it back to our canonical format */
                  SVN_ERR(svn_path_cstring_to_utf8(&dst, dst_apr, iterpool));
                  dst = svn_dirent_canonicalize(dst, iterpool);
                }
              /* else: Don't report this error; just report the normal error */

              if (!apr_err && strcmp(dst, pair->src_abspath_or_url) == 0)
                {
                  /* Ok, we have a single case only rename. Get out of here */
                  svn_dirent_split(&pair->dst_parent_abspath, &pair->base_name,



( run in 1.080 second using v1.01-cache-2.11-cpan-524268b4103 )