3

Imagine you have a bunch of source files in a branch that you are working on that are add/modified/deleted. Then suppose you decide to halt development on that branch for a while and go back and work on something else in the trunk. You are NOT merging the branch at this time.

Normally I would check in all my changes to the branch then do a Team->Switch and select the trunk and start work. However, I noticed that if I didn't check in my changes, Subclipse happily changed the subversion URL of my working copy to trunk and left all my changes intact.

My question is this: Did Subclipse do a merge for me behind the scenes or did it just switch the URL to trunk and do an update... presumably in an attempt to avoid losing my changes?

If it's the former, I have a new-found respect for subclipse/subversion. If it's the latter then, it seems like it should be an illegal operation to do a subversion "switch" while you have a modified working copy because you are in effect trashing the trunk!!

4

1 回答 1

4

You can absolutely switch when you have modified sources. That is a perfectly normal use-case. Imagine you were working on trunk but not finished with your work and had to work on something else. The solution would be to create a branch for your new work, switch to the branch, commit to the branch (which will get rid of the local modifications) and then finally switch back to trunk.

This is how Subversion is designed to work.

于 2012-08-31T15:28:38.677 回答