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

Solution 1:

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

Solution 2:

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

Solution 3:

Update to a specific revision:

svn up -r1234 file

Solution 4:

I believe the best way to view revisions is to use a program/app that makes it easy for you. I like to use trac : http://trac.edgewall.org/wiki/TracSubversion

It provides a great svn browser and makes it really easy to go back through your revisions.

It may be a little overkill to set this up for one specific revision you want to check, but it could be useful if you're going to do this a lot in the future.

Solution 5:

To directly answer the question of how to "get a copy of that file":

svn cat -r 666 file > file_r666

then you can view the newly created file_r666 with any viewer or comparison program, e.g.

kompare file_r666 file

nicely shows the differences.

I posted the answer because the accepted answer's commands do actually not give a copy of the file and because svn cat -r 666 file | vim does not work with my system (Vim: Error reading input, exiting...)