Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

At my work, we use svn. I use tortoisesvn on my windows PC as a windows shell/explorer extension. I was maintaining a *.c source file in svn. One of my colleague made some changes on top of my version and checked it in, but not without testing fully all his changes! As a result of that the code now is broken for certain test cases. He said he did not merge it properly while checking in the changes in svn, hence this breakage. Whatever! There are other teams which update this file, so this would break their work.

  1. What is the command to revert this particular file to older working revision? (He has his changes locally, so I would not bother about that)

  2. If there is no direct command to do this, what is now my way out of this mess.

  3. When I read , I heard of something 'reverse merge'. What exactly is that, and does it help me, if yes how?

share|improve this question
    
You should be able to manually select which version of the file you want to view. I would simply find the last working copy and save the change then perform a commit. You sure the application is tortoisesvnit and not tortoisesvn? –  Ramhound May 27 '11 at 15:54
    
@Edited to correct typo in OP. Isn't there a command to just revert to a working revision # I give to it. –  goldenmean May 27 '11 at 16:02

4 Answers 4

up vote 1 down vote accepted

Here's a reverse merge. It will get you what you want.

  1. Merge the revision that's wrong with the revision you want into your working copy path.
  2. Test your code
  3. Commit the files back to the repository

You will now have a revision that is fixed, but leaves the broken one in the repo.

The merge command takes three parameters: first source, second source, working copy path. Since you are rolling back, the two sources will have the same path but different revision numbers. The higher revision number goes first.

Command-line Example:

merge svn://example.com/repo/folder/changedFile.txt@HEAD svn://example.com/repo/folder/changedFile.txt@215 ./folder/changedFile.txt

Use the "Show Log" button in TortoiseSVN to find the revision easily.

share|improve this answer
    
Do u know exact svn commandline for doing this. It seems to be the correct way. Other way is download/checkout the last known working version explicity by selecting its revision #. Then commit it back. But i would try merging first. –  goldenmean May 27 '11 at 17:43
    
Edited answer to include command line example. –  Chris Ting May 27 '11 at 19:45

You can also reverse merge single file by right-clicking the filename in the Log Messages window.

share|improve this answer

Guided by the commit messages, you should be able to download a previous revision of the file, a revision which does not contain the changes which broke the file.

Certainly the last check-in you did, contains the correct and working version of the file, when u merge, you usually use two sources to produce a new one, either a working copy or two seperate branches, so, what your friend did was just create a new revision.

Download the file from YOUR last check-in, that should contain the last working code before the changes. TortoiseSVN allows you to do that by 'checking out' specifying a revision number, perhaps you'll need to explore the Repository (using TortoiseSVN Repository Explorer) and identify the desired revision number.

This is the way i do it, has worked before for me :)

Hope this helps.

share|improve this answer

TortoiseSVN can do the reverse-merge for you. Go the the log pages for the SVN project, right-click on the revision you'd like to change to and choose 'revert'.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.