tags:

views:

379

answers:

4

Hello,

I have a file as shown below in an SVN repo that I would like to revert to a previous version. What is the way to do this in SVN? I want only downgrade this particular file to an older version, not the whole repo.

Thanks.

$ svn log myfile.py
----------------------
r179 | xx | 2010-05-10

Change 3
----------------------
r175 | xx | 2010-05-08

Change 2
----------------------
r174 | xx | 2010-05-04

Initial
A: 

One option would be to use a SVN client (like TortoiseSVN) to check out the file at the specific revision and then recommit it. The result will be essentially what you are wanting.

Andrew Hubbs
tortoiseSvn also has a feature to revert a file to a specific revision number. you access this by viewing the log for the file.
yamspog
+2  A: 

If you just want the old file in your working copy:

svn up -r 147 myfile.py

If you want to rollback, see this duplicate question.

Eric Hauser
+1  A: 

For a single file, you could do:

svn export -r <REV> svn://host/path/to/file/on/repos file.ext

You could do svn revert <file> but that will only restore the last working copy.

webdestroya
+1  A: 

The best way is to:

svn merge -c -RevisionToUndo ^/trunk

this will undo all files of the revision than simply revert those file you don't like to undo. Don't forget the "-" as prefix for the revision.

svn revert File1 File2

Now commit the changes back.

khmarbaise