tags:

views:

2223

answers:

3

Suppose I have a set of commits in a repository folder...

123 (250 new files, 137 changed files, 14 deleted files)
122 (150 changed files)
121 (renamed folder)
120 (90 changed files)
119 (115 changed files, 14 deleted files, 12 added files)
118 (113 changed files)
117 (10 changed files)

I want to get a working copy that includes all changes from revision 117 onward but does NOT include the changes for revisions 118 and 120.

EDIT: To perhaps make the problem clearer, I want to undo the changes that were made in 118 and 120 while retaining all other changes. The folder contains thousands of files in hundreds of subfolders.

What is the best way to achieve this?

The answer, thanks to Bruno and Bert, is the command

svn merge -c -120 .

Note that the revision number must be specified with a leading minus. '-120' not '120'

A: 

I suppose you could create a branch from revision 117, then merge everything except 118 and 120.

svn copy -r 117 source destination

Then checkout this branch and from there do svnmerge.py merge -r119,120-123

EDIT: This doesn't undo the revisions in the branch/trunk. Use svn merge instead.

Christian Davén
I wondered about that too... but wouldn't the success of this very much depend on whether the same files had been changed in 117, 118 and 119? Wouldn't there be a risk that you'd pick up some artefact from the 118 checkin?
+8  A: 

To undo revisions 118 and 120:

svn up -r HEAD       # get latest revision
svn merge -c -120 .  # undo revision 120
svn merge -c -118 .  # undo revision 118
svn commit           # after solving problems (if any)

Also see the description in Undoing changes.

Note the minus in the -c -120 argument. The -c (or --change) switch is supported since Subversion 1.4, older versions can use -r 120:119.

Bruno De Fraine
+1  A: 

This is one of the best features of TortoiseSVN, a Windows client for Subversion. You just click to view the log in your updated work copy, select the revisions you want to undo, right click, and select "undo changes from these revisions".

I've always been a command line guy, but Tortoise changed my mind.

neves