Link to home
Start Free TrialLog in
Avatar of Michael Sole
Michael Sole

asked on

Move working copy to a new repository on the same server

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.
Avatar of Michael Sole
Michael Sole

ASKER

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 :)
Avatar of F. Dominicus
svn  copy followed with a svn delete would have been the "right" stuff.
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?
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
rushtoshankar is svn a repo? Or are test1/test2 repos?
Test1 and test2 are repo names.
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.
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.
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.
ASKER CERTIFIED SOLUTION
Avatar of rushtoshankar
rushtoshankar
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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