0

Today I tried to load a previous version of my project from subversion (revision #140), only to discover that a bad commit occured in verison #120: attempting to load any version of the project from version 120 onwards results in missing files etc. So, effectively, revisions 120+ are unusable.

However, I still have a fully a-ok uncommitted working copy of what was planned to be revision 141 in visual studio.

I am pretty darn unfamiliar with SVN's commands and don't want to stuff it up! What would be the best strategy to return the repository to a workable state and bring the HEAD version up to date to match my working copy/141?

I'm using AnkhSVN 2.3 in VS2010. The server is not local, but I have access to SVN's command line.

Thanks!

p.s I assume I will lose revisions 120-140: this is fine so long as committing 141 applies all net changes made in 120-140.

user495625
  • 301
  • 2
  • 11
  • possible duplicate of [AnkhSvn undo/revert a commit](http://stackoverflow.com/questions/4723745/ankhsvn-undo-revert-a-commit) – Sander Rijken Nov 16 '11 at 16:18

2 Answers2

3

I am not sure what do you mean by bad commit, but you can consider performing a "reverse merge", which will be rev 141, and you update your working copy and have it as rev 142.

Depends on your SVN client, there are easier way to achieve this. In Tortoise SVN, you can open the log, select rev 119, right click and choose "Revert to this revision"

If you are using command line, check out a separate working copy, go to the working copy, and perform the reverse merge

svn merge -r HEAD:119 http://your_svn_url

Consider reading http://svnbook.red-bean.com/ on the chapter about "Undo changes"


updated: I mistyped 119 as 199

Adrian Shum
  • 38,812
  • 10
  • 83
  • 131
  • By 'bad' commit, I meant that I committed something that seems to have stuffed everything up in a major way. e.g. While it lists commit 120, trying various functions on that revision returns the message to the effect of 'commit 120 does not exist'. Similar with any file committed post 120. The merge refuses to work, so, based on your answer I think I have get a dump to 119, start a new repository with the dump, and merge into that. Thanks for putting me onto the right track :) – user495625 Nov 18 '11 at 02:00
  • If you simply means committing something u don't want, and you want the HEAD to have the state as you perform the "bad" commit, I think the way I provided should be the way to go. Dump/Restore seems overkill for such purpose. – Adrian Shum Nov 18 '11 at 03:08
0

The AnkhSVN history viewer has the option 'Revert changes from this Revision' and 'Revert to this Revision' which automatically handle these scenarios.

For r119 Revert changes from this revision is equivalent to svn merge -c -r119 http://your_svn_url (-c r119 is equivalent to -r 119:118)

Revert to this revision is then the equivalent to svn merge -r HEAD:119

Bert Huijben
  • 19,525
  • 4
  • 57
  • 73