> -----Original Message-----
> From: stef...@apache.org [mailto:stef...@apache.org]
> Sent: vrijdag 20 januari 2017 13:34
> To: comm...@subversion.apache.org
> Subject: svn commit: r1779617 -
> /subversion/trunk/subversion/libsvn_ra_svn/client.c
> 
> Author: stefan2
> Date: Fri Jan 20 12:33:32 2017
> New Revision: 1779617
> 
> URL: http://svn.apache.org/viewvc?rev=1779617&view=rev
> Log:
> Second and final step in the eliminatation of reparent calls over ra_svn.
> 
> Actually eliminate reparent calls that are below to the current parent.
> Adapt all path parameter accordingly before passing them to the server.

This patch introduces a few calls to dirent functions, that should really be to 
relpath functions. The buildbot complains with assertions on Windows, as we 
explicitly test for a few of these cases.

        Bert

> Modified:
>     subversion/trunk/subversion/libsvn_ra_svn/client.c
> 
> Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/c
> lient.c?rev=1779617&r1=1779616&r2=1779617&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
> +++ subversion/trunk/subversion/libsvn_ra_svn/client.c Fri Jan 20 12:33:32
> 2017
> @@ -936,6 +936,92 @@ reparent_server(svn_ra_session_t *ra_ses
>    return SVN_NO_ERROR;
>  }
> 
> +/* Make sure that RA_SESSION's client and server-side parent infp are in
> +   sync.  Use SCRATCH_POOL for temporary allocations. */
> +static svn_error_t *
> +ensure_exact_server_parent(svn_ra_session_t *ra_session,
> +                           apr_pool_t *scratch_pool)
> +{
> +  svn_ra_svn__session_baton_t *sess = ra_session->priv;
> +  svn_ra_svn__parent_t *parent = sess->parent;
> +
> +  /* During e.g. a checkout operation, many requests will be sent for the
> +     same URL that was used to create the session.  So, both sides are
> +     often already in sync. */
> +  if (svn_stringbuf_compare(parent->url, parent->server_base_url))
> +    return SVN_NO_ERROR;
> +
> +  /* Actually reparent the server to the session URL. */
> +  SVN_ERR(reparent_server(ra_session, parent->url->data, scratch_pool));
> +  svn_stringbuf_setempty(parent->path);
> +
> +  return SVN_NO_ERROR;
> +}
> +
> +/* Return a copy of PATH, adjusted to the RA_SESSION's server parent URL.
> +   Allocate the result in RESULT_POOL. */
> +static const char *
> +reparent_path(svn_ra_session_t *ra_session,
> +              const char *path,
> +              apr_pool_t *result_pool)
> +{
> +  svn_ra_svn__session_baton_t *sess = ra_session->priv;
> +  svn_ra_svn__parent_t *parent = sess->parent;
> +
> +  return svn_dirent_join(parent->path->data, path, result_pool);


This should join relpaths, not dirents...

> +}
> +


> @@ -943,18 +1029,35 @@ static svn_error_t *ra_svn_reparent(svn_
>    svn_ra_svn__session_baton_t *sess = ra_session->priv;
>    svn_ra_svn__parent_t *parent = sess->parent;
>    svn_ra_svn_conn_t *conn = sess->conn;
> +  const char *path;
> 
> -  /* Eliminate redundant reparent requests. */
> -  if (strcmp(parent->server_base_url->data, url))
> -    {
> -      /* Send the request to the server. */
> -      SVN_ERR(reparent_server(ra_session, url, pool));
> +  /* Eliminate reparent requests if they are to a sub-path of the
> +     server's current parent path. */
> +  path = svn_dirent_skip_ancestor(parent->server_base_url->data, url);
> +  if (!path)
> +    {
> +      /* Send the request to the server.
> +
> +         If within the same repository, reparent to the repo root
> +         because this will maximize the chance to turn future reparent
> +         requests into a client-side update of the rel path. */
> +      path = conn->repos_root
> +           ? svn_dirent_skip_ancestor(conn->repos_root, url)
> +           : NULL;

Same problem.

> +
> +      if (path)
> +        SVN_ERR(reparent_server(ra_session, conn->repos_root, pool));
> +      else
> +        SVN_ERR(reparent_server(ra_session, url, pool));
>      }


> @@ -1502,12 +1610,14 @@ static svn_error_t *ra_svn_get_mergeinfo
>                                           apr_pool_t *pool)
>  {
>    svn_ra_svn__session_baton_t *sess_baton = session->priv;
> +  svn_ra_svn__parent_t *parent = sess_baton->parent;
>    svn_ra_svn_conn_t *conn = sess_baton->conn;
>    int i;
>    svn_ra_svn__list_t *mergeinfo_tuple;
>    svn_ra_svn__item_t *elt;
>    const char *path;
> 
> +  paths = reparent_path_array(session, paths, pool);
>    SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w((!", "get-mergeinfo"));
>    for (i = 0; i < paths->nelts; i++)
>      {
> @@ -1537,9 +1647,16 @@ static svn_error_t *ra_svn_get_mergeinfo
>            SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, "cc",
>                                            &path, &to_parse));
>            SVN_ERR(svn_mergeinfo_parse(&for_path, to_parse, pool));
> +
>            /* Correct for naughty servers that send "relative" paths
>               with leading slashes! */
> -          svn_hash_sets(*catalog, path[0] == '/' ? path + 1 :path, for_path);
> +          if (path[0] == '/')
> +            ++path;
> +
> +          /* Correct for the (potential) difference between client and
> +             server-side session parent paths. */
> +          path = svn_dirent_skip_ancestor(parent->path->data, path);

And here.
> +          svn_hash_sets(*catalog, path, for_path);
>          }
>      }

And one more in ra_svn_get_mergeinfo().

See 
https://ci.apache.org/builders/svn-windows-ra/builds/1438/steps/Test%20fsfs%2Bsvn/logs/faillog

        Bert

Reply via email to