Get previous revision of deleted file in svn

I had all of our code at 1.01. I recently renamed it to the trunk. Now I can’t get the old version before this rename. The renaming happened in the 6090 edition, but I want the version 5876 of the file. I see the logs, but I can not export the file that it says url /var/www/project/trunk/file doesn't exists

How can I get this version of the file

I ran svn export -r 5876 https://url/project/1.01/file

+4
source share
4 answers

I would prefer that you do one of the following rather than an accepted answer, since you will lose the story that you most likely want to return.

Restore working copy

 svn cp FILE_URL@REV local_path_to_file 

This will directly extract the revision you need and re-add and re-update the file in your local working copy.

You can then transfer the file to return it to the remote repository.

Recovery to the repository

svn cp FILE_URL @REV FILE_URL

This will copy the old file and return it to HEAD with the history and all.


Obviously, you can do this through branches, etc.

+2
source

Although the answer provided is correct, this is an important tip for anyone who might stumble upon this question:

SVN EXPORT has two syntaxes that do different things:

And many people use the first syntax WHEN THEY SHOULD USE 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 team do? First, he will search for a file named "file1.txt" in the current version of HEAD. And once it is found, look at the previous versions of this file and get the contents of the file in revision 123. So, if the original file name in revision 123 was file.txt and later renamed to file1.txt (for example, in revision 133) you will get contents of source 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.tx t@123 

This command tells SVN to search in revision 123 for the file, which was then named file1.txt, but did not touch another file name in any other revision. Therefore, if the original file name in revision 123 was "file1.txt", and later it was renamed to "file2.txt", this command will still provide you with the contents of the original file file1.txt in revision 123

Summarizing:

Use the -r flag if you want to provide a separate revision of the file name and file contents. This is only if your request "SVN provides the contents of the file in revision 123, which is now called" File1.txt ", regardless of what it was called then ..."

+5
source

You tried

  svn cat TARGET@5876 > /var/www/project/trunk/new/path/to/file 

and then add it to svn again.

The goal should be your old repo path before renaming.

0
source

How did you rename the trunk folder? Using "svn rename" or "svn move"? Usually, if you use these commands, the history should be consistent and the file should be accessible using the "svn export -r ..." command.

Is the "project" folder also version controlled? If so, I would try updating the working copy of the old version and copying it to where it should be located now.

Is it possible that the export team relies on getting the right path during the exported version?

What happens when you upgrade a working copy of an old version, respectively. if you do a new check of the old version?

-1
source

All Articles