2

I have a file that is currently at revision X. I would like to revert it to revision X-1 and commit it as X-1. However, when I get the commit preview for X-1, SVN (I'm using Tortoise in this case) says that there are no changes. How can this be? And how do I commit the reverted file?

1 Answer 1

0

I'm not sure if I'm reading too much into the wording of your question, but you may have a misunderstanding of how SVN works, and also what the "revert" command is.

First, the "revert" command is only for getting rid of changes you have not yet committed. It undoes any changes you see with svn status or TortoiseSVN's "check for modifications". Nothing more.

Secondly, it is not possible to commit a revision less than the current revision. In SVN, files don't have revisions. Revisions have files. And the revision numbers always go UP, never down. Think of a revision in SVN as a snapshot in time of EVERYTHING in the repository. Technically, you should say "file foo as it existed in revision 123", instead of "revision 123 of file foo". The latter is not strictly correct and can break down in some situations.

Finally, what you are TRYING to do, it seems, is to remove some changes to a file. You do this by creating a NEW revision of the file, using the concept of a "reverse merge". From the command line, you do a merge of the file, specifying a negative revision, or a backwards revision range, to undo the changes in those revisions. Then you can commit to get a new revision containing your file with those changes reversed. TortoiseSVN makes this easy: just open the "show log" dialog, right-click on the revision you want to reverse, and choose "revert changes from this revision". Then you will need to commit as before.

Either way, do this "reverse merge" step from a working copy pointing to HEAD. Your new revision will always go after HEAD anyway, since that's how SVN works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .