July 22, 2010

"Move" support in xdiff

One of the big things we just released in 3.0 is the new Xdiff. We call it "cross diff" because it can locate code that has been moved, and we used to draw it on paper with "crossing lines".

Ok, what is all of this about and why is it so good? Let's go.

Let's start with a piece of code like the following:



Then we move a piece of code a little bit down:



And we slightly modify the moved code as you can see here:



Let's see what Plastic Xdiff can do:



It is able to identify the code as "moved" even when it has been modified. And you can click on the "subdiff" to actually run an independent diff on the moved fragment as you can see below.



Cool, isn't it?

We can do this with any programming language since the algorithm is not based on parsing but in plain text move detection.

Check the following screencast to see it in action.




Don't forget to check the next step too: Xmerge!

Enjoy!

7 comments:

  1. That is a truly awesome feature.

    Has Codice given any thought to licensing xdiff independently of PlasticSCM?

    ReplyDelete
  2. Thanks Jeff!! You know we're always pushing hard to bring the best features to plastic! :)

    We didn't consider licensing xdiff independently but it is definitely something to consider!

    Thanks,

    pablo

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. That is truly awesome. I'm upgrading!

    ReplyDelete
  5. Perforce offers their merge tool as a free download, no doubt in part as a marketing tool.

    ReplyDelete
  6. There's an interesting follow up with more merge cases here: http://www.scootersoftware.com/vbulletin/showthread.php?p=24868&posted=1#post24868

    ReplyDelete