tags:

views:

10524

answers:

4

I accidentally committed too many files to an SVN repository and changed some things I didn't mean to. (Sigh.) In order to revert them to their prior state, the best I could come up with was

svn rm l3toks.dtx
svn copy -r 854 svn+ssh://<repository URL>/l3toks.dtx ./l3toks.dtx

Jeez! Is there no better way? Why can't I just write something like this:

svn revert -r 854 l3toks.dtx

Okay, I'm only using v1.4.4, but I skimmed over the changes list for the 1.5 branch and I couldn't see anything directly related to this. Did I miss anything?


Edit: I guess I wasn't clear enough. I don't think I want to reverse merge, because then I'll lose the changes that I did want to make! Say that fileA and fileB were both modified but I only wanted to commit fileA; accidentally typing

svn commit -m "small change"

commits both files, and now I want to roll back fileB. Reverse merging makes this task no easier (as far as I can tell) than the steps I outlined above.

+8  A: 

Check out "undoing changes" section of the svn book

luapyad
http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo You could at least provide a direct link...
derobert
added your direct link
Simucal
Yes, derobert, you are right - it would have been better to include direct link. Thanks. I was using the pdf version off line.
luapyad
+4  A: 

What you're looking for is called a "reverse merge". You should consult the docs regarding the merge function in the SVN book (as luapyad, or more precisely the first commenter on that post, points out). If you're using Tortoise, you can also just go into the log view and right-click and choose "revert changes from this revision" on the one where you made the mistake.

rmeador
+4  A: 

Reverse merge is exactly what you want (see luapyad's answer). Just apply the merge to the erroneously-commited file instead of the entire directory.

Tom
+29  A: 
svn merge -r 854:853 l3toks.dtx

or

svn merge -c -854 l3toks.dtx
orip
Ah, finally I see the relevant part in `svn help merge` (usage #3). Thanks!
Will Robertson