Cipher
Cipher

Reputation: 91

Moved repository. Do I use SVN switch, SVN relocate or something else all together

I've been planning a migration of a Subversion repository from a Linux server to a Windows server. I've outlined the steps to the migration as such:

  1. Create a dump of the repository
  2. Transfer the dump file to the destination Windows server
  3. Upload the repository in the new subversion server
  4. Change all references to old repository to new repository

After some frustration I finally reached step 4 but have come to a dilemma...I'm not sure how to change all the references. I've seen that relocate can be used but I've also heard that switch should be used if the structure changes...this is project for work so I NEED to make sure the proper command is used on the last step to avoid fallout.

The current file structure looks like so:

svn://svn@servername/Source/Program Name/bin/Release

The new file structure is dictated by VisualSVN Server and looks like so:

https://ServerName.domain.local/svn/RepositoryName/Source/Program Name/bin/Release

Will relocate work for this or am I going in the wrong direction?

Upvotes: 4

Views: 6373

Answers (4)

AnrDaemon
AnrDaemon

Reputation: 367

The most simplified answer is this:

You use relocate, when you have moved the same data directory to a new server (new base URI).

You use switch, when you want to change between branches (paths with common ancestry) within the same repository.

In both cases repository UUID stays the same.

If you dump complete repository and recover it into a new data directory, you are essentially using the same data directory, repository UUID stays the same. You may use relocate.

If you change UUID or recover into an existing repository, your only choice is to checkout the working copy anew.

Upvotes: 0

Lazy Badger
Lazy Badger

Reputation: 97305

Previous answerers don't read docs

>svn help switch

  2. The '--relocate' option is deprecated. This syntax is equivalent to
     'svn relocate FROM-PREFIX TO-PREFIX [PATH]'.

You must

  • to use svn relocate (because you rewrite more than prefix)
  • Use second form of relocate syntax relocate TO-URL [PATH], see also example in svn help relocate
  2. TO-URL is the (complete) new repository URL to use for PATH.

Examples:

  ...

  svn relocate http://www.example.com/repo/project \

               svn://svn.example.com/repo/project

in example old references svn://svn.example.com/repo/project are replaced by http://www.example.com/repo/project

Upvotes: 5

Philibert Perusse
Philibert Perusse

Reputation: 4106

Use svn switch --relocate I just did it on a repo and it works likes magic. If you are using TortoiseSVN, use the "Relocate" command, not the "Switch" command.

Upvotes: -2

Ivan Zhakov
Ivan Zhakov

Reputation: 4041

Yes, svn switch --relocate command should work. But please note that you have to relocate root of your working copy.

Upvotes: 1

Related Questions