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

Re: random sort of svn status and svn diff

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 27 Mar 2012 10:43:40 +0100 (BST)

Sérgio Basto wrote:

> On Mon, 2012-03-26 at 21:12 +0200, Daniel Shahaf wrote:
>> Sérgio Basto wrote on Mon, Mar 26, 2012 at 20:03:00 +0100:
>> > On Mon, 2012-03-26 at 20:33 +0200, Daniel Shahaf wrote:
>> > > Call svn_sort__hash() :-)
>> >
>> > Could someone write some code as example , please, I hate try to
>> > visualize .
>> >
>> > we already have a svn_sort__hash() or have to do it ?
>>
>> The former; it's declared in svn_sorts.h.
>>
>> The workflow I am assuming here is that you keep the data in a hash as
>> it's passed around, and then sort it at the last minute.
>
> And the code asked ? 
> Could you paste the code that you are talking about please ?

Please try to answer your own questions before asking us.  You can find lots of examples like this:

  $ grep svn_sort__hash subversion/*/*.c
  subversion/libsvn_client/list.c:90:
    array = svn_sort__hash(tmpdirents, ...
  subversion/libsvn_client/mergeinfo.c:162:
    svn_sort__hash(result_catalog, ...
  ...

So here's an example from subversion/libsvn_client/list.c:90:

  /* Sort the hash, so we can call the callback in a "deterministic" order. */
  array = svn_sort__hash(tmpdirents, svn_sort_compare_items_lexically, pool);
  for (i = 0; i < array->nelts; ++i)
    {
      svn_sort__item_t *item = &APR_ARRAY_IDX(array, i, svn_sort__item_t);
      const char *path;
      svn_dirent_t *the_ent = item->value;

Regards,
- Julian
Received on 2012-03-27 11:44:18 CEST

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