On Tue, Jun 25, 2013 at 5:32 PM,  <rhuij...@apache.org> wrote:
> Author: rhuijben
> Date: Tue Jun 25 13:32:16 2013
> New Revision: 1496468
>
> URL: http://svn.apache.org/r1496468
> Log:
> Use a cheaper ra operation for a common libsvn_client calculation.
>
> * subversion/libsvn_client/ra.c
>   (repos_locations): Optimize common diff ra request for diff for the old
>     location of the repository root.
>
[...]

======
> --- subversion/trunk/subversion/libsvn_client/ra.c (original)
> +++ subversion/trunk/subversion/libsvn_client/ra.c Tue Jun 25 13:32:16 2013
> @@ -668,9 +668,9 @@ repos_locations(const char **start_url,
>    apr_array_header_t *revs;
>    apr_hash_t *rev_locs;
>
> -  SVN_ERR_ASSERT(peg_revnum != SVN_INVALID_REVNUM);
> -  SVN_ERR_ASSERT(start_revnum != SVN_INVALID_REVNUM);
> -  SVN_ERR_ASSERT(end_revnum != SVN_INVALID_REVNUM || end_url == NULL);
> +  SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(peg_revnum));
> +  SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(start_revnum));
> +  SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(end_revnum) || end_url == NULL);
>
>    /* Avoid a network request in the common easy case. */
>    if (start_revnum == peg_revnum
> @@ -685,6 +685,26 @@ repos_locations(const char **start_url,
>
>    SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_url, scratch_pool));
>
> +  /* Handle another common case: The repository root can't move */
> +  if (! strcmp(repos_url, url))
> +    {
> +      svn_revnum_t latest_revnum;
> +      SVN_ERR(svn_ra_get_latest_revnum(ra_session, &latest_revnum,
> +                                       scratch_pool));
> +
> +      if (start_revnum > latest_revnum || end_revnum > latest_revnum)
end_revnum can be SVN_INVALID_REVNUM if end_url is NULL. So this
condition should be fixed.

Also it probably makes sense to move this optimization to caller
(svn_client__repos_locations) since most likely youngest is already
known at this layer.




-- 
Ivan Zhakov
CTO | VisualSVN | http://www.visualsvn.com

Reply via email to