开发者

Managing SVN commits and revision

My company doesn't use the branches/tags/trunk thing and essentially all of our developers work on trunk all the time. I now have an issue where I made some changes and committed them, and now have to revert them back. However during that timeframe another developer made some unrelated changes. So our commit structure looks something li开发者_如何学运维ke:

  • 103: Joe Blow - Some unrelated changes
  • 102: Wayne - Changes to Module A
  • 101: John Smith - Changed blah blah blah

I used "revert to this revision" on #101 to undo my changes (#102) but now I need to commit them back as #103 incorporates them. I haven't used many SVN features so is there a way to commit my new change to #103 without overwriting it and forcing "Joe Blow" to recommit his changes, short of going into #103 and manually adding back in all of his changes?

I'm trying to push for us to start using branches but I don't think anyone here really understands them so I doubt it will be implemented.


You should be able to do a "reverse merge" (merge -r I think, though I'm not very familiar with the command line syntax for SVN) of revision 102. This would back out the changes of just that revision.

This is different from reverting in that it only cares about the changes made between 101 and 102, ignoring 103's changes in the merge. So 103 should stay preserved. (Assuming, of course, it doesn't have a dependency on the changes from 102.)

It should be quick to confirm the merge because a diff of your local changes should ideally match the diff from 101 to 102, just swapped.


---- Edited as it seems you want to undo your changes, initially I thought you wanted to reapply them ---

You can do a svn diff in the reverse direction. This creates a patch file which will "undo" your changes. The key to generating a reverse diff is to switch the revision numbers in the command line, so

svn diff -r101:102 ...

creates a diff which will add the items to generate 102 from 101, while

svn diff -r102:101

creates a diff which will remove the items from 102 to generate 101.

--- Original post follows ---

Use svn diff to create a diff file between rev 101 and 102, and then update the repository to rev 103, and merge the changes back in via the patch utilities. Then your commit 104 will read something like "Readded changes in commit 102 reverted in commit 103".

People who often undo other's changes will have to be dealt with via raising awareness of their actions and the costs associated with them. If they don't care, then you'll have to weigh the cost of going to someone else with the odds of receiving sufficient benefit.


If you're in TortoiseSVN, you can use the revisions log, and revert only the changes made in a particular revision by selecting "Revert changes from this revision" from context menu, then committing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