Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I revert the Subversion repository, not my working copy, to a specific revision?

I'm relatively new to Subversion, coming from Source Safe, and it's driving me nuts. Using the Tortoise interface, Commit kept showing me .java files in my bin directory which it said were "missing" - ok, that's a separate question. Basically, when I tried several things to get rid of the spurious "bin" message, Tortoise instead deleted my entire source directory. I tried re-adding things, but when I added, it came in as new, with no history.

How do I take Subversion back to a particular revision? As if I had never happened? I know how to do this in VSS, but every time I try in TortoiseSVN, it just modifies my working copy. I don't want to then check in my working copy, because that would lose me all my history. Can Subversion forget?

Tried looking in stackoverflow already, btw, but the closest thing I found was exporting and reimporting the entire repository, and I don't think I'm at that point yet. Subversion must be able to do this most simple thing!

like image 799
orbfish Avatar asked Dec 12 '22 21:12

orbfish


2 Answers

Subversion won't forget, but you can do something like the following:

Let's say your current revision is 100, and you want to go back to revision 70. You'll be creating a revision 101, which is exactly the same as 70.

1) Check out a nice clean working copy.

2) Merge (backwards) changes.

svn merge -r100:70 http://repo.com/my/project/trunk

3) Check sanity. Is your working copy exactly what you wanted? If so:

svn commit -m "rolled back to the good old days of r70"

like image 100
timdev Avatar answered Dec 15 '22 12:12

timdev


Since you specifically asked about TortoiseSVN you can do the following:

  • right click in your working directory
  • TortoiseSVN
  • Update to Revision
  • Click on Log
  • Choose the revision you want (this puts the revision number into the Revision box - if you already know the revision number, you can just type it in straight away).
  • Click ok

Then just commit your changes to the repository with an appropriate message.

like image 41
Blair McMillan Avatar answered Dec 15 '22 10:12

Blair McMillan