21

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?

Jon Hadley
  • 5,196
  • 8
  • 41
  • 65

4 Answers4

15

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.

knittl
  • 246,190
  • 53
  • 318
  • 364
Eli Acherkan
  • 6,401
  • 2
  • 27
  • 34
  • however, i get the error, even though it really is the same dir within the same repo... – Erik Aronesty Sep 30 '13 at 14:25
  • Well, I don't know if something has changed in the last 6 years, and I haven't researched the details thoroughly, but we just migrated our whole repository 'as-is' to a new server, and this command structure worked just fine to 'switch' existing checked-out work folders to work against the new repo: `svn switch --relocate svn://oldserver/ http://newserver/svn/goteam/`. i.e. - New protocol, new server, new folder spec. - Worked fine. Maybe SVN checks that the relevant repos are essentially the same and allows if so? – spechter Jan 29 '19 at 23:16
2

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.

1

What can happen too is that you are doing the relocate on a child of the root.

Try to do a relocate on the root folder. All the children folders will be automatically relocated too.

Breiz
  • 1,153
  • 2
  • 13
  • 27
0

Well im assuming youve already actually migrated the repository via svnadmin dump/svnadmin load so in that case you could try: svn switch --relocate https://newserver/some/directory If you get the same error you might actually have to just do a new svn co. I dont recall ever coming across that error but then all my repos use a nested structure like the one youre moving to so its possible ive never had to deal with it :-)

prodigitalson
  • 60,050
  • 10
  • 100
  • 114
  • My repository was far too big for an easy svnadmin dump (it's used for binary files among others), so I svn co'd into a fresh directory and svn commited.... – Jon Hadley Jan 28 '10 at 14:59
  • The repository is co'd to more than one location (live server, dev server, 2 devs machines etc). It's a big repository and I'd rather not have to download it all over again - reading into switch it seemed that switch could just change the url's that the repos used... – Jon Hadley Jan 29 '10 at 10:18