How to: Changing to the new SVN URL

There are 2 ways to switch. First one is if you have no problems working with repositories right now and you don’t have any uncommitted changes. Second way is more suitable if you have problems committing.

The easy way

Step 1.
Make sure that you committed everything. You can do this in the console by running the ‘svn status’ command.

Step 2.
Create a backup copy of your checkout. Simply copy top directory of your local checkout to some other place on your computer.

Step 3.
Figure out your correct repository URL. You can do that by running ‘svn info’ in the top directory of your checkout. You’ll see something like this:

    $ svn info
    Path: .
    URL: http://svn.wildbit.beanstalkapp.com/beanstalk

Step 4.
Switch the SVN URL by using subversion internal facility. Go to top directory of your local checkout and run following command, again, in console:

  $ svn switch --relocate http://svn.YOURACCOUNT.beanstalkapp.com/YOUR_REPOSITORY http://YOURACCOUNT.svn.beanstalkapp.com/YOUR_REPOSITORY

First URL argument is the old repository URL that we got in step 3, second argument is your new repository URL. Just use same values instead of YOURACCOUNT and YOUR_REPOSITORY text as in old URL.

Step 5.
Check how it works. The following commands might help:

  $ svn info - this should mention your new repository url.
  $ svn up - should return no errors.

And of course, try committing something.

If you had any problems with the easy way of migrating URLs, do the following. Remove the new checkout that we tried to make here, and copy back the repository checkout you made during Step 2. Then read below, so we move to a more sophisticated way of migration.

The harder way

Step 1.
Move your checkout to a different directory, like repository-backup.

Step 2.
Make sure you committed everything. If for some reason committing doesn’t work for you, do following:

Go to the top directory of your checkout (in my case it is /Users/railsmonk/Beanstalk) and do the following:

Note: The following will only work on Mac and Linux. For Windows, you will have to copy the files manually. Contact support for help.

 
  $ svn diff > uncommitted-changes.patch

This command will put all uncommitted changes in a patch file, so we can apply it later. Copy that patch file to some other directory.

Step 3.
Create a new fresh checkout, using the new repository URL. You can look up new repository URL in the Beanstalk UI in the Activity page of your repository (in the sidebar).

  $ svn co http://wildbit.svn.beanstalkapp.com/Beanstalk

Step 4.
If you created a patch in Step 2, go to your new checkout top directory, and apply patch with the following command:

  $ patch -p0 < /path/to/uncommitted-command.patch

Then try running ‘svn status’ to see if everything is in proper condition and commit the changes.

That’s it! If you had any issues, please contact support on the right and we will help.