Andy
Andy

Reputation: 2830

files end up in wrong directory after svn copy

I want to copy the trunk of one project to another, so I use the following command:

svn copy -m "test" (url of project from)/Trunk/ (url of project to)/Trunk/

The files ended up in (url of project to)/Trunk/Trunk/ instead of (url of project to)/Trunk/ where I want them to go.

Have I done something wrong? What should I do if I do if I want the files in (url of project to)/Trunk/? Doing the the following does not seem to make sense:

svn copy -m "test" (url of project from)/Trunk/ (url of project to)/

Upvotes: 3

Views: 2769

Answers (4)

Jet Abe
Jet Abe

Reputation: 1

What happened with me was the desitnation path exists as a result SVN was copying inside the directory

I deleted the destination directory performed a copy and that seemed to do the job.

Maybe i should have done svn copy with force option but i went svn rm and then svn copy.

Upvotes: 0

namespaceform
namespaceform

Reputation: 690

Also, while creating a branch (or "branching", which to svn, is just a fancy term for copy), if you be proactive and first create the branch directory you get the same problem.
Suppose you want to move from your old "single-directory" approach to the "trunk-branch" approach.
You start with http://my/path
and want to go to a structure like this:
http://my/path/trunk,
http://my/path/branches/foo and
http://my/path/branches/bar

So if you first create the branch directories:
# svn mkdir http://my/path/branches
# svn mkdir http://my/path/branches/foo
# svn mkdir http://my/path/branches/bar
And then try this:
# svn copy http://my/path/trunk http://my/path/branches/foo

'trunk' gets copied into the branch:
# http://my/path/branches/foo/trunk/...

If you try to use wildcards, well, wildcards don't work:
# svn copy http://my/path/trunk/* http://my/path/branches/foo

The only way it all works is to NOT mkdir branches/foo but directly do this:
# svn copy http://my/path/trunk http://my/path/branches/foo

This works.

Upvotes: 9

Gleb
Gleb

Reputation: 2452

If something in your destination already exists you need to delete it before copying there something else. It is also possible that svn copy isn't the right thing to do in your case but it's hard to guess.

Upvotes: 0

pgb
pgb

Reputation: 25011

You should do svn copy -m "test" (url of project from)/Trunk/ (url of project to)/ to copy the trunk to project to, since you are copying the whole folder.

I'm not sure if wildcards are allowed in svn copy, to do something like /trunk/*, you should check the docs.

Upvotes: 1

Related Questions