How to switch subversion repository in Visual Studio using AnkhSVN?
Asked Answered
P

7

12

I've been developing a project locally and using a local svn server for versioning in visual studio. I now want to switch to xp-dev hosted versioning but cannot seem to get rid of the svn bindings on my solution? Is there an easy way to duplicate a solution without its versioning settings or to simply switch to the other svn (which is completely empty)?

Primus answered 16/2, 2010 at 22:40 Comment(1)
If you need the original source in the local svn server you may want to see the answers to How do I export (and then import) a Subversion repository?.Exerciser
Q
4

Edit: Note that this assumes that you are trying to move to a new repository, dropping all your history, not move a repository. Thinking about it you might want to replace the removing all .svn folders with simply exporting the folder into the newly created workspace for the new repo.

Not that I know of. I'd probably do this,

  • Remove all the .svn folders from your solution
  • Create a folder for the solution in the new repo,
  • Check it out,
  • Move your current solution into that folder,
  • Load up the solution in Visual Studio
  • Use AnkhSvn to add it again. It should pick up the fact that it's in a subversioned directory and allow you to do that.
Quadrivial answered 16/2, 2010 at 22:57 Comment(7)
This makes you loose history. The last point isn't valid either. When you remove all .svn folders, it's no longer in a working copy / 'subversioned directory'Alleviator
Yes, I was under the impression that he was trying to move to a new subversion server not move the subversion repository. Otherwise I'd have suggested he relocate it.Quadrivial
The last point should be valid because assuming your solution is now in a directory in the new workspace AnkhSvn normally picks that fact up. I guess it depends on exactly what folder structure you've created as to whether it works, worst case you might want to add the folder that the actual .sln folder is in manually then use AnkhSvn because it's a lot better at adding the right files for a solution.Quadrivial
When moving the repository to a new server, it's better to check out svnbook.red-bean.com/nightly/en/… on this. If you do it like you said, you will still loose all history.Alleviator
Yes, I don't disagree, I was just under the impression that the original questioner didn't care about the history.Quadrivial
I was initially hoping to keep my history but in the end i have actually done it this way!Primus
Also you can right click on solution or project and on the Subversion menu the option "switch project" is available.Jackquelinejackrabbit
A
39

There's a switch/relocate built-in:

  • Open View -> Pending Changes
  • Click the dropdown that shows the current repository url, or the button to the right of that
  • Enter / browse to the new location
  • A dialog comes up wether you want to relocate (because switching isn't enough here)
Alleviator answered 17/2, 2010 at 22:51 Comment(2)
Just adding that this is implemented as a switch with automatic relocate suppoprt if a switch would fail.Vo
AnkhSVN has changed the menu options. Now the Pending Changes view is off of the Subversion sub-menu under File. So do File -> Subversion -> Pending ChangesLemmons
Q
4

Edit: Note that this assumes that you are trying to move to a new repository, dropping all your history, not move a repository. Thinking about it you might want to replace the removing all .svn folders with simply exporting the folder into the newly created workspace for the new repo.

Not that I know of. I'd probably do this,

  • Remove all the .svn folders from your solution
  • Create a folder for the solution in the new repo,
  • Check it out,
  • Move your current solution into that folder,
  • Load up the solution in Visual Studio
  • Use AnkhSvn to add it again. It should pick up the fact that it's in a subversioned directory and allow you to do that.
Quadrivial answered 16/2, 2010 at 22:57 Comment(7)
This makes you loose history. The last point isn't valid either. When you remove all .svn folders, it's no longer in a working copy / 'subversioned directory'Alleviator
Yes, I was under the impression that he was trying to move to a new subversion server not move the subversion repository. Otherwise I'd have suggested he relocate it.Quadrivial
The last point should be valid because assuming your solution is now in a directory in the new workspace AnkhSvn normally picks that fact up. I guess it depends on exactly what folder structure you've created as to whether it works, worst case you might want to add the folder that the actual .sln folder is in manually then use AnkhSvn because it's a lot better at adding the right files for a solution.Quadrivial
When moving the repository to a new server, it's better to check out svnbook.red-bean.com/nightly/en/… on this. If you do it like you said, you will still loose all history.Alleviator
Yes, I don't disagree, I was just under the impression that the original questioner didn't care about the history.Quadrivial
I was initially hoping to keep my history but in the end i have actually done it this way!Primus
Also you can right click on solution or project and on the Subversion menu the option "switch project" is available.Jackquelinejackrabbit
C
2

Try going to File > Subversion > Change Source Control... and changing the SCC Binding URL.

EDIT: I see that's not editable. You may need to drop to the command line for this.

In your base directory, issue this svn command:

svn switch --relocate http://old.repo.location http://new.repo.location

with your speific URLs, of course. I'd recommend reading up on the switch command so you're sure of what you're doing. When you reopen VS, AnkhSVN should pick up the new bindings. If you've added the solution through the File > Subversion menu, you may need to edit the .sln file. Just open it in a text editor and change all of your old repository URLs to the new URL.

You could also install TortoiseSVN and use the context menu to issue the Relocate command. This will be the easiest.

Back up your directory before any of these changes, of course.

Canticle answered 16/2, 2010 at 23:18 Comment(3)
Hmm, it won't let me change the text in that fieldPrimus
The relocate is what you do if you've just moved the repository, like you've changed the folder it's in or moved it onto a web server. I don't think it works if you're pointing to another completely different repository. I believe the revision numbers, history, etc. essentially have to be the same, i.e. essentially the same repo for it to be useful.Quadrivial
@Colin: --relocate checks that the repository UUIDs are the same. If the repository was correctly exported & imported at xp-dev, they will be the sameAlleviator
J
2

Also you can right click on solution or project and on the Subversion menu the option "switch project" is available

subversion server name change with ankhsvn

Jackquelinejackrabbit answered 22/5, 2012 at 9:24 Comment(0)
C
2

Other way is to edit wc.db (SQLite file) in your ".svn" folder, which contains repository URL. I used Firefox addon SQLITE editor, then in table REPOSITORY is only 1 row saying your repository URL, change it to new host and there you go.

My case was that I have new computer with new HOST, so all my projects added to SVN repository had and old URL (old hostname).

Crin answered 25/8, 2015 at 19:26 Comment(0)
O
0

I "exported" from SVN, then did an "Add Folder" to the new repo in the SVN Repo Browser, then opened the .sln in Visual Studio.

Oriflamme answered 22/10, 2012 at 3:1 Comment(0)
S
0

In my case I had to change the URL of the SVN because the DNS didn't know about the hostname so I had to use the IP address.

You can edit your hosts file located under: C:\Windows\System32\drivers\etc

And simply enter a line like

xxx.xxx.xxx.xxx     hostname
Skeptical answered 13/9, 2017 at 13:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.