tags:

views:

561

answers:

4

I've reinstalled my SVN server and the path has changed from svn://192.168.1.35/DDL2/trunk/DD_... to svn://192.168.1.35/trunk/DD_... . I've made several changes on the working copy and wants to commit it on server so I need to change the path/url without affecting the working copy.

I've tried to use TortoiseSVN's Relocate feature but got "Relocate can only change the repository part of an URL", maybe I should use Switch but I'm worried about the working copy revision.


svn info svn://192.168.1.35/

Path: 192.168.1.35
URL: svn://192.168.1.35
Repository Root: svn://192.168.1.35
Repository UUID: 259834e4-a888-4201-9858-aaacfe621d8e
Revision: 58
Node Kind: directory
Last Changed Author: rize
Last Changed Rev: 58
Last Changed Date: 2009-11-02 18:33:09 +0100 (po, 02 11 2009)


svn info D:\Programy\Eclipse Workspace\LDD_L2DP

Path: D:\Programy\Eclipse Workspace\LDD_L2DP
URL: svn://192.168.1.35/DDL2/trunk/DD_L2DP
Repository Root: svn://192.168.1.35
Repository UUID: 259834e4-a888-4201-9858-aaacfe621d8e
Revision: 21
Node Kind: directory
Schedule: normal
Last Changed Author: rize
Last Changed Rev: 17
Last Changed Date: 2009-10-21 19:22:41 +0200 (st, 21 10 2009)


Old structure:

svn://192.168.1.35/DDL2
svn://192.168.1.35/DDL2/trunk/DD_L2DP

New structure

svn://192.168.1.35/
svn://192.168.1.35/trunk/DD_L2DP
+1  A: 

This question has the answer. Specifically:

svn switch --relocate http://svn.example.com/path/to/repository/path/within/repository http://svnnew.example.com/new/repository/path/within/repository
John Paulett
A: 

EDIT - Based on your output above, I think you need to take a different approach. It looks like the original repository was created as /data/repository with a folder called DDL2 in the repository. This can be seen looking at the "Repository Root" value of your working copy.

You won't be able to simply push the root of the repository down a level using svn switch. Instead, you'll need to use svn move to reorganize your repo around the new desired root. This means you will keep serving your repo from /data/repository, but move all the files under DDL2 to the top level.

Of course, moving a bunch of files can be a pain if you have local edits. I would get all your changes committed, then do the move as a single commit. You'll need to change your svnserve args back before you can do this.

jheddings
Hm, I'm wondered what I'm doing wrong. When I right click on the working copy and choose TortoiseSVN -> Relocate, I see the old URL. After URL correction I choose OK and got message:"It seems you are trying to relocate your working copy to a different path inside the same repository ... Do you really want to relocate?", Yes and ... "Relocate can only change the repository part of an URL" as I wrote in the first post.
RiZe
Did you happen to create a new (empty) repository at `svn://192.168.1.35/` instead of migrating the old one? Also, was the old repository rooted at `/DDL2` or at the URL root before you updated?
jheddings
Hm, I think I've just copied the repository but changed the svnserve arguments to:svnserve -d --listen-host=192.168.1.35 -r /data/repository/DDL2
RiZe
Can you post the output of `svn info svn://192.168.1.35/` and `svn info .` in your working copy? (might be easier to attach this to your original question rather than a comment)
jheddings
Ok, now it should be all
RiZe
@RiZe: I updated my answer based on your output. I think you need to change your `svnserve` args back and just use `svn move` on your working copy. It looks like `DDL2` is a folder under your repository, but not an actual folder on your server containing a repo. Does that make sense?
jheddings
Yes, now I'm commiting the changes
RiZe
Hm, I've tried svn move svn://192.168.1.35/DDL2 svn://192.168.1.35/and it looks like that svn://192.168.1.35/ (/data/repository) must be repository. At this moment it is just folder containing DDL2, which is repository so I have to dump DDL2, delete it, create new repository (/data/repository) and load the dump. That's how I see it, any other solution?
RiZe
@RiZe: You shouldn't have to dump it, just move the entire contents of the `DDL2` folder (on your server) to `/data/repository`. At that point, you can `rmdir DDL2` (as it should be empty).
jheddings
A: 
switch (sw): Update the working copy to a different URL.
usage: 1. switch URL[@PEGREV] [PATH]
       2. switch --relocate FROM TO [PATH...]

  1. Update the working copy to mirror a new URL within the repository.
     This behavior is similar to 'svn update', and is the way to
     move a working copy to a branch or tag within the same repository.
     If specified, PEGREV determines in which revision the target is first
     looked up.

     If --force is used, unversioned obstructing paths in the working
     copy do not automatically cause a failure if the switch attempts to
     add the same path.  If the obstructing path is the same type (file
     or directory) as the corresponding path in the repository it becomes
     versioned but its contents are left 'as-is' in the working copy.
     This means that an obstructing directory's unversioned children may
     also obstruct and become versioned.  For files, any content differences
     between the obstruction and the repository are treated like a local
     modification to the working copy.  All properties from the repository
     are applied to the obstructing path.

     Use the --set-depth option to set a new working copy depth on the
     targets of this operation.  Currently, the depth of a working copy
     directory can only be increased (telescoped more deeply); you cannot
     make a directory more shallow.

  2. Rewrite working copy URL metadata to reflect a syntactic change only.
     This is used when repository's root URL changes (such as a scheme
     or hostname change) but your working copy still reflects the same
     directory within the same repository.
just somebody
A: 

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.

svn move is used if you currrently have svn://192.168.1.35/trunk/DDL2DP and you want to create svn://192.168.1.35/DD_L2DP/trunk but it does not yet exist in your repository.

antik