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

Re: svn commit: r27292 - in branches/svnpatch-diff/subversion: include libsvn_wc

From: David Glasser <glasser_at_davidglasser.net>
Date: 2007-10-19 18:45:10 CEST

On 10/19/07, cacknin@tigris.org <cacknin@tigris.org> wrote:
> Author: cacknin
> Date: Fri Oct 19 06:22:23 2007
> New Revision: 27292
>
> Log:
> Let svn_wc_copy2 API operate on missing working source file.
>
> * subversion/include/svn_wc.h
> (svn_wc_copy2): fix docstring to reflect the new behaviour.
>
> * subversion/libsvn_wc/copy.c
> (svn_wc_copy2): assume the working source file may be missing.
> (copy_file_administratively): when copying the working source file,
> fallback on its text-base if it fails on ENOENT.

Are you positive that there is no code anywhere that assumes that
svn_wc_copy2 will fail on ENOENT if the file doesn't exist (and does
some higher-level recovery)?

> Modified:
> branches/svnpatch-diff/subversion/include/svn_wc.h
> branches/svnpatch-diff/subversion/libsvn_wc/copy.c
>
> Modified: branches/svnpatch-diff/subversion/include/svn_wc.h
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/include/svn_wc.h?pathrev=27292&r1=27291&r2=27292
> ==============================================================================
> --- branches/svnpatch-diff/subversion/include/svn_wc.h (original)
> +++ branches/svnpatch-diff/subversion/include/svn_wc.h Fri Oct 19 06:22:23 2007
> @@ -2486,7 +2486,9 @@
> * @a src must be a file or directory under version control; @a dst_parent
> * must be a directory under version control in the same working copy;
> * @a dst_basename will be the name of the copied item, and it must not
> - * exist already.
> + * exist already. Note that when @a src points to a versioned file, the
> + * working file doesn't necessarily exist in which case its text-base is
> + * used instead.
> *
> * If @a cancel_func is non-NULL, call it with @a cancel_baton at
> * various points during the operation. If it returns an error
>
> Modified: branches/svnpatch-diff/subversion/libsvn_wc/copy.c
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/libsvn_wc/copy.c?pathrev=27292&r1=27291&r2=27292
> ==============================================================================
> --- branches/svnpatch-diff/subversion/libsvn_wc/copy.c (original)
> +++ branches/svnpatch-diff/subversion/libsvn_wc/copy.c Fri Oct 19 06:22:23 2007
> @@ -371,7 +371,8 @@
>
> ASSUMPTIONS:
>
> - - src_path points to a file under version control
> + - src_path is under version control; the working file doesn't
> + necessarily exist (its text-base does).
> - dst_parent points to a dir under version control, in the same
> working copy.
> - dst_basename will be the 'new' name of the copied file in dst_parent
> @@ -481,7 +482,26 @@
> FALSE, special, pool));
> }
> else
> - SVN_ERR(svn_io_copy_file(src_path, tmp_wc_text, TRUE, pool));
> + {
> + svn_error_t *err = SVN_NO_ERROR;
> +
> + /* Try with the working file and fallback on its text-base. */
> + err = svn_io_copy_file(src_path, tmp_wc_text, TRUE, pool);

The above two lines can be combined.

> + if (err)
> + {
> + if (APR_STATUS_IS_ENOENT(err->apr_err))
> + {
> + svn_error_clear(err);
> + err = svn_io_copy_file(src_txtb, tmp_wc_text, FALSE, pool);
> + if (err && APR_STATUS_IS_ENOENT(err->apr_err))
> + return svn_error_create(SVN_ERR_WC_COPYFROM_PATH_NOT_FOUND,
> + err, NULL);
> + }
> +
> + if (err)
> + return err;
> + }
> + }
> }
>
> SVN_ERR(svn_wc_add_repos_file2(dst_path, dst_parent,
> @@ -808,7 +828,8 @@
>
> SVN_ERR(svn_io_check_path(src_path, &src_kind, pool));
>
> - if (src_kind == svn_node_file)
> + if (src_kind == svn_node_file ||
> + (src_entry->kind == svn_node_file && src_kind == svn_node_none))
> {
> /* Check if we are copying a file scheduled for addition,
> these require special handling. */
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
>
>

-- 
David Glasser | glasser_at_davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Oct 19 18:45:21 2007

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