Saturday, 5 November 2016

Explain relocate and switch in SVN.

 70. Explain relocate and switch in SVN.

Solution1:

Relocating is used if you intended to switch servers. For example, if you wanted a working copy to no longer reference svn://192.168.1.35/DDL2/trunk/DD_L2DP in favor of svn://192.168.1.127/DDL2/trunk/DD_L2DP, you'd use relocate.
Switch is used if you want to change what directory on the repository your working copy refers to. I believe this to be the case you want. This operation does not affect the repositories revision number: it only updates the working copy's URL.

Solution2:

If your repository has for some reason changed it's location (IP/URL). Maybe you're even stuck and can't commit and you don't want to checkout your working copy again from the new location and to move all your changed data back into the new working copy, TortoiseSVN→ Relocate is the command you are looking for. It basically does very little: it rewrites all URLs that are associated with each file and folder with the new URL.

To Switch...

You want to switch to a different branch or directory within the same repository. To do that you should use TortoiseSVN → Switch....
Switch your current working copy to the newly created copy in the repository. Again select the top level folder of your project and use TortoiseSVN → Switch... from the context menu.
In the next dialog enter the URL of the branch you just created. Select the Head Revision radio button and click on OK. Your working copy is switched to the new branch/tag.
Switch works just like Update in that it never discards your local changes. Any changes you have made to your working copy which have not yet been committed will be merged when you do the Switch. If you do not want this to happen then you must either commit the changes before switching, or revert your working copy to an already-committed revision (typically HEAD).

If you want to work on trunk and branch, but don't want the expense of a fresh checkout, you can use Windows Explorer to make a copy of your trunk checkout in another folder, then TortoiseSVN → Switch... that copy to your new branch.


No comments:

Post a Comment

Tricks and Tips