Idiots guide to moving a directory up in SVN
Asked Answered
R

3

6

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
Reticular answered 21/1, 2010 at 12:20 Comment(5)
It looks to me as if your checkout is failing - all the other commands are meaningless if that didn't work.Scop
@Neil And how do I check whether my checkout is failing, and/or, how do I make it work? What should be the expected response from Checkout?Reticular
Go into the Repo directory and look around. Verify that it exists, and that there's a .svn directory under it. Verify that the file structure is what you expect.Chinaman
I see that you resolved the checkout issue. Assuming that everything else works, please add that solution into your original question for future people with a similar problem.Chinaman
I was figuring something like that. I will :)Reticular
C
3

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.

Chinaman answered 21/1, 2010 at 12:28 Comment(5)
Yes, you can ask VisualSVN to create the default dirs, but I didn't. The thing is, isn't a "working directory" a copy of what's in SVN? I don't seem to be able to get that working directory. When doing the file:/// trick, I received svn: Unable to open an ra_local session to URLReticular
Alright, I got it! I think Idiot was quite well placed in the title. The default Visual SVN installation listens on https://hostname/svn. Anything (repo name) must be prefixed with that. So, svn checkout https://localhost/svn/Repo worked correctly. And it asked for my login pwd, which it didn't before.Reticular
Technically, the working copy is a view of some part of the repository. Normally, if you check out the root of the repository you get everything under that root, which includes all the tags and branches. When using the visual tools, it looks like VisualSVN hides all of that. So it's probably best to use the visual tool to get your working directory, and then the command-line tools from there (I'm assuming that the visual tool can't do the move itself?)Chinaman
Perhaps it can, but I'm preparing a new server on which installing Visual Studio is prohibited. Only the SVN server may be used there. While waiting for another company that must open certain ports, I'm restricted to using the command line. So: I'm using VisualSVN Server, not the client (yet). SVN runs under Apache and instead of running from the root, it (apparently) runs from /svn/. All repositories must then be prefixed with /svn/ to work correctly.Reticular
all comments helped towards a solution, accepting this one, hope that's ok :)Reticular
S
1

In response to your comment, what should a checkout look like, this is the tail of a checkout of one of my own projects:

A    dblite\tags\pre-codeblocks\src\sqlite3.h
A    dblite\tags\pre-codeblocks\inc
A    dblite\tags\pre-codeblocks\inc\dblite.h
Checked out revision 31.

And of course, t should create the directory structure, which it seems yours isn't doing.

Scop answered 21/1, 2010 at 12:29 Comment(1)
Indeed, it isn't. How to fix that? See also comment under Arkaaito's.Reticular
F
1

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.

Falk answered 21/1, 2010 at 12:30 Comment(6)
I indeed did not receive "checked out revision XXX". I believe the HTTPS is setup correctly (SSL cert added etc): I can browse fine. What's wrong with the checkout command then?...Reticular
The error is (almost) equal to in the referred to thread. It is as mentioned in the question. Is it possible that the svn commandline doesn't support HTTPS? The first time it requested whether I should accept the SSL certificate permanently, which I did. After that, only OPTIONS as answer...Reticular
@Reticular If you do a "svn --version" it should list the various access methods and protocols it supports.Scop
The reason it gave such an odd answer, in retrospective, is that it was the normal answer of Apache. What got me on the wrong foot was the end of the response "200 OK". But that was the answer the server gave. Thanks for your help.Reticular
Generally, you should be able to use https on the SVN command line. What happens if you type svn list https://localhost/Repo?Falk
See my comments on kdgregory's answer: the reason, in the end, was because the default install for Visual SVN Server installs SVN under https://servername/svn. Any repository comes underneath: https://servername/svn/repoReticular

© 2022 - 2024 — McMap. All rights reserved.