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

Re: Probably bug with svn copy

From: Saulius Grazulis <grazulis_at_akl.lt>
Date: 2005-04-13 08:00:35 CEST

I beleive the sv bahaviour is correct:

On Tuesday 12 April 2005 16:34, Robert S. Sfeir wrote:

> a new repository with the following structure is needed for testing:
>   myProject
> myProject/tags
> myProject/trunk
> myProject/trunk/Dir1
> myProject/trunk/Dir1/SubDir1
> myProject/trunk/Dir1/SubDir1/file1.txt
> myProject/trunk/Dir2
> myProject/trunk/Dir2/SubDir1
> myProject/trunk/Dir2/SubDir1/file2.txt
> myProject/trunk/Dir3
> myProject/trunk/Dir3/SubDir1
> myProject/trunk/Dir3/SubDir1/file3.txt
>
> Once you have the repository buit with this structure, create a tag  
> of each SubDir1 into tags1 in the tags directory and watch what happens:
>
> svn copy myProject/trunk/Dir1/SubDir1 myProject/tags/tag1
>
> A    tags/tag1  (I see that file1.txt is in this directory, which is  
> what I expect)

You have created a *new* directory 'tags/tag1', which is a copy of
'trunk/Dir1/SubDir1'. The contents of SubDir1/ ended up in tag1/

> svn copy myProject/trunk/Dir2/SubDir1 myProject/tags/tag1
>
> A    tags/tag1/SubDir1  (for some reason in this case it creates  
> SubDir1 with file2.txt in it)

You have copied 'trunk/Dir2/SubDir1/' *into* the *existing* directory
'tags/tag1'. In addition to the contents of 'trunk/Dir1/SubDir1', tag1 now
contains 'SubDir1' as well, which is the copy of 'trunk/Dir2/SubDir1/'.

> svn copy myProject/trunk/Dir3/SubDir1 myProject/tags/tag1
>
> Fails because SubDir1 already exists.

And so it should, since 'tags/tag1' already contains 'SubDir1'

NB: regular unix cp woudl behave exactely the same...

> This behavior is inconsistent, what I expected would happen is either:
> 1- SubDir1 would be created the first time with file1.txt in it and  
> fail the other 2 times after it
> 2- file1.txt, file2.txt and file3.txt would all end up in tag1.

The point is that

svn copy dir1 dir2

copies the directory itself, not its contents.

Probably

svn copy dir1/* dir2

would be handy (i.e. shell expands dir1/*, and 'svn copy' handles a request to
copy multiple files into a directory, just like regular cp ;).

-- 
Saulius Gražulis
Visuomeninė organizacija "Atviras Kodas Lietuvai"
P.Vileišio g. 18
LT-10306 Vilnius
Lietuva (Lithuania)
tel/fax:      (+370-5)-210 40 05
mobilus:      (+370-684)-49802, (+370-614)-36366

  • application/pgp-signature attachment: stored
Received on Wed Apr 13 08:03:33 2005

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

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