You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Philip Martin <ph...@wandisco.com> on 2013/08/07 13:10:40 UTC

Re: svn commit: r1507589 - in /subversion/trunk/subversion: libsvn_ra_serf/commit.c tests/cmdline/commit_tests.py

breser@apache.org writes:

> Author: breser
> Date: Sat Jul 27 07:08:03 2013
> New Revision: 1507589
>
> URL: http://svn.apache.org/r1507589
> Log:
> Fix Issue #4400: commits fail with copy and deep delete under copy.
>
> * subversion/libsvn_ra_serf/commit.c
>   (checkout_dir): Generate the working_url when a parent is added by combining
>     the add parent's working_url and the unique (vs add parent) portion of the
>     checkout directory's relpath.
>
> * subversion/tests/cmdline/commit_tests.py
>   (commit_cp_with_deep_delete): Remove the XFail decorator from the test which
>     will pass now.
>
> Modified:
>     subversion/trunk/subversion/libsvn_ra_serf/commit.c
>     subversion/trunk/subversion/tests/cmdline/commit_tests.py
>
> Modified: subversion/trunk/subversion/libsvn_ra_serf/commit.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/commit.c?rev=1507589&r1=1507588&r2=1507589&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_ra_serf/commit.c (original)
> +++ subversion/trunk/subversion/libsvn_ra_serf/commit.c Sat Jul 27 07:08:03 2013
> @@ -397,10 +397,21 @@ checkout_dir(dir_context_t *dir,
>      {
>        if (p_dir->added)
>          {
> +          /* Calculate how much of the relpath to skip to compose the
> +           * working_url.  If the relpath is an empty string then the parent
> +           * is the root of the commit and we need to just add the entire
> +           * relpath to the parent's working_url.  Otherwise we need to skip
> +           * the strlen(parent->relpath) + 1 to account for the slash.
> +           * It is safe to assume that every added directory has a parent. */
> +          dir_context_t *parent = p_dir->parent_dir;
> +          size_t skip = strlen(parent->relpath);
> +          if (skip)
> +            skip++;
> +
>            /* Implicitly checkout this dir now. */
>            dir->working_url = svn_path_url_add_component2(
> -                                   dir->parent_dir->working_url,
> -                                   dir->name, dir->pool);
> +                                   parent->working_url,
> +                                   dir->relpath + skip, dir->pool);

Is svn_relpath_skip_ancestor better than the manual skip?

          char *relpath = svn_relpath_skip_ancestor(parent->relpath,
                                                    dir->relpath);

          dir->working_url = svn_path_url_add_component2(parent->working_url,
                                                         relpath, ...


Perhaps with an assert before using relpath?

          SVN_ERR_ASSERT(relpath
                         && ((strlen(parent->relpath) + strlen(relpath)
                              == strlen(dir->relpath) + 1)
                             || strlen(parent->relpath) == 0));

-- 
Philip Martin | Subversion Committer
WANdisco | Non-Stop Data