I have a Subversion branch checked out using TortoiseSVN in Windows. I have a file, call it myfile.txt, that I want to rename, say to mynewfile.txt. I want to keep myfile.txt around, however, and just revert it back to a previous revision, say r15. So, I want myfile.txt to have content from r15 and mynewfile.txt to have myfile.txt's content from rHEAD. I was hoping I could somehow do this with Subversion commands so that the history of the file is preserved. That way, when I commit this and you look at the modifications, you can see mynewfile.txt is just a rename of myfile.txt, and myfile.txt now has its old content from r15. Is this possible? Should I just rename myfile.txt -> mynewfile.txt and then remake myfile.txt, manually copying content from r15 into it?
views:
46answers:
2
+1
A:
svn cp myfile.txt mynewfile.txt
svn co -r15 myfile.txt
svn commit
I believe that would preserve the history as you wish.
EDIT: TortoiseSVN, did not realize! New steps:
- Open the Repo Browser and Right-click your myfile.txt
- Select "Copy to..." and choose
mynewfile.txt
as the new name. - Right-click myfile.txt in a checked-out copy and choose "Update to revision" and select 15.
- Commit.
Ryley
2010-07-22 21:46:16
Is there a way with TortoiseSVN to open a shell where I can use those commands? I tried doing just 'svn' in cmd but it doesn't recognize it as a program. I'm not seeing anything likely in `C:\Program Files\TortoiseSVN\bin`, either.
Sarah Vessels
2010-07-23 14:02:52
@Sarah Vessels You need to install the command line client(which must be the same svn version as tortoisesvn) when you want to use the command line. They are not included in TSVN.
Rudi
2010-07-27 07:30:39
+1
A:
You need a second working copy at the old revision(It is sufficient to copy the directory and update the single file only). Then you need to perform the following steps:
- In the HEAD working copy Choose
rename
from the svn context menu to rename the file - go to the OLD working copy and drag the old file to the HEAD working copy with the right mouse button
- chose
svn copy versioned items here
from the appearing menu - commit (make sure the text status says "replaced(+)" for the old file and "added(+)" for the new file)
Rudi
2010-07-27 07:49:06