Make Eclipse RTC acknowledge file merges done outside Eclipse - eclipse

I'm using the Eclipse plugin for Rational Team Concert (RTC) and would like to use IntelliJ IDEA as my merge tool for resolving conflicts in incoming changes. I've already set Eclipse to use IntelliJ as its external compare tool:
When I open files with conflicts from Eclipse (e.g. from incoming changesets), they do open inside the IntelliJ merge tool. But after I make changes and select "Resolve as merged" in Eclipse, I get the error
The file has not been merged. You can open a compare editor and do the merge, or resolve with mine or proposed.
This happens regardless of whether I use the » (apply) and ✕ (ignore) GUI buttons or type/paste changes directly into the result pane.
I found a sort-of-workaround that might help with diagnosis: Eclipse RTC will sometimes accept merges after they've been attempted multiple times, or if the file is opened with "Open in External Compare Tool" from the context menu instead of by double-clicking the file name. But both of these methods are highly inconsistent, at best.
I know external merging is supposed to work because others on my team are doing it with no problems. I don't see any differences between my settings and theirs, though. Maybe I'm just not looking in the right place? I've checked under Preferences > Team > Jazz Source Control > External Compare Tool.
How can I get Eclipse RTC to understand when merges have been done, and let me select "Resolve as Merged" after manually merging in IntelliJ?

Following "Merging files using IntelliJ IDEA as a command line tool"
Type the following command at the command prompt:
<IntelliJ IDEA launcher(Windows) or wrapper script (MacOS or UNIX)>
merge <path to file1> <path to file2> <path to file3> <path to output>
where:
file1 is your local copy,
file2 is the repository version,
file3 is the base revision for file1 and file2, and
output is the file to save the merge results in (optional).
So in your case, try and invert the order for file2 and file1.

Related

Eclipse apparently picks up all but one projects from Git repository

I have a checked-out version of the Redmine-Mylyn connector open-source project. There are eight Eclipse plug-in projects plus two Eclipse features projects plus .git/ as their sibling in the local file system. It turns out that after importing them as Plug-ins and Fragments (with options Projects with source folders) Eclipse recognizes all plug-in projects but net.sf.redmine_mylyn in the Git repository (i.e. it shows a corresponding suffix next to these project names in its Project Explorer view.)
So net.sf.redmine_mylyn is apparently not recognized with these apparent effects: it has no such suffix in the Project Explorer view and its Team menu list only Apply Patch ... (but no other option related to either Git or sharing). However, if I run git status from the command line e.g. on net.sf.redmine_mylyn/build.properties I can see that it very well also part of the same repository. The Project Explorer does not show the two feature projects at all.
What could be the reason that Eclipse (Kepler) apparently does not recognize one plug-in project in the Git repository and how could I make it do so?
UPDATE
Here is how the .project files are arranged in the file system (output from find . -name .project):
./net.sf.redmine_mylyn/.project
./net.sf.redmine_mylyn.api/.project
./net.sf.redmine_mylyn.api-test/.project
./net.sf.redmine_mylyn.common/.project
./net.sf.redmine_mylyn.core/.project
./net.sf.redmine_mylyn.core-test/.project
./net.sf.redmine_mylyn.core.extension.timesheet_extensions_plugin/.project
./net.sf.redmine_mylyn.extensions.feature/.project
./net.sf.redmine_mylyn.feature/.project
./net.sf.redmine_mylyn.ui/.project
The .project files reference three or four buildCommands (org.eclipse.jdt.core.javabuilder, org.eclipse.pde.ManifestBuilder, org.eclipse.pde.SchemaBuilder, org.eclipse.pde.ds.core.builder)
and two natures (org.eclipse.pde.PluginNature, org.eclipse.jdt.core.javanature). The offending project is one of those which do not reference org.eclipse.pde.ds.core.builder.
And find . -name .git gives:
./.git
Using the usual Import > Existing Projects into Workspace wizard, I could not reproduce the problem. I don't know what Import > Plug-ins and Fragments is supposed to do, but it looks like a bug in there.
I recommend filing a bug for Eclipse PDE and add the link to it here. Be sure to include the specifics such as which repository you used. A high quality bug report contains: A series of steps to reproduce the problem (like you would write in a short tutorial), followed by "this is what I expected to happend" and "this is what actually happened".

