Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the proper way to do a Subversion merge in Eclipse?

I'm pretty used to how to do CVS merges in Eclipse, and I'm otherwise happy with the way that both Subclipse and Subversive work with the SVN repository, but I'm not quite sure how to do merges properly.

When I do a merge, it seems to want to stick the merged files in a seperate directory in my project rather than overwriting the old files that are to be replaced in the merge, as I am used to in CVS.

The question is not particular to either Subclipse or Subversive.

Thanks for the help!

like image 580
awied Avatar asked Sep 19 '08 00:09

awied


People also ask

How do I use subversive in eclipse?

To install Subversive: Start Eclipse and select menu item 'Help > Instal New Software...' Then selec common software repository or if you need to install Subversive only, you can directly add Subversive update site by pressing 'Add' button. On the 'Add Repository' form enter the URL to the Subversive update site.

How do I merge in Eclipse?

To start merging click 'Team>Merge...' menu item of the resource pop-up menu, 'Merge...' menu item of the SVN main menu group or on the 'Merge...' button on the 'SVN Toolbar'. The Merge Dialog will appear and to perform operation user should follow its instructions and fill needed properties.


1 Answers

Merging an entire branch into trunk

  1. Inspect the Branch project history to determine the version from which the branch was taken

    • by default Eclipse Team "History" only shows the past 25 revisions so you will have to click the button in that view labeled "Show All"
    • when you say "Show All" it will take you back past the branch date and show you all the history for trunk as well so you'll have to search for your comment where you branched
    • NOTE: if you use Tortise SVN for this same task (navigate to the branch and select "Show Log") it will show you only the branch history so you can tell exactly where the branch began
  2. So now I know that 82517 was the first version ID of the branch history. So all versions of the branch past 82517 have changes that I want to merge into trunk

  3. Now go to the "trunk" project in your Eclipse workspace and select "right click - Team - Merge"

  4. The default view is the 1 url merge

    • select the URL of the branch from which you are merging
    • under Revisions select "All"
    • press OK
  5. This will take you to the "Team Synchronizing" perspective (if it doesn't you should go there yourself) in order to resolve conflicts (see below)

Re-Merging more branch changes into trunk

  1. Insepct the trunk project history to determine the last time you merged into trunk (you should have commented this)

    • for the sake of argument let's say this version was 82517
  2. So now I know that any version greater than 82517 in the branch needs to be merged into trunk

  3. Now go to the "trunk" project in your Eclipse workspace and select "right click - Team - Merge"

  4. The default view is the 1 url merge

    • select the URL of the branch from which you are merging
    • under Revisions select "Revisions" radio button and click "Browse"
    • this will open up a list of the latest 25 branch revisions
    • select all the revisions with a number greater than 82517
    • press OK (you should see the revision list in the input field beside the radio button)
    • press OK
  5. This will take you to the "Team Synchronizing" perspective (if it doesn't you should go there yourself) in order to resolve conflicts (see below)

Resolving Conflicts

  1. You should be at the "Team Synchronizing" perspective. This will look like any regular synchronization for commit purposes where you see files that are new and files that have conflicts.

  2. For every file where you see a conflict choose "right click - Edit Conflicts" (do not double click the file, it will bring up the commit diff version tool, this is VERY different)

    • if you see stuff like "<<<<<<< .working" or ">>>>>>> .merge-right.r84513" then you are in the wrong editing mode
  3. once you have resolved all the conflicts in that file, tell the file to "mark as merged"

  4. once all the files are free of conflicts you can then synchronize your Eclipse project and commit the files to SVN

like image 144
DH4 Avatar answered Sep 19 '22 22:09

DH4