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

Re: wc-ng: determine if a node is versioned

From: Neels J Hofmeyr <neels_at_elego.de>
Date: Wed, 28 Apr 2010 12:49:16 +0200

Neels J Hofmeyr wrote:
> Greg Stein wrote:
>> On Sat, Apr 24, 2010 at 10:37, Neels J Hofmeyr <neels_at_elego.de> wrote:
>>> ...
>>> At first glance, it appears that different code paths want to handle
>>> incomplete nodes differently. Some want to act as if the node was 'normal'
>>> == versioned. Most appear to want to act as if incomplete nodes were
>>> non-versioned -- but maybe they just do that now because a cleanly
>>> non-versioned node returns the same value as an incomplete node. And that's
>>> the problem -- the API tempts hackers to just ignore the incomplete state
>>> without reflection.
>>>
>>> Maybe svn_wc__node_get_kind() should use determine if a node is incomplete
>>> and throw an error if so, including a boolean arg allow_incomplete to bypass
>>> that error?
>> The node_get_kind API is there for simplicity. Don't throw errors.
>>
>> Adjust return values instead. I would recommend returning none for
>> unversioned and hidden nodes (the idea behind hidden is "it isn't
>> there", so these are the same concept). And reserve unknown for
>> incomplete nodes.
>
> Ok cool. I was at first thinking the same and then thought that maybe the
> 'unknown' was intended to mean something like "it's definitely not in the
> WC, but who knows which kind it may be in the repos".
>
> But with that said, I agree totally.
>
> One thing I'd like to clarify though -- this function could technically also
> be used to determine the kind that may have been noted in an incomplete
> node. I assume that's not worth considering for a simplicity-API.

Just for the records of this thread: My assumption was wrong, as I was told
on #svn-dev. The idea of this function is that even if a node is marked
incomplete, it will return the correct node kind if available.

As of r937735, the only situation in which svn_wc__node_get_kind() returns
svn_node_unknown is when the node *has* WC-metadata but has no kind set (and
is hence incomplete).

When the function returns a _file or _dir node kind, the node may or may not
be marked incomplete, and there is other API to tell the difference.

~Neels

Received on 2010-04-28 12:49:54 CEST

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