问题
I have migrated a project from CVS to SVN. Now I need to rename that project. What can be the best possible way to rename it, keeping the all the history intact. The project folder contains some 100 numbers of C and its header files.
回答1:
There is no built-in mechanism in Subversion to rename a repository.
The best option in order to maintain integrity and history is to perform a repository dump of the old repository and then re-import the dump into a new repository.
I wrote a post about this here: How To Rename an SVN repository.
You will only need to use the svnadmin utility, and then svnadmin create a new repository, svnadmin dump the contents of the previous repository and finally svnadmin import the dump into the new repository that you had created using svnadmin create.
EDIT
If you need to rename a "project" inside the repository -- and by project I assume you mean a directory -- then you simply need to use the svn move command. Note that this is done using the svn client, not svnadmin. The svn move command's syntax is svn move SRC DEST
and it allows you to basically preform a rename of a file or a directory inside of your repository. All history should be preserved for that file (or directory).
回答2:
In order to rename a repository you only have to rename its root directory and generate a new UUID. Assuming the repository is in /var/svnroot/my_repo
you have to run this commands (as root) to rename a repository:
$ mv /var/svnroot/my_repo /var/svnroot/my_new_repo
$ svnadmin setuuid /var/svnroot/my_new_repo
After that, you can access it through your favorite protocol.
回答3:
SVN Book \ 5. Repository Administration \ Moving and Removing Repositories:
Subversion repository data is wholly contained within the repository directory. As such, you can move a Subversion repository to some other location on disk, rename a repository, copy a repository, or delete a repository altogether using the tools provided by your operating system for manipulating directories
Rename is typical done on the same server, so a simple rename/move of the repository directory will do it. The call of svnadmin setuuid
is not required, because you are not making a copy and the UUIDs should stay the same, so your client can easily relocate to the new repository URL.
回答4:
SVN 1.1 (old book):
Sometimes an administrator might change the “base location” of your repository—in other words, the contents of the repository doesn't change, but the main URL used to reach the root of the repository does. For example, the hostname may change, the URL scheme, or any part of the URL which leads to the repository itself. Rather than checkout a new working copy, you can have the svn switch command “rewrite” the beginnings of all the URLs in your working copy. Use the --relocate option to do the substitution. No file contents are changed, nor is the repository contacted. It's similar to running a Perl script over your working copy .svn/ directories which runs s/OldRoot/NewRoot/.
$ svn checkout file:///tmp/repos test
A test/a
A test/b
…
$ mv repos newlocation
$ cd test/
$ svn update
svn: Unable to open an ra_local session to URL
svn: Unable to open repository 'file:///tmp/repos'
$ svn switch --relocate file:///tmp/repos file:///tmp/newlocation .
$ svn update
At revision 3.
SVN 1.7 (current book):
svn relocate — Relocate the working copy to point to a different repository root URL.
Synopsis
svn relocate FROM-PREFIX TO-PREFIX [PATH...]
svn relocate TO-URL [PATH]
Description
Sometimes an administrator might change the location (or apparent location, from the client's perspective) of a repository. The content of the repository doesn't change, but the repository's root URL does. The hostname may change because the repository is now being served from a different computer. Or, perhaps the URL scheme changes because the repository is now being served via SSL (using https://) instead of over plain HTTP. There are many different reasons for these types of repository relocations. But ideally, a “change of address” for a repository shouldn't suddently cause all the working copies which point to that repository to become forever unusable. And fortunately, that's not the case. Rather than force users to check out a new working copy when a repository is relocated, Subversion provides the svn relocate command, which “rewrites” the working copy's administrative metadata to refer to the new repository location.
The first svn relocate syntax allows you to update one or more working copies by what essentially amounts to a find-and-replace within the repository root URLs recorded in those working copies. Subversion will replace the initial substring FROM-PREFIX with the string TO-PREFIX in those URLs. These initial URL substrings can be as long or as short as is necessary to differentiate between them. Obviously, to use this syntax form, you need to know both the current root URL of the repository to which the working copy is pointing, and the new URL of that repository. (You can use svn info to determine the former.)
The second syntax does not require that you know the current repository root URL with which the working copy is associated at all—only the new repository URL (TO-URL) to which it should be pointing. In this syntax form, only one working copy may be relocated at a time.
Examples
Let's start with a working copy that reflects a local repository URL:
$ svn info | grep URL:
URL: file:///var/svn/repos/trunk
$
One day the administrator decides to rename the on-disk repository directory. We missed the memo, so we see an error the next time we try to update our working copy.
$ svn up
Updating '.':
svn: E180001: Unable to connect to a repository at URL 'file:///var/svn/repos/trunk'
After cornering the administrator over by the vending machines, we learn about the repository being moved and are told the new URL. Rather than checkout a new working copy, though, we simply ask Subversion to rewrite the working copy metadata to point to the new repository location.
$ svn relocate file:///var/svn/new-repos/trunk
$
Subversion doesn't tell us much about what it did, but hey—error-free operation is really all we need, right? Our working copy is functional for online operations again.
$ svn up
Updating '.':
A lib/new.c
M src/code.h
M src/headers.h
…
By default, svn relocate will traverse any external working copies nested within your working copy and attempt relocation of those working copies, too. Use the --ignore-externals
option to disable this behavior.
回答5:
First get to know where the
\Repositories
folder residing at, (defautC:\Repositories
)After that rename your repository you want to, inside that
/Repositories
folder. (windows)If you are using eclipse then discard the old repository location in SVN Repositories and goto
New->Repository Location...-> your new repository name
. Thats it.
来源:https://stackoverflow.com/questions/4047941/renaming-svn-repository-project-name