Xmerge tool to handle refactors (screencast)

August 8, 2008

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).

What's cross-merge? Simply put: it is just a tool to help developers merging code that has been moved and modified in parallel. This is very likely to happen when you refactor your code.

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.

Easy, right?

We're working on a new release of the Plastic merge tool, so you can see it in action in the following screencast!!



Next steps?

Yes, there're a few:

  • What happens when code is moved into a different file? We're working on it.
  • Auto detecting moved code
  • Looking for moved code in files

    Stay tuned!
  • No comments :

    Real Time Web Analytics