Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Idiots guide to moving a directory up in SVN

No, this is not a duplicate of this.

While I'm normally used to using visual tools with SVN, I find myself now faced with wanting to move Repo/Parent/ChildX/ChildY to Repo/ChildY. I receive the following errors and am just looking for what I'm missing here. Consider the server just installed (from a dump), nothing else available but svn.

> svn checkout https://localhost/Repo
svn: OPTIONS of 'https://localhost/Repo': 200 OK (https://localhost)

> svn move Repo/Parent/ChildX/ChildY Repo/ChildY
svn: 'Repo' is not a working copy
svn: 'Repo' does not exist

> svn move Parent NewParent
svn: '.' is not a working directory

> svn move https://localhost/Repo/Parent NewParent 
svn: Moves between the working copy and the repository are not supported

> svn move https://localhost/Repo/Parent https://localhost/Repo/NewParent
svn: OPTIONS of 'https://localhost/Repo': 200 OK (https://localhost)

> svn commit --message "Trying to get move command to work"
svn: 'C:\SVNTest' is not a working copy

I find it somewhat odd that the first command (checkout) gives the same response for whatever I put behind 'Repo', like https://localhost/Repo/SomeNonExistingName. I'm sure I'm missing something. I found references saying that you don't need a working copy for a move, but then, how do I do a move?

None of the commands above, whether they gave an error or OK, did an actual move. I use VisualSVN Server, and can browse the repo online.


Solution

The accepted solution below and other answers have helped solve this issue. The response to the first command above is equal to a regular response from any Apache server. The 200 OK is the HTTP response.

When using VisualSVN Server, the default installation is under https://hostname/svn. To checkout, you need to prefix the repository name with that path. The first command above should've read:

> svn checkout https://localhost/svn/Repo
file1
file2
etc...
Revision XXX

Unfortunately, this little gotcha, however trivial, isn't mentioned anywhere. After the checkout, from the same directory, the move becomes trivial:

> svn move Folder/SubFolder NewFolder
like image 247
Abel Avatar asked Jan 21 '10 12:01

Abel


2 Answers

Assuming that you have a valid checkout, the easiest way would be something like this (where you replace REPO_URL with the correct URL):

svn co REPO_URL
cd Repo
svn mv Parent/ChildX/ChildY .
svn commit -m "moved directory"

That assumes, of course, that you don't have the standard trunk / tags / branches directories.

Which brings me to the question that you have to answer: what does the checked-out working directory look like? Does it have the structure that you expect, or does it perhaps have some directories that you don't know about? Do you see a .svn directory under Repo?


Edit: I've never used the Visual SVN server, but if you have your repository on an accessible filesystem, you could always use a "file" URL:

svn co 'file:///localhost/Repo'

Or alternatively (after have just looked at what VisualSVN calls "documentation"), I'd suggest checking out your working directory through Visual SVN, then doing the commands above.

Plus, it appears that Visual SVN creates the trunk/tags/branches directories, so you definitely want to cd into the working directory and run your commands there, once you've verified the directory structure.

like image 61
kdgregory Avatar answered Oct 01 '22 04:10

kdgregory


It looks to me as though your checkout is failing.

If it succeeds you'll generally get a list of checked-out files followed by the line "Checked out revision XXXXX."

Some of the suggestions from this thread might be helpful. In particular, you may not have the svn server set up properly for https access. Once you get it fixed, you should just be able to follow the instructions in the thread you linked.

Please update / comment / reply if fiddling with your 'svn checkout' line doesn't resolve the problem.

like image 32
Arkaaito Avatar answered Oct 01 '22 04:10

Arkaaito