Change SVN repository URL
Asked Answered
D

7

148

My current SVN structure:

Path: .
URL: svn://someaddress.com.tr/project
Repository Root: svn://someaddress.com.tr
Repository UUID: -------------------------------------
Revision: 10297
Node Kind: directory
Schedule: normal
Last Changed Author: ----
Last Changed Rev: 9812
Last Changed Date: 2010-12-20 17:38:48 +0100 (Mon, 20 Dec 2010)

But our project (hence the SVN service) will work over sub.someaddress.com.tr instead of someaddress.com.tr (someaddress.com.tr will be redirected to somewhere else soon).

Since it is the development server, I could not be sure about what to do. Will I need to use svn switch or svn switch --relocate? Also, will I need to switch svn root someaddress.com.tr or the project branch someaddress.com.tr/project?

Dissatisfactory answered 19/12, 2012 at 1:22 Comment(1)
for anyone need changing svn url, see: SVN-relocate-error-invalid-relocation-destinationPerpetuate
U
255

Given that the Apache Subversion server will be moved to this new DNS alias: sub.someaddress.com.tr:

  • With Subversion 1.7 or higher, use svn relocate. Relocate is used when the SVN server's location changes. switch is only used if you want to change your local working copy to another branch or another path. If using TortoiseSVN, you may follow instructions from the TortoiseSVN Manual. If using the SVN command line interface, refer to this section of SVN's documentation. The command should look like this:

    svn relocate svn://sub.someaddress.com.tr/project

  • Keep using /project given that the actual contents of your repository probably won't change.

Note: svn relocate is not available before version 1.7 (thanks to ColinM for the info). In older versions you would use:

    svn switch --relocate OLD NEW
Undenominational answered 19/12, 2012 at 1:38 Comment(3)
The additional TortoiseSVN links are very helpful, thanks for thatCognizance
Didn't know about the switch command all the documentation I found online is for newer versions.Drawplate
This comes handy when I need to relocate from +ssh URL to non-SSH or vice versa, for example: svn switch --relocate svn+ssh://_svn_server_/_svn_project_/_svn_branch_ svn://_svn_server_/_svn_project_/_svn_branch_. The last is especially helpful if you do automated checkout as svn+ssh on several nodes using Jenkins API and some of them (Windows nodes) don't have SSH, but you need to login to the build machine and "svn update" manually to test some quick fix.Marseilles
S
17

Grepping the URL before and after might give you some peace of mind:

svn info | grep URL

  URL: svn://svnrepo.rz.mycompany.org/repos/trunk/DataPortal
  Relative URL: (...doesn't matter...)

And checking on your version (to be >1.7) to ensure, svn relocate is the right thing to use:

svn --version

Lastly, adding to the above, if your repository url change also involves a change of protocol you might need to state the before and after url (also see here)

svn relocate svn://svnrepo.rz.mycompany.org/repos/trunk/DataPortal
    https://svngate.mycompany.org/svn/repos/trunk/DataPortal

All in one single line of course.Thereafter, get the good feeling, that all went smoothly:

svn info | grep URL:

If you feel like it, a bit more of self-assurance, the new svn repo URL is connected and working:

svn status --show-updates
svn diff
Sb answered 2/1, 2017 at 13:31 Comment(0)
C
14

If you are using TortoiseSVN client then you can follow the below steps

Right-click in the source directory and then click on SVN Relocate Image#1

After that, you need to change the URL to what you want, click ok, it will be taking a few seconds.Image#2

Crocodilian answered 15/2, 2021 at 4:58 Comment(1)
To see this menu on right click of a folder, first you may need to enable the setting via: right click on folder > svn settings > context menu > select Relocate option.Jilli
S
6

In my case, the svn relocate command (as well as svn switch --relocate) failed for some reason (maybe the repo was not moved correctly, or something else). I faced this error:

$ svn relocate NEW_SERVER
svn: E195009: The repository at 'NEW_SERVER' has uuid 'e7500204-160a-403c-b4b6-6bc4f25883ea', but the WC has '3a8c444c-5998-40fb-8cb3-409b74712e46'

I did not want to redownload the whole repository, so I found a workaround. It worked in my case, but generally I can imagine a lot of things can get broken (so either backup your working copy, or be ready to re-checkout the whole repo if something goes wrong).

The repo address and its UUID are saved in the .svn/wc.db SQLite database file in your working copy. Just open the database (e.g. in SQLite Browser), browse table REPOSITORY, and change the root and uuid column values to the new ones. You can find the UUID of the new repo by issuing svn info NEW_SERVER.

Again, treat this as a last resort method.

Soybean answered 17/5, 2016 at 19:25 Comment(5)
@IgorGanapolsky: Could you be more specific?Soybean
If you read my post carefully, I do not suggest to run any commands. I suggest editing the SQLite DB.Soybean
But editing the SQLite DB involves running commands. SQL commands.Philippines
Turns out you can't use sqlite; you have to use sqlitebrowser as suggested. Weird.Philippines
I did it with sqlite3 and it worked pretty well in my case. On terminal: sqlite3 wc.db then: sqlite> update REPOSITORY set root='svn+ssh://192.168.0.20/var/svn-repos/myrepo' where id=1; check your value with select * from REPOSITORY;Climactic
G
2

This was a little painful for me to get the full command line instruction. The suggestion by @Mahi works, but my goal was to automate this through commandline. The following is what worked for me:

svn relocate https://10.29.52.20/svn/src https://10.32.128.41/svn/src --non-interactive --username=myuser --password=mypass --trust-server-cert-failures=unknown-ca,cn-mismatch,expired,not-yet-valid,other w:/src
  • The first web address is the "FROM" or old address
  • The second web address is the "TO" or new address.
  • Substitute your svn username and password in place of myuser and mypass.
  • The other tricky part was making sure to include the source code path ... which in my case was w:/src.
Goldina answered 30/6, 2022 at 20:1 Comment(0)
Q
1

If U want commit to a new empty Repo ,You can checkout the new empty Repo and commit to new remote repo.
chekout a new empty Repo won't delete your local files.
try this: for example, remote repo url : https://example.com/SVNTest cd [YOUR PROJECT PATH] rm -rf .svn svn co https://example.com/SVNTest ../[YOUR PROJECT DIR NAME] svn add ./* svn ci -m"changed repo url"

Quantum answered 25/6, 2018 at 6:28 Comment(1)
What will this do to the history?Zak
F
1

In Eclipse, disconnect the project (Team > Disconnect) and delete the metadata, then connect the project to the new repository. over the project, right click, team, disconnect enter image description here

Frothy answered 27/7, 2021 at 23:41 Comment(1)
what is the metadata path? How to connect to new repo?Planck

© 2022 - 2024 — McMap. All rights reserved.