Move working copy to a new repository on the same server

Michael Sole
Michael Sole used Ask the Experts™
on
I have 2 repos:

http://server1/some/old/path

and

http://server1/new/path

I want to be able to switch a working copy to the new path. I can do that with switch because it is designed to only work within the same repo (so in this case I could move it to some/new/path, providing some was  repo) but I want to move it to the repo "new"

I can use relocate because that is designed to move it to the same path on a new server (so in this case server2/some/old/path).

I can't just delete and re-check out since there are unversioned files inter-mingled and fishing these out is just not practical.

I could delete all "versioned" files and then check out a new version but not sure how to do that.

I also can't mess with the folder structure because of file shares and other issues that make it not practical.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Michael SoleDirector of Support

Author

Commented:
I am going to answer my own question since I have spent a while searching for an answer and didn't find one.

My solution was to delete all the .svn folders from the working copy and re-checkout from the new path with the --force option. The command (which ran on ubuntu) to remove all the .svn folders was:

find . -name ".svn" -type d -exec rm -Rf {} \;

So the first person to respond with something interesting will get all the points :)
fridomCEO/Programmer

Commented:
svn  copy followed with a svn delete would have been the "right" stuff.
Michael SoleDirector of Support

Author

Commented:
fridom I am not sure how that would of been able to do what I did.

Basically I needed to be able to do a in place switch of a working copy to a new path on the same server. I'll give you the points but would you mind explaining how your solution would of worked?
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

rushtoshankarSr Manager Software Development

Commented:
Before doing so, please take a backup of your working copy.

If you are using TortoiseSVN, use the relocate command. Provide the new URL in the 'To URL' section of the window, press OK. It will give you a warning. Press relocate. You are done.

I have a test repo in server1 with path https://server1/svn/test2. I checked out the copy from this URL. Now i moved the repo to a different path under the same server.

My new URL is https://server1/svn/Test1. At client side, I have used the relocate command to move from Test2 to Test1.

Edit: if you want to use the command line option,

svn relocate <new url>

in my example, it is svn relocate https://server1/svn/test1
Michael SoleDirector of Support

Author

Commented:
rushtoshankar is svn a repo? Or are test1/test2 repos?
rushtoshankarSr Manager Software Development

Commented:
Test1 and test2 are repo names.
Michael SoleDirector of Support

Author

Commented:
Or are they paths in the same repo? Cause I tried to relocate my working copy and it failed and according to the svnbook docs it said it should have.
rushtoshankarSr Manager Software Development

Commented:
I initially created a repo called Test2. the path to that repo is https://server1/svn/Test2.
I created branches, tags and trunk folders under this repo. I checked out the files at the client side.

Now I moved the folders under repo Test2 to repo Test1. (basically i renamed the repo name in the server).

Now at the client side i used tortoise svn client to relocate from https://server1/svn/Test2 to https://server1/svn/Test1. I have also  tried svn command line client.

Both worked fine. Now i can do updates/commits etc.
Michael SoleDirector of Support

Author

Commented:
I do not believe you have actually relocated your repository, I use both the command line and tortise and know it doesn't work that way.

To properly reproduce my use case:

Create 2 repos, check out the first. Now the goal is to switch the working copy to the second without moving the folders. This is exactly what I needed to do.
Sr Manager Software Development
Commented:
A completely new repository will be having completely new UUID in which we can't use relocate command. Instead, when you create a second repository, you have to use svnsync to create a copy of the repo, svnadmin setuuid command to update the uuid. This will allow you to relocate. Look at the svnsync

If the UUID is different, SVN wont proceed further as SVN will not check the number of checkins, folder structure etc.

Can you please elaborate what situation made you to relocate to a new repository (of course with different UUID)?  This will help us to move in right direction.
Michael SoleDirector of Support

Author

Commented:
Right, I wasn't asking how to move a repository. I was asking how to update a working copy to a repository that had been moved. As you see, I already posted the solution. I was just hoping to fish for any additional information.

As for why I moved it, I didn't like the logical organization I had in the old repo and wanted to start fresh with a new structure that better suited or new process.
Michael SoleDirector of Support

Author

Commented:
Just an update, after trying my own solution there were still problems with it. So I found a better way. I checked out a copy of the new version to a temporary folder and then copied it over the existing location. This appears to have desired results

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial