Xmerge to merge refactored codeIt's been a funny week. We first announced 3.0, then announced Xdiff, later crunched Subversion and now we're finally explaining a little bit about what Xmerge is about.
Merging moved code
If you need to know what we're doing with diff and merge stuff, I'd strongly recommend you to read the post about Xdiff first. There's even a short screencast if you don't feel like reading :P.
Well, basically Xmerge applies the tech. we developed for Xdiff into the merge process. The scenario is simple:
Let's start with a very simple piece of code like the one below
Someone moves the multiply method down
The "multiply" method is private and I do like to see privates at the bottom, so I just go and move it down.
Then I check the differences with Plastic:
And meanwhile someone refactors the method
The multiply method is not exactly the best code ever written, right? :) Let's just change a few things.
Branching structure before merging
Here's the branching structure as Plastic renders it just before merging.
When you merge both branches back into /main (well, the first one you choose won't complain, it will be a direct merge) you'll get a nice conflict like the one below.
The extremely nice thing about xmerge is that it will show a Xmerge button telling you there's an option to help you solving your problems. Just click it! (click on the image below to enlarge).
So, what's going on here?
Xmerge detects the code-block you're trying to merge has been moved. So it will detect where it is and will launch a "submerge" with just the right contributors (the ancestor and contributors plus the result). You can easily resolve the conflict there and when done, the result will be pasted back into the original merge window. Cool?
The cross-merged result
Here it goes:
And now the movie
Some of you will prefer to watch the movie than reading the book, so here it goes :P
Make it full screen! It was recorded at 1024x768 so you should be able to see all the details.
Well, it is not the easiest thing to explain, so feel free to ask!!!
This is our second step on Xmerge technology, the first generation (since Plastic 2.8) was able to run the "submerge" but you had to find the moved code yourself. Now with all the Xdiff technology we're able to perform the detection ourselves.
Hope you like it! And be sure there's more to come!