views:

60

answers:

3

I have a few files that were part of an update that were mistakenly committed to the main trunk before they were ready. Is there a way to 'undo' this checkout and roll the repository back a version, while still keeping the changed file in my checkout?

I'm using tortiseSVN ver 1.6.5 on Windows XP, if that makes any difference.

example: I updated a file, it is now at revision 659, previous version of this file was 600. I would like to keep version 659 on my checkout, but make what is currently version 600 the latest one again (ie version 660).

I tried making a copy of my current version, rolled back the regular version to 600, then tried to commit it back, but it tells me there are no changes to commit.

+3  A: 

I usually copy the file I want to keep to a temporary location, do the rollback, then copy the preserved file back in... Though, for all I know, I'm just taking the easy approach and there's something better out there.

+2  A: 

You want a reverse merge, not an update to an old revision.

Let's say the revision you just committed (and want to roll back) was 42.

# rollback
svn merge -c -42
svn commit
# now r43 is good but we want r42's version of foo.c in our working copy
svn merge -c -43 foo.c
Michael Hackner
A: 

Ideally you’d use “Update to revision” which will revert your working copy to a specified revision number after which you can commit back. For the sake of simplicity, I’d do this after taking a copy of your current working directory then just move the copy back after the update.

Troy Hunt
This will not work; you can't commit after an update to an old revision. You have to do a reverse merge, otherwise SVN will say there are no changes to commit. Updating to an old revision doesn't count as a change.
Michael Hackner
You're right Michael, brain fade on my part. Full details on doing this with Tortoise here: http://www.coderenaissance.com/2008/11/how-to-revert-or-rollback-file-using.html
Troy Hunt