You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Hyrum K. Wright" <hy...@mail.utexas.edu> on 2010/06/12 13:20:37 UTC

Re: svn commit: r953994 - /subversion/trunk/subversion/libsvn_wc/adm_ops.c

On Sat, Jun 12, 2010 at 1:47 PM, <rh...@apache.org> wrote:

> Author: rhuijben
> Date: Sat Jun 12 11:47:37 2010
> New Revision: 953994
>
> URL: http://svn.apache.org/viewvc?rev=953994&view=rev
> Log:
> Remove reading information via svn_wc_entry_t from svn_wc_add4(). Use
> the wc-db data instead. Also switch to scratch_pool and handle an error
> case that can only occur after we move to a single db.
>
> * subversion/libsvn_wc/adm_ops.c
>  (svn_wc_add4): Remove entry read operation and reduce scope of tmp_entry.
>
> Modified:
>    subversion/trunk/subversion/libsvn_wc/adm_ops.c
>
> Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=953994&r1=953993&r2=953994&view=diff
>
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Sat Jun 12 11:47:37
> 2010
> ...
> @@ -1624,99 +1627,145 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
>              _("Can't replace '%s' with a node of a differing type; "
>                "the deletion must be committed and the parent updated "
>                "before adding '%s'"),
> -             svn_dirent_local_style(local_abspath, pool),
> -             svn_dirent_local_style(local_abspath, pool));
> +             svn_dirent_local_style(local_abspath, scratch_pool),
> +             svn_dirent_local_style(local_abspath, scratch_pool));
>         }
>     }
>
> -  SVN_ERR(svn_wc__get_entry(&parent_entry, db, parent_abspath,
> -                            TRUE /* allow_unversioned */,
> -                            svn_node_dir,
> -                            FALSE /* need_parent_stub */,
> -                            pool, pool));
> -  if (! parent_entry)
> -    return svn_error_createf
> -      (SVN_ERR_ENTRY_NOT_FOUND, NULL,
> -       _("Can't find parent directory's entry while trying to add '%s'"),
> -       svn_dirent_local_style(local_abspath, pool));
> +  {
> +    svn_wc__db_status_t parent_status;
> +    svn_wc__db_kind_t parent_kind;
> +
> +    err = svn_wc__db_read_info(&parent_status, &parent_kind, NULL,
> +                               &parent_repos_relpath, &repos_root_url,
> +                               &repos_uuid, NULL, NULL, NULL, NULL, NULL,
> NULL,
> +                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> NULL,
> +                               NULL, NULL, NULL, NULL,
> +                               db, parent_abspath, scratch_pool,
> scratch_pool);
> +
> +    if (err
> +        || parent_status == svn_wc__db_status_not_present
> +        || parent_status == svn_wc__db_status_excluded
> +        || parent_status == svn_wc__db_status_absent
> +        || parent_status == svn_wc__db_status_obstructed
> +        || parent_status == svn_wc__db_status_obstructed_add)
> +      {
> +        return
> +          svn_error_createf(SVN_ERR_ENTRY_NOT_FOUND, err,
> +                            _("Can't find parent directory's entry while"
> +                              " trying to add '%s'"),
> +                            svn_dirent_local_style(local_abspath,
> +                                                   scratch_pool));
> +      }
> +    else if (parent_status == svn_wc__db_status_deleted
> +             || parent_status == svn_wc__db_status_obstructed_delete)
> +      {
> +        return
> +          svn_error_createf(SVN_ERR_WC_SCHEDULE_CONFLICT, NULL,
> +                            _("Can't add '%s' to a parent directory"
> +                              " scheduled for deletion"),
> +                            svn_dirent_local_style(local_abspath,
> +                                                   scratch_pool));
> +      }
> +    else if (parent_kind != svn_wc__db_kind_dir)
> +      /* Can't happen until single db; but then it causes serious
> +         trouble if we allow this. */
> +      return svn_error_createf(SVN_ERR_NODE_UNEXPECTED_KIND, NULL,
> +                               _("Can't schedule an addition of '%s'"
> +                                 " below a not-directory node"));
>

What should be substituted for '%s' above?  (You don't have enough
parameters in the createf() call.)

...
>

-Hyrum