0

There are multiple collaborators to a project stored in SVN. The current repository revision is 10. I've just found out that I need to revert to revision 5 and start working from there. Then I make changes and make a new commit (revision 11).

How does this affect other collaborators? When they try to commit (creating version 12) what will happen? I guess they will be notified of code/file conflicts. And what are they then supposed to do?

sandalone
  • 41,141
  • 63
  • 222
  • 338

2 Answers2

2

Assuming that you revert those changes properly (via a reverse merge), it doesn't affect them any differently than any other merge of changes between branches, or even committing a "normal" forward-moving set of changes.

alroc
  • 27,574
  • 6
  • 51
  • 97
  • is correct. Before one of the other collaborators can commit 12, they'll have to update to 11. Any potential conflicts in their working copy caused by their revert will be on the update - not their commit. – thekbb Nov 25 '13 at 01:27
  • Yes, used revert from SVN menu. Now, version 5 lacks some of the classes they did in versions 5, 6, etc. After they merge changes, they will lose those classes right? Any way to prevent this happening? – sandalone Nov 25 '13 at 08:05
  • If you used "revert" then you didn't undo the changes properly. You need to do a reverse merge. Yes, if you commit a revision which removes files, they'll be removed from other working copies when they're updated *unless* there are local changes in those WCs. You can't "prevent this from happening" because it's how SVN is designed to work. The only workaround is to copy those files somewhere safe, update, then copy them back. But at that point you're really screwing up your revision history. – alroc Nov 25 '13 at 13:35
  • so `reverse merge` is proper thing to do.Thanks – sandalone Nov 25 '13 at 16:00
  • @alroc actually the command was "update to revision" from the right-click menu. Not "revert". Frankly, first time I am seeing this command and have not use it before. So "update to revision" was a proper way to go? – sandalone Nov 25 '13 at 16:20
  • No, "update to revision" is not the proper way to undo changes in the repository. Perform a reverse merge instead. – alroc Nov 25 '13 at 16:23
  • @alroc There is no such command in the menu. Do I have to do it via console? – sandalone Nov 25 '13 at 16:28
  • 1
    There is no context menu item for reverse merge. There is one for merge. The revisions you specify for the merge determine whether it's a reverse merge or not. I already gave you the directions from the core Subversion manual, here it is for TSVN: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-howto-rollback.html – alroc Nov 25 '13 at 16:40
1

You can revert all of the changes between revisions 6 through 10 (and making a new revision 12 which will match what was in revision 5), by using the svn merge command:

$ svn merge -r11:6 .

However, this will remove the changes your coworkers might need. Instead, you might want to create a branch, then put your changes onto that:

$ svn cp -r5 $REPO/trunk@5 $REPO/branches/revert_to_5

Once you create your branch, you can switch your working copy to that branch:

$ svn switch $REPO/branches/revert_to_5

Then, commit your changes which will be on that branch

$ svn commit -m"My commits on revision 5"

Once you do that, you'll have to figure out what to do to get you and your coworkers working back together. Maybe they too want to work off the branch, or maybe you might decide to put your changes back on trunk:

$ svn co $REPO/trunk
$ cd trunk
$ svn merge $REPO/branches/revert_to_5

Then, delete the branch since you no longer need it

$ svn delete -m"No longer needed" $REPO/branches/revert_to_5
David W.
  • 105,218
  • 39
  • 216
  • 337
  • Can this be done from the menu since I cannot find this command? Or it's such a command that must be done from the console only? TortoiseSVN and Eclipse SVN plugin is in question. – sandalone Nov 25 '13 at 16:33
  • @sandalone you might want to tag with tortoise in the future to get answers using tortoise. – crashmstr Nov 25 '13 at 16:35
  • @crashmstr I omitted it intentionally since it's not bound to Tortoise specifically. Just asked David if it happens he knows this. – sandalone Nov 25 '13 at 17:26
  • 1
    @sandalone - Yes, this can be done with Eclipse and TortoiseSVN. However, when I do this type of stuff, I prefer the command line because I know exactly what's going on. It's the difference between driving an automatic and a stick. Automatic is easier, but you have more control with the stick. By the way, when you download TortoiseSVN, you can download the command line too. It's usually under `C:\Program Files\TortoiseSVN\svn.exe` and should be in your `%PATH%`. – David W. Nov 26 '13 at 02:39