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.
Version ControlLinux

Avatar of undefined
Last Comment
Michael Sole

8/22/2022 - Mon
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 :)
F. Dominicus

svn  copy followed with a svn delete would have been the "right" stuff.
Michael Sole

ASKER
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?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
rushtoshankar

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 Sole

ASKER
rushtoshankar is svn a repo? Or are test1/test2 repos?
rushtoshankar

Test1 and test2 are repo names.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Michael Sole

ASKER
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.
rushtoshankar

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 Sole

ASKER
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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
rushtoshankar

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Michael Sole

ASKER
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 Sole

ASKER
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