tags:

views:

56

answers:

3

Hi,

Has anyone encountered something like this?

I was expecting file.txt to be inside "testbranch/src/" folder after executing the command written command. But I get entry at "testbranch/src" to be a file type rather than directory type! In Web browser if I look under src folder of testbranch, it shows file contents of file.text.

svn copy "https://repos/svn/myrepo/trunk/src/file.txt" "https://repos/svn/myrepo/branches/testbranch/src/" -m "Testing"

A: 

If the output directory didn't exist before you ran the command, this is just what you would get. Just as you would with the plain 'cp' command on Linux. You needed to do an svn mkdir of the src directory on the output side first.

bmargulies
Thanks bmargulies.It works out using svn mkdir but my requirement is to create the parent folders if not present. Using --parent option with svn copy command didnt help either.
Gabriel Parenza
Doesn't --parents work if you put the full pathname on the output, not just the file name? I've never tried it.
bmargulies
I am indeed giving the full path name, always use absolute path.
Gabriel Parenza
+2  A: 

If you are are using SVN 1.6.X you can simple do it like the following.

svn copy --parents "https://repos/svn/myrepo/trunk/src/file.txt" "https://repos/svn/myrepo/branches/testbranch/src/" -m "Testing"

The --parents will create intermediate folders.

khmarbaise
Thanks khmarbaise for the quick reply. --parents didn't make any difference. I am still getting the same kind of output.
Gabriel Parenza
what does svn log -v https://repos/svn/myrepo/branches/testbranch/src print out? It seemed you have created src as a file instead of a folder. You have to delete it first and redo the copy operation svn cp --parent URL/file.txt URL/testbranch/src/file.txt .. a second time.
khmarbaise
Yes it did create the src folder as a file when I did not give -parents option. I also did the same you mentioned, delete first and then copy, but it didn't work out!!!
Gabriel Parenza
+1  A: 

Can you do:

svn copy https://repos/svn/myrepo/trunk/src/file.txt https://repos/svn/myrepo/branches/testbranch/src/file.txt -m "Testing" --parents

(i.e. why not use the filename in the destination path? that will give you the behavior you're looking for)

William Leara
No it does not work like that. Destination can only be a directory and not a file, otherwise SVN tries to look for the location testbranch/src/file.txt/file.txt and fails afterwards.
Gabriel Parenza