Java – How to merge a CVS branch into HEAD using the Eclipse merge tools

cvseclipsejavamerge

I'm currently working in a branch I created using the Team–>Branch. How do I use Team–>Merge to merge my changes to the branch back to head?

Best Answer

I was having trouble with this too. Here are the steps I take to merge (mostly taken from the online Eclipse help):

  1. When making my development branch (Team -> Branch) I ensure I have a root tag created for the branch, this is the tag CVS will use to determine what changes are due to the branch and what might have been committed from other efforts
  2. I complete my development on the branch and commit (Team -> Commit) all changes back to the repository
  3. Now that all my changes for the branch are in the repository I load the destination branch that I want to merge into, typically HEAD (Team -> Switch to Another Branch or Version)

You are now ready to begin the actual Merging process. Here you will be picking which changes should come over and which should be discarded. Think of this process as a semi-automated development cycle, effectively a checkout, make changes, commit cycle. Only instead of manually inserting your changes you have compare tools to assist you along. After all you've already made all the code changes in your branch!

To Merge:

  1. Team -> Merge
  2. Branch or Version to be Merged (end tag): This is the name of your development branch tag
  3. Common Base Version: This is the name of your root tag for the branch (remember step 1 from the earlier section?). This should have been auto populated by the tool, but if not, add it yourself
  4. I like to Preview the merge in synchronize view so I can ensure that nothing is getting in that shouldn't be. Depending on your bravery, this is the option I would suggest. Click the Finish button
  5. The Synchronize Perspective will come up and any differences found between your destination branch and your source branch will be shown in an expandable list in the left
  6. For any file you can open it in a comparison tool to see what it was before and merge changes individually (remember to save the file when done!) or you can right click on the file and select merge from the expandable list. If you manually merge with the comparison tool, you can select "Mark as Merged" in the expandable list to remove the file from your todo list.
  7. Once you've decided what to do with the file it will be removed from the list. The goal is to action each file
  8. Now that all your changes have been merged, switch back to the Java perspective and select Team -> Synchronize with Repository, the Synchronize Perspective will come back up.
  9. This time select Commit to push all your changes into the repository.
  10. Fin!

Hope that helped. Provided below for reference is the contents of the help document that guided me to victory!

Eclipse SDK Help - Merging a Branch