Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I view an older version of an SVN file?

I have an SVN file which is now missing some logic and so I need to go back about 40 revisions to the time when it had the logic I need. Other than trying to view a diff of the file in the command line (very hard to read), is there any way I could get a copy of that file to review so I can study it to recover parts?

like image 325
Xeoncross Avatar asked Nov 18 '10 19:11

Xeoncross


People also ask

Where is svn history stored?

They are stored in the svn:log property. You can add the --revprop flag to the various property commands to view & edit this property.

How do you find changed files in svn?

The solution here is to either update your working copy or explicitly provide a revision number to svn log by using the --revision ( -r ) option. svn log also takes a --quiet ( -q ) option, which suppresses the body of the log message. When combined with --verbose ( -v ), it gives just the names of the changed files.

What is svn revert?

Reverts any local changes to a file or directory and resolves any conflicted states. svn revert will not only revert the contents of an item in your working copy, but also any property changes.

How do I revert local changes in svn?

Right-click a file in the Current Folder browser and select Source Control > Revert using SVN. In the Revert Files dialog box, choose a revision to revert to. Select a revision to view information about the change such as the author, date, and log message. Click Revert.


2 Answers

You can update to an older revision:

svn update -r 666 file 

Or you can just view the file directly:

svn cat -r 666 file | less 
like image 68
John Kugelman Avatar answered Oct 01 '22 11:10

John Kugelman


It is also interesting to compare the file of the current working revision with the same file of another revision.

You can do as follows:

$ svn diff -r34 file 
like image 41
Kreshnik Avatar answered Oct 01 '22 12:10

Kreshnik