7

A huge Java file has been extensively modified by both my company and another company, and now is time to merge.

Kdiff3 showing its limits

Usually I use Meld or Kdiff3, but today I feel that a better tool is needed. Meld does not show ANCESTOR, and merging in Kdiff3 means that for each change I can only keep either MINE or THEIRS, I can't add both or edit to merge the good stuff of both sides.

Absolute requirements:

  • See 3 files side-by-side: ANCESTOR, THEIRS, MINE
  • Ability to edit MINE, saving refreshes the diff/merge
  • Show character-level diff with color
  • Refresh does not lose cursor/scroll location
  • Open source
  • Usable on Linux

Bonus for smart Java/C# method blocks recognition:

  • Recognize method prototypes and gives them a lot more weight than other lines.
  • Don't split Javadoc+method blocks
  • UI foldable method-by-method
  • Ideally can tell me beforehand about methods that have been moved around
  • Add all imports generously, as removing unneeded ones is an easy later fix.

Note: Each of the two branches have their own history of commits and sub-branches which are publicly accessible on Github.

6
  • 2
    In that case have you tried starting a branch based on your changes then rebasing it on the other set? It seems like stepping through the changes one by one would be saner that a single brain-crushing three way merge. Even starting a clean branch at the point they diverged and then cherry-picking the changes you want from each would be better for the health of the code. This assumes that people have made sane incremental commits, but it might be worth checking into.
    – Caleb
    Mar 14, 2014 at 10:05
  • 1
    I use KDiff3 for all of my merging and I do have the ability to add from MINE and THEIRS, as well as the ability to edit the final output directly in KDiff3. I'm not sure why you claim that is not possible.
    – Jason Down
    Mar 14, 2014 at 12:36
  • @JasonDown: I can't edit anything with kdiff3 0.9.97
    – Nicolas Raoul
    Mar 15, 2014 at 16:44
  • I have 0.0.96a and I can choose B, then go back to the line and also choose C (or vice versa), which puts both changes in. Also, i can go into the output pane at the bottom and directly edit the output file while making changes. I can do some screenshots if needed.
    – Jason Down
    Mar 16, 2014 at 15:35
  • I meant 0.9.96a for the version.
    – Jason Down
    Mar 16, 2014 at 22:15

1 Answer 1

1

As pointed out by JasonDown, kdiff3 is actually able to do more-or-less this.

It does not allow for MINE to be edited, but the output pane can be used to select both lines from ANCESTOR and THEIRS, and can be edited.

1
  • Where is your fourth pane gone ? Kdiff3 shows 4 panes, not just 3! Mar 24 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.