You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by vijayaguru <vi...@collab.net> on 2010/10/05 08:21:04 UTC
when does this code get invoked?
Hi,
I had a chance to look into the code subversion/libsvn_ra_neon/commit.c.
There was a portion of code(commit.c:485) in (checkout_resource)
function that I could not understand in which case it will get executed.
Please let me know when this part of code will get exercised.
<snip>
if (err == NULL && allow_404 && code == 404)
{
locn = NULL;
/* re-fetch, forcing a query to the server */
SVN_ERR(get_version_url(cc, NULL, rsrc, TRUE, pool));
/* do it again, but don't allow a 404 this time */
err = do_checkout(cc, rsrc->vsn_url, FALSE, token,
is_vcc, &code, &locn, pool);
}
<snip>
Here the duplicate of the resource is getting passed during a call to
checkout_resource in few places.
For example, in (commit_open_file), file_rsrc that is the duplicate of
rsrc is passed to 'checkout_resource'. If the above mentioned portion of
code(allow_404 &&code=404) is exercised in this case, Will it cause any
problem since we are not duplicating the *name of resource* in
'dup_resource'.
<snip>
file->rsrc = dup_resource(rsrc, file_pool);
.
.
SVN_ERR(checkout_resource(parent->cc, file->rsrc, TRUE,
file->token, FALSE, workpool));
</snip>
Thanks in Advance!!
Thanks & Regards,
Vijayaguru
Re: when does this code get invoked?
Posted by "C. Michael Pilato" <cm...@collab.net>.
On 10/05/2010 09:53 AM, C. Michael Pilato wrote:
> It will only cause problems if the duplicated resource is used beyond the
> pool lifetime of the original. But this definitely is a bug in
> dup_resource(), which claims to do a deep copy of the object without any
> exceptions. I'll fix this in a minute.
Committed in r1004644.
--
C. Michael Pilato <cm...@collab.net>
CollabNet <> www.collab.net <> Distributed Development On Demand
Re: when does this code get invoked?
Posted by "C. Michael Pilato" <cm...@collab.net>.
On 10/05/2010 04:21 AM, vijayaguru wrote:
> Hi,
>
> I had a chance to look into the code subversion/libsvn_ra_neon/commit.c.
> There was a portion of code(commit.c:485) in (checkout_resource)
> function that I could not understand in which case it will get executed.
> Please let me know when this part of code will get exercised.
>
> <snip>
>
> if (err == NULL && allow_404 && code == 404)
> {
> locn = NULL;
>
> /* re-fetch, forcing a query to the server */
> SVN_ERR(get_version_url(cc, NULL, rsrc, TRUE, pool));
>
> /* do it again, but don't allow a 404 this time */
> err = do_checkout(cc, rsrc->vsn_url, FALSE, token,
> is_vcc, &code, &locn, pool);
> }
>
> <snip>
It's been a while since I went swimming in these waters, but I think what
happens is that once we know the version resource URL for a directory, we
first assume that the version resource URL for a child of that directory is
just urlof(directory) + basename(child). We do this to avoid extra
communication with the server. The checkout code then tries to checkout
that calculated version resource URL, but allows as a non-fatal condition a
server response of "404 Not Found". If that happens, instead, we actually
contact the server to get the correct version resource URL for the child
resource, then retry the checkout.
> For example, in (commit_open_file), file_rsrc that is the duplicate of
> rsrc is passed to 'checkout_resource'. If the above mentioned portion of
> code(allow_404 &&code=404) is exercised in this case, Will it cause any
> problem since we are not duplicating the *name of resource* in
> 'dup_resource'.
It will only cause problems if the duplicated resource is used beyond the
pool lifetime of the original. But this definitely is a bug in
dup_resource(), which claims to do a deep copy of the object without any
exceptions. I'll fix this in a minute.
--
C. Michael Pilato <cm...@collab.net>
CollabNet <> www.collab.net <> Distributed Development On Demand