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

Re: Sorted output from Subversion commands

From: Branko Čibej <brane_at_xbc.nu>
Date: 2005-02-23 00:05:24 CET

Julian Foad wrote:

> Branko Čibej wrote:
>
>> Greg Hudson wrote:
>>
>>> Branko Čibej wrote:
>>>
>>>> At the time, I naïvely thought that sorting the entries list and
>>>> returning a modified hash table that supports in-order traversal
>>>> would do the trick. Then I went digging into the code, and it turns
>>>> out that's not enough. Unfortunately, our public APIs return an
>>>> apr_hash_t. And, this not being C++, there's no way to override
>>>> that tables traversal order.
>>>
>>>
>>> We have svn_sort__hash(). It's used in libsvn_subr/hash.c for hash
>>> dumps, for instance.
>>>
>> Yes, but using this would mean we'd have to re-sort the table every
>> time it's modified, which is a) inefficient, and b) doesn't work
>> because we don't _know_ that the client modified the table (and
>> that's another reason why we shouldn't return a pointer straight into
>> the entries cache from the client).
>
>
> That's interesting. You are talking particularly about
> svn_wc_entries_read, I believe. Sorting the result is inefficient,
> certainly, but not grossly, I think. But doesn't work? I don't
> follow that. Who is "we" who don't know that "the client" has
> modified the table? What's this pointer? I'm afraid I'm not familiar
> enough with the code, and you've lost me.

svn_wc_entries_read returns an apr_hash_t*. Most of the time, this hash
table is cached in the adm_access baton. The user of the
svn_wc_entries_read function can modify the hash table, and in doing so
will modify the cache. This means that we cannot also cache a sorted
list of the hash table, because we can never be certain that the list is
up-to-date.

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Feb 23 00:06:37 2005

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