Reputation: 38332
I had all our code in 1.01. I recently renamed it to trunk. Now i can't get the old version of the before this rename . The rename happened at revision 6090 but i want the revision 5876 of a file. I can see the logs but not able to export the file it says url /var/www/project/trunk/file doesn't exists
How can i get that version of the file
I ran svn export -r 5876 https://url/project/1.01/file
Upvotes: 4
Views: 3589
Reputation: 3416
Allthough the provided answer is correct here is some important advise for anyone who might stumble across this Question:
SVN EXPORT has two syntaxes, which do different things:
And many people use the first syntax WHEN THEY SHOULD USE THE 2nd
1. svn export -r 123 svn://rep/file1.txt
which is shorthand for: svn export -r 123 svn://rep/file1.txt@HEAD
What will this command do? It will first search for a File named "file1.txt" in the current HEAD-revision. And once it is found, search through past revisions of this file and get the file-contents of the Revision 123. So if the Files original Name in Revision 123 was file.txt and was later renamed to file1.txt (e.g. in revision 133) you will get the contents of the original File file.txt in revision 123.
Now for the second syntax:
2. svn export svn://rep/file1.txt@123
which is shorthand for: svn export -r 123 svn://rep/file1.txt@123
This command tells SVN to search in the Revision 123 for a File which was then named file1.txt, not concerned about a different filename in any other revision. So if the Files original name in Revision 123 was 'file1.txt' and it was later renamed to 'file2.txt' this command will still give you the contents of the original file1.txt in the revision 123
To Summarize:
Only use the -r Flag when you want to provide a seperate revision for the filename and the filecontents. This is only the case if your request is "SVN give the contents of a file in Revision 123 which is NOW called 'File1.txt' whatever it was called back then..."
Upvotes: 6
Reputation: 22663
I'd rather recommend you do either one of the following rather than the accepted answer, as you'd lose the history, which you're quite likely to want to get back.
svn cp FILE_URL@REV local_path_to_file
This will directly fetch the revision you need for you and re-add and re-update the file for you in your local working copy.
You may then commit file file to put it back in the remote repository.
svn cp FILE_URL@REV FILE_URL
This will directory copy the old file and put it back at the HEAD, with history and all.
Obviously you can do this across branches, etc...
Upvotes: 2
Reputation: 1238
Have you tried
svn cat TARGET@5876 > /var/www/project/trunk/new/path/to/file
and then re-add it to svn.
Target should be your old repo path before the rename.
Upvotes: 0
Reputation: 368
How did you "rename" the trunk folder? Using "svn rename" or "svn move"? Usually if using these commands, history should be consistent and the file should be available when using the "svn export -r ..." command.
Is the "project" folder also under version control? If yes, I'd try to update a working copy to the old revision and copy it over to where it should be located now.
Is it perhaps possible, that the export command relies on getting the path that was correct at the time of the revision to be exported?
What happens when you update a working copy to the old revision, resp. if you perform a fresh check out of the desired old version?
Upvotes: -1