[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-22 23:35:50 CET

Julian Foad wrote:

> Greg Hudson wrote:
>
>> On Tue, 2005-02-22 at 16:39, 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.
>
>
> Note that svn_sort__hash does not sort a hash in place, because a hash
> isn't ordered, so it returns an array generated from that hash.
> Therefore several lines of code must change at each point of use.
> Nevertheless I found that to be an effective solution, not too
> cumbersome.

But quite useless, because svn_wc_entries_read is a _public_ function.
Which means that every single Subversion client would have to use the
svn_sort__hash() kluge.

> Branko Čibej wrote:
> > There is a fairly "simple" way to get sorted output from almost all
> > Subversion commands, and that is to teach svn_wc_entries_read,
> > svn_io_get_dirents and friends to return a table that's inherenly
> > ordered [...]
>
> I found that there were barely enough uses of those functions to make
> it worthwhile creating new, sorted versions of them, but I would not
> object to doing so.

Apart from the fact that we'd have to uses sorted tables in the FS, too,
not just in the WC, you have to maintain the sorted list every time you
change the entries, and entries modification becomes quadratic.

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Feb 22 23:50:46 2005

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