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

Re: Minor annoyance in svn add

From: Kirby C. Bohling <kbohling_at_birddog.com>
Date: 2002-10-25 20:43:51 CEST

On Fri, 2002-10-25 at 13:36, Philip Martin wrote:
> Noel Yap <yap_noel@yahoo.com> writes:
>
> > --- Philip Martin <philip@codematters.co.uk> wrote:
> > > Rafael Garcia-Suarez
> > > <raphel.garcia-suarez@hexaflux.com> writes:
> > >
> > > > What do you mean, "number of components" ?
> > > ./././///./foo is still longer that foo/bar.
> > >
> > > Use svn_path_decompose and don't count
> > > SVN_EMPTY_PATH components.
> >
> > Whenever I've needed to do this in the past, I used
> > sort to "alphabetize" the list. I think it should
> > work since "foo" comes before "foo/bar" in such a
> > sort. Assuming svn_path_decompose gets rid of "./"
> > and "//", using it before sorting should do what's
> > needed.
>
> It's not a simple problem however you do it. Consider
>
> $ cd /xxx/xxx
> $ mkdir aaa
> $ mkdir aaa/aaa
> $ svn add aaa/aaa /xxx/xxx/aaa
>
> where we need /xxx/xxx/aaa before aaa/aaa, versus
>
> $ cd /aaa
> $ mkdir xxx
> $ mkdir xxx/xxx
> $ svn add /aaa/xxx/xxx xxx
>
> where we need xxx before /aaa/xxx/xxx
>
> I think the general solution is to call svn_path_get_absolute and then
> sort using svn_path_is_child. A bit like svn_path_condense_targets.

Just an idea. Add the equivilent of mkdir -p,--parents, which means if
there is a component of this path which you must add first, add it, then
add the subcomponent all the way down. Maybe --add-parents instead of
--parents. If svn prints an error for adding something that is already
added that might be an issue, but possibly supressing it when --parents
would work. I always use this when I'm scripting up the creation of a
path, because it's easier then ensuring the entire path exists. I
suppose it might be slower then the other way. However, your solving
the problem more directly which appeals to me.

        Kirby

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

-- 
Real Programmers view electronic multimedia files with a hex editor.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Oct 25 20:55:36 2002

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

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