You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by ep...@pretzelnet.org on 2002/07/27 02:09:50 UTC

[PATCH] Sort path names with strcoll(3)

I noticed svn ls output wasn't sorted according to locale information,
so i patched svn_path_compare_paths_nts to use strcoll(3).  The results:

0 trunk% ./subversion/clients/cmdline/svn ls http://mandark/repo/test/
http://mandark/repo/test:
_      86      epg        0 Jul 26 21:07 Makefile
_      86      epg        0 Jul 26 21:07 barf
0 trunk% LC_COLLATE=en_US ./subversion/clients/cmdline/svn ls http://mandark/repo/test/                   
http://mandark/repo/test:
_      86      epg        0 Jul 26 21:07 barf
_      86      epg        0 Jul 26 21:07 Makefile

I'd also like to change print_dirents in ls-cmd.c to sort and print
directories first, and then files, but Garret Rooney wasn't convinced.
Before i invest the effort, what does everyone think?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Sort path names with strcoll(3)

Posted by Marcus Comstedt <ma...@mc.pp.se>.
Greg Stein <gs...@lyra.org> writes:

> On Sat, Jul 27, 2002 at 04:37:06AM +0200, Branko Cibej wrote:
> > epg@pretzelnet.org wrote:
> > >I noticed svn ls output wasn't sorted according to locale information,
> > >so i patched svn_path_compare_paths_nts to use strcoll(3).  The results:
> 
> I believe that should be apr_strnatcmp() or apr_strnatcasecmp().

Also, care should be taken that the names are converted from UTF-8 to
the native character encoding _before_ those functions are used to
sort the strings.  Otherwise it could get really strange...  :-)


  // Marcus



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Sort path names with strcoll(3)

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Jul 27, 2002 at 04:37:06AM +0200, Branko Cibej wrote:
> epg@pretzelnet.org wrote:
> >I noticed svn ls output wasn't sorted according to locale information,
> >so i patched svn_path_compare_paths_nts to use strcoll(3).  The results:

I believe that should be apr_strnatcmp() or apr_strnatcasecmp().

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Sort path names with strcoll(3)

Posted by Branko Čibej <br...@xbc.nu>.
epg@pretzelnet.org wrote:

>I noticed svn ls output wasn't sorted according to locale information,
>so i patched svn_path_compare_paths_nts to use strcoll(3).  The results:
>
>0 trunk% ./subversion/clients/cmdline/svn ls http://mandark/repo/test/
>http://mandark/repo/test:
>_      86      epg        0 Jul 26 21:07 Makefile
>_      86      epg        0 Jul 26 21:07 barf
>0 trunk% LC_COLLATE=en_US ./subversion/clients/cmdline/svn ls http://mandark/repo/test/                   
>http://mandark/repo/test:
>_      86      epg        0 Jul 26 21:07 barf
>_      86      epg        0 Jul 26 21:07 Makefile
>

+0, but I'd rather use something from APR instead of strcoll, even 
though that's a standard function.

>I'd also like to change print_dirents in ls-cmd.c to sort and print
>directories first, and then files, but Garret Rooney wasn't convinced.
>Before i invest the effort, what does everyone think?
>  
>

Nah, that doesn't make sense. Neither "dir" on Windows nor "ls" on Unix 
do that. If you want directories first, use a GUI (but write one first .-).

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org