views:

190

answers:

2

I'm completely new to source control and Subversive, and I've committed changes to a file that shouldn't have been modified. I've done over an hour of searching documentation and the Internet about this, but I guess I'm not familiar enough with the terminology. Also, a lot of source control resources seem to be for command line users.

Here's what I've tried so far: first, I used the Team > Revert option, but I've since found that that only affect the local copy. I looked at the repository's web interface, but it only provided a diff tool, not a rollback tool. I've also opened the History tab and found "Revert Changes from Revision X" and "Switch to Revision X" in context menus.

Based on the docs I've found, I think one of those is what I need, but I'm not sure which. Also, I don't know whether to select the current revision, because that's the one I want to undo, or the one before it, because that's the one I want to get to. If this were a code problem, I'd just run a little test, but in this case I'm afraid I'll make things worse by selecting the wrong option and I don't want to clutter the repository with a useless test file.

So, in summary: How can I use Subversive to roll back a single file to its immediately previous version?

A: 

You can check out the version you want using:

svn co http://example.com/svn/reponame/dir/file.ext -R 123

Or if it wasn't committed, you can use

svn revert file.ext
Erik Giberti
A: 

Revert is the right command. You can not "undo" a commit on the server so that it is not visible. What you need to do is revert the changes from that revision (or revert to the revision before the revision with your changes, I think both options are presented in subclipse's log), which rolls back your working copy to the state it was before, and then commit.

Also: Which is it? Subversive or subclipse?

Thomas Lötzer
Is there any difference between this and copying the contents of the old version into the file and re-committing?
Lord Torgamus
Sorry, I retagged, it's Subversive. When I started writing the post, I didn't realize they were different, which shows you how much I know about source control.
Lord Torgamus
@Lord TorgamusYes, there is a difference, but probably not in your case. The difference is that you can also revert changes from a revision later on, even after the file has been changed by others, because it is handled by the merge-logic in SVN, which uses diffs generated for the revisions. If it was the last version, then no, there is no difference.
Thomas Lötzer