You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David Glasser <gl...@davidglasser.net> on 2007/10/19 16:45:10 UTC

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

On 10/19/07, cacknin@tigris.org <ca...@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@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

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

Posted by Charles Acknin <ch...@gmail.com>.
On 10/19/07, David Glasser <gl...@davidglasser.net> wrote:
> 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)?

I'm not sure I understand correctly this statement.  Your question is
about 'code elsewhere that would currently rely on and/or expect
svn_wc_copy2 to fail with ENOENT'?  This is hard to answer, that
implies scanning the whole codebase for such a thing.  I think the
test-suite is the best tool we have to get a pretty accurate answer on
this matter.  (It PASSed before I commit).

[a minute later]

(Just to get an idea of the extent of possible damages: a combination
of find and grep against the source seems to find 73 lines matching
ENOENT among a handful of files.  Still, I believe it is a pain to
trace back each error that's being compared against this error code
and see if at anytime svn_wc_copy* was involved.)

Charles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org