Replacing a directory with a copy of another directory in Subversion
Let’s say we have the following two directories in the repository:
currentproduction
development
And I want to:
- Rename
currentproduction
to e.g.archivedproduction
. - Copy revision 1234 of
development
as (new)currentproduction
.
When I do
svn ren currentproduction archivedproduction
svn copy -r 1234 development currentproduction
Subversion tries to copy development
under (into) currentproduction
(which is already scheduled for deletion):
A currentproduction\development\file1.txt
A currentproduction\development\file2.txt
Updated to revision 1234.
svn: Can't add 'currentproduction\devel开发者_运维百科opment' to a parent directory scheduled for deletion
I guess it is because the directory is still there in the working copy until the commit. I could do with an intermediate commit:
svn ren currentproduction archivedproduction
svn commit
svn copy -r 1234 development currentproduction
but that’s not very nice… Isn’t there a way to tell Subversion I want to replace the directory with another one?
Instead of copying , you could merge development
to currentproduction
from the revision you want. That way, you would have only the things that are changed in your commit.
If you created currentproduction
with a copy of development
, you would have to merge the revision that are not present in the currentproduction
branches.
I advise you to keep a record of every revision you merged to your currentproduction
branches (unless the server version is > 1.5). You should never merge two revision twice, since it could be seen as a conflict.
// Know to which version a branche was created (XX)
svn log --stop-on-copy
svn merge -r XX:1234 development currentproduction
I would also suggest you to use this setup for you repository.
Good luck.
In your case i would simply rename currentproduction to archivedproduction and just checkout the revision you want to a new directory called currentproduction.
I just went to the .svn
hidden folder contained in the removed folder, deleted it, then restarted my workspace (I'm using AhnkSVN in M$ VisualStudio), and commited a file in the previously deleted folder without problems.
Anyway, make a backup of the .svn
folder before deleting it.
精彩评论