[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: SVN-DEV HELP NEEDED: What to do about the ra-get-log interface

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: Wed, 04 Jun 2008 09:58:44 -0400

C. Michael Pilato wrote:
> C. Michael Pilato wrote:
>> C. Michael Pilato wrote:
>>> Martin von Gagern wrote:
>>>> Resending, as I forgot to cc the list... sorry.
>>>> C. Michael Pilato wrote:
>>>> | I seem to recall that recently I realized that NULL and empty had two
>>>> | different interpretations in 'svn log'. I think empty resulted in
>>>> (b),
>>>> | and (a surprise to me) NULL in (c).
>>>> If that is indeed the case and intended this way, it would certainly
>>>> merit documentation.
>>> Okay, looking in svn_repos_get_logs4(), the code does the following
>>> pretty early:
>>> if (! paths)
>>> paths = apr_array_make(pool, 0, sizeof(const char *));
>>> So it would seem that NULL and empty have the same meaning.
>> Ohohoh. But that code isn't in the 1.4.x line. I see what you mean,
>> now. (And maybe this explains what I *thought* I saw in testing
>> recently.)

Just to tie up this line of thought, the 1.4.x svn_repos_get_logs3() logic

    paths == NULL
    paths->nelts == 1 && paths[0] == ""

The 1.5.x svn_repos_get_logs4() logic special-cases:

    paths == NULL
    paths->nelts == 0 <--- this is new
    paths->nelts == 1 && paths[0] == ""

I'm not positive, but I think that in 1.4.x, if you passed an empty array,
you got no logs. In 1.5.x., that's not the case -- passing an empty paths
array results in getting revisions for the root of the repository. So there
*was* a real change of behavior to the API.

Moving to the RA layers, we have four implementations, but they all share
the common feature that none of them allows a NULL 'paths' array to hit the
svn_repos_get_logs* functions. They all start with an empty array, and add
to it any paths requested. This means, though, that there's still a
discrepancy between 1.4.x and 1.5.x -- the handling of the empty paths array.

Backing all the way up to the client layer, things get okay again, because
svn_client_log4() ensures that there is always at least one path in the array.

So, to summarize:

    * The repos layer behaves differently in 1.5.x than in 1.4.x when handed
      an empty 'paths' array.

    * The RA layer behaves differently in 1.5.x than in 1.4.x when handed
      either an empty or a NULL 'paths' array (because both result ultimately
      in an empty paths array being handed to the repos layer).

    * The client layer behaves the same in 1.5.x and 1.4.x because it always
      provides a non-empty paths array to the RA layer.

Fortunately (for us), I think the docstrings in the RA and repos layers are
sufficiently vague as to not imply *what* would happen if you passed an
empty array. So, in my opinion, we have the opportunity in 1.5.0 to define
that behavior (which we effectively have: empty paths == NULL paths ==
paths with one "" member), and (now) in 1.5.1 to fix the docstrings for the
repos and RA functions so that this is all made clear.

(Attached is a Python script I've been using against svn.collab.net and
svn.red-bean.com to sanity-check some of this stuff.)

C. Michael Pilato <cmpilato_at_collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on 2008-06-04 15:59:00 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.