EGit Compare shows all lines as changed

Just installed Eclipse 4.3 (Kepler) which comes with EGit (which I updated to EGit 3.2.201312181205-r), and Git for Windows. I cloned a repository in the Git for Windows Bash shell under an existing Eclipse workspace, and then in Eclipse imported it as a project. However, if I right click a file that I haven't changed and select Compare With > HEAD Revision, it shows all lines as different.
In the Git for Windows bash shell, git diff on the file shows nothing. Running od -c on the file in Git bash shows it has Windows-style line endings.
When I go into Eclipse preferences for Compare/Patch and say to ignore whitespace, it shows no differences. But I'd like to understand why that is necessary.
What is really being compared here?
This is a know bug in Egit. https://bugs.eclipse.org/bugs/show_bug.cgi?id=342372
Even in Egit 3.4 (planned for June 2014) it won't be fixed. Robin Stocker gave this suggestion in the duplicate of the above bug:
Until this is implemented, I recommend this setup:
For each Eclipse project, go to Properties > Resource and change "New text file line delimiter" to Other: Unix. Commit the resulting
.settings/org.eclipse.core.runtime.prefs files.
Don't configure any .gitattributes or "core.autocrlf" for Git. This means that files will have the same line endings in the working
directory as in the repository. Git and EGit will not convert any file
contents.
With 1., all new files that are created in Eclipse will have correct
(LF) line endings, even when created by a user on Windows.
For files that are already in your repository with CRLF, you can fix
them and commit the result. I recommend using dos2unix or fromdos on
the command line.
However it's been reported that Egit ignores these settings when importing a project. https://bugs.eclipse.org/bugs/show_bug.cgi?id=421364
So it looks like all developers need to check the line endings themselves. But least you don't need any other tools to fix this. Under the File menu in Eclipse there's a: "Convert Line Delimiters To". Also note there are line ending settings for both individual projects and in the workspace settings.
For projects: right-click -> properities -> Resource
For Workspace: Window -> preferences -> General -> Workspace

How to use external diff viewers in eclipse? Is there any diff viewer available for eclipse inbuilt?

I am working on a java project in eclipse . Every time commit a file i want to view what are all the changes have done in this file . In eclipse its hard to analyze which lines are removed , added , changed etc . Please give your suggestions on this .
You don't say what version control system you're using, but most of them (cvs, svn, git, and perforce, that I know of) implement the Team > Synchronize functionality. The Synchronize perspective provides a preview of both outgoing and incoming changes; you can easily see what has changed that you need to commit side-by-side with what has changed in the repository that you have yet to receive. Right-click a project (or any other selection of version-controlled resources) and select Team > Synchronize. It's virtually identical to what you show from Netbeans.
You can also use the Compare With menu and/or whatever options are presented by your version control system under the Team menu for individual files.
The colors in the compare view can be customized to your liking, via Preferences > General > Appearance > Colors and Fonts (look for Text Compare in the tree).
For Mercurial, the MercurialEclipse plugin implements this Synchronize view.
I landed here because I was looking for a way to merge in an external merge editor (KDIFF3) but start the merge from eclipse. I wasn't satisfied with the answers provided above. So here is ho to configure kdiff3 as merge and diff editor for SVN in eclipse:
go to Windows -> Preferences → Team -> SVN -> Diff Viewer
Add a new config (add button):
Extension or mimetype: * - if you wish you can specify different mimetypes for different editors, I didn't need that thus the alquantor.
Diff: Program path C:\Program Files\KDiff3\kdiff3.exe (or wherever you have your merge editor - sry for the windows path, feel free to add a linux version in the comments or edit this answer.)
Arguments:
${base} ${mine} ${theirs}
Merge: Program path C:\Program Files\KDiff3\kdiff3.exe
Arguments:
${base} ${mine} ${theirs} -o ${merged}
This will probably work as well for other merge editors, but with a different argument syntax (figure it out an let us know :) ).
The usage is as usual (team->edit conflicts) for merging and compare->foo for the diff view.
Cheers
actually eclipse have inbuilt compare tool. if u need compare with any other app, try this plugin
http://sourceforge.net/projects/externaldiff/
Also, if someone doesn't have to call it indirectly from Eclipse (for example I just don't like to install additional packages such as externaldiff from Mohamed Jameel answer on my Linuxes), you may try call external diff viewer from SVN.
On Linux this article was very helpful for me: SVN: how to compare working copy with repository revision?.

Beyond Compare as default diff tool in Eclipse when using Mercurial?

Is there any way to make Beyond Compare 3 the default diff tool in Eclipse?
I'm using the Mercurial plugin and would like to use BC3 for diffing files and handling merge conflicts.
I'm only able to find solutions when it comes to CVS or SVN when searching this site.
See the following query for discussion on external diff tool for Mercurial Eclipse.
http://bitbucket.org/mercurialeclipse/main/issue/310/external-diff-tool
It suggests that standard approach for setting up external diff tool should suffice. So setting up ".hgrc" should work.
Since this is no different from any other setup, you can test it by using hg commands in shell. See if that throws any errors and then check out with eclipse.
The setting for external merge tool is available in the plugin settings.
http://bitbucket.org/mercurialeclipse/main/wiki/Installation_and_Configuration#main-preferences
[edit: with hgrc]
This will work when you use command line.
The following "ExtdiffExtension" extension should help.
The extdiff Mercurial extension allows you to use external programs to compare revisions, or revision with working dir. The external diff programs are called with a configurable set of options and two non-option arguments: paths to directories containing snapshots of files to compare.
You need to install Beyond Compare Eclipse Plugin (Beyond CVS) which would provide this functionality.
Cheers!!!

How do you do merges using Git, Eclipse and Egit

I, like many others, love Eclipse as my ide of choice, and because of the way I work (moving about, different places, different projects) want to use Git for CVS.
There is a plugin for Git in Eclipse, Egit, which is now an official Eclipse project, and currently at version 0.7.1. As I've just started using it I'm interested in how others are using it, and what work arounds they are using. Currently Egit doesn't have support for merges, so these have to be done outside of Eclipse and then the workspace refreshed.
So, How do you do this task ? (and any other tasks that Egit doesn't do right now)
Just for reference, EGIT does now support merges and uses the powerful diff interface within eclipse.
Once you have fetched the code and run a merge, if there are any conflicts they are highlighted in the project explorer with a red !, you can then right click on them and go to Team > Merge Tool, which is un-ghosted for conflicted files.
Once you have selected the code you wish to use (Either the workspace version with diff annotations in it or the HEAD version that caused the conflict) the diff window will open.
This shows your local code on the left and the conflicting code on the right, you can use the 'next difference' button to jump through all the conflicts, and the 'copy change from right to left' button to accept the remote version, or simply edit your local version in place.
Once you are happy with the changes save your file and add it, then commit the results and you should be done.
Please note I am in no way a master of git good practice, so please feel free to correct me if these are not the best operations to use, but it was an answer to the question "How do I do merges in eclipse with egit".
When working with Eclipse, I only use egit to actually commit. Everything else I do simply via the command line. The command line in git (or any other VCS) is much more superior and the software was actually created with having the command line in mind, so it's just naturally that you can access really every single feature via the command line.
Everything else only uses the command line in the background and tries to emulate a different interface, native to the host application (here: Eclipse). But by doing that you can never reach the same power as by using the original tools.
However I think when egit develops more, it might be a good way to work with git; similar to how the subversion plugin for Eclipse works well with most functions. But in my situation, I don't use Eclipse for everything and using the command line is then a lot simpler than trying to get used to multiple different plugins and the command line.
One way to work out with Egit merge conflict is to take backup of your file, delete it from eclipse, put it back from backup, Add to index and commit.
This should be done only if you can't resolve the conflict with normal Add to Index->Commit method.
PS: I assume you've already resolved the conflict manually or by using Egit merge tool, but just can't remove the conflict marker on the file.