Tuesday, February 10, 2009

One CVS trick with eclipse

Recently I had a need to commit some local uncommitted change of a branch into another branch. I was little skeptical that I might loose all the local changes and redo them, manually, again in the other branch. Some soul searching in eclipse help document, revealed that I can do such things using "Team -> Switch to another branch or version". It uses sticky tags to move the uncommitted changes into the new version/branch instead of replacing. Once you have "switched" to this new branch, you can commit them gladly. And, it works! But there is one problem. Suppose there is some conflicting file, i.e., you have modified a file "A" locally and someone else also has made some conflicting changes in "A" in this other branch. In this particular situation, eclipse/cvs screws your code gracefully. i.e., without any warning/error. It looses all local changes you made! So my personal opinion is before "switching" to another branch, do a "compare with" that branch. Find out if there is any conflict. In case you find any conflict, back them up somewhere. After "switching" to the other branch manually check which state these files are. You might need them to fix manually.

No comments: