Xmerge tool to handle refactors (screencast)
UPDATE 2015/08/25: Check the new updated content here.If you ever read this blog before, you have probably noticed we post about branching and merging from time to time :-P
Ok, today I'm going to introduce the latest crazy idea we just had: Xmerge (cross-merge).
So, suppose you've an initial file like this one:
And then two developers start making changes on it in parallel (which is a very good idea if you don't want them to wait on each other... :-P):
The first developer changes some code on the first method:
And the second one moves the code:
What will happen when you try to merge the changes back?
The merge tool won't detect the moved code, but think some code has been removed and some code has been added. So, you'll end up editing code manually and copying and pasting code blocks around. Painful.
What if the tool could give you some support?
The best thing would be if it just detects the code has been moved, but it means it will have to run some sort of parsing, which is not the easiest thing to do, it becomes language dependent and so on (and this is what we're working on right now, so stay tuned!).
But, what if it justs let's you find yourself the moved code and then the tool is able to manage the dirty work? You'll save some ugly cutting and pasting, right?
It would be great to have something like the following: the tool detects "something has happened", then it prompts you to find the moved code, then it runs a "sub-merge" with only the affected contributors.
You run the sub-merge, solve the potential conflicts, and the tool will replace your selection with the new merged code.
We're working on a new release of the Plastic merge tool, so you can see it in action in the following screencast!!
Yes, there're a few: