I'm trying to move a working copy folder from it's old dedicated svn server, to a new svn server where it is contained within a sub-folder. Using the following relocate command:
svn switch --relocate https://oldserver/svn/repos https://newserver/some/directory
I get:
svn: 'https://newserver/some/directory ' is not the root of the repository
Which is correct ..... but, err, how do I move the location regardless?
The --relocate option causes svn switch to do something different: it updates your working copy to point to the same repository directory, only at a different URL (typically because an administrator has moved the repository to another server, or to another URL on the same server).
If you are using TortoiseSVN (and I'm sure there's a command line tool for this as well, but I'm using Tortoise), you can simply right-click on your existing working copy folder and select TortoiseSVN –> Relocate. In the dialog that comes up, enter the new location of the repository, and click OK.
Moving files and folders select the files or directories you want to move. right drag them to the new location inside the working copy. release the right mouse button. in the popup menu select Context Menu → SVN Move versioned files here.
Switch your current working copy to the newly created copy in the repository. Again select the top level folder of your project and use TortoiseSVN → Switch... from the context menu. In the next dialog enter the URL of the branch you just created. Select the Head Revision radio button and click on OK.
As far as I understand, you can't use svn switch
(with or without --relocate
) to move to a new repository. Think about it this way: your new repository's HEAD revision is x, your old repository's revision is y, so what is SVN supposed to do with the working copy's base revision?
svn help switch
says that --relocate
is used to:
Rewrite working copy URL metadata to reflect a syntactic change only. This is used when repository's root URL changes (such as a scheme or hostname change) but your working copy still reflects the same directory within the same repository.
Since this is not the case, I'm afraid you'll have to perform a fresh checkout.
I tried the same operation, in this case I had a copy using svnsync in a file: url and moved it using mv /home/me/sync/therepo /home/me/sync/repos/therepo.
The reason: I have several help scripts in the sync catalog that mess up the view of the repos.
svn switch --relocate worked for the most part, except externals that keep complaining.
The solution was brutal: I deleted (rm -rf) the directories with the offending files in them and ran svn update again to refetch the externals.
At least this way I did not have to do the large checkout again.
Also, now I can write instructions for my coworkers when we move the svn server to a new machine later on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With