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

Re: Re: RE: Repobrowser - Numeric order filename sorting

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: 2006-04-11 13:07:11 CEST

On 4/11/06, Gerasimov, Ivan <Ivan.Gerasimov@transas.com> wrote:

> > > The comparing routine may not be so complicated. The following algorithm > may be used: 1) skip same leading chars, 2) if remaining parts begin with > digits, compare strings numerically 3) otherwise, compare strings
> > literally.
> >
> > > Below is a sample function.
> > > It's not perfect, but it works for the most cases.
> ^^^^^^^^
> > that's not good enough. It must work in all cases. Otherwise we'll get
> > tons of bug reports like "numeric sorting doesn't work when ..." or
> > "sorting corrupt if..." or " ...".
> > Also, you should know that 'numeric sorting' depends on the currently
> > used locale - it's not done the same way everywhere.
>
> Yes, you're right on that.
>
> > Another thing you might consider:
> > what if the numbers actually are dates? The user then might want to
> > sort by date, and the 'numeric sorting' does it wrong because it
> > doesn't treat them as dates.
> > So we then again will get bug reports (after all, the sorting doesn't
> > do what the user expected).
>
> 2004.06.12
> 2005.06.12
> 2005.07.12
> 2005.07.13
>
> What's wrong with dates?

Not every local uses that date format.
19.03.1973
20.08.1945
01.01.2006
will give completely wrong results.

> How come null char will make the clause true?
> ((0 || 0) && 0 == 0) == false.

Ups - sorry.

> > No you successfully handled strings like
> > v103
> > v204
> > v387
> > But, it still will be wrong for strings like
> > v1.3.2
> > v1.7.8
> > because you stop at the first '.' char.
> > You cold try using the atol() function, but that will also only work
> > with one '.' char (or ',', depending on the locale), not two or three.
>
> It doesn't stop at the first '.'
> And the function will handle v1.3.2, v1.7.8 and alike correctly.
> Just check it carefully :-)

Well, the '.' isn't an alpha char, but it's not a numeric char either.
So it will stop there.
At least it will on my system, because the '.' is not the decimal
separator. But of course, since the project is kept english, the dot
is used for the tag names.

Stefan

--
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Tue Apr 11 13:07:29 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.