SVN Relocate or Switch?
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
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
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.
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.
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.
精彩评论