Page 1 of 1

Moved lines in reports

Posted: Thu Jun 19, 2008 10:28 am
by tostme

I really need a tool that can detect moved lines in source code. Your tool seems to do that well, but when exporting a report in any of the formats - the moved lines are indistinguishable from simple additions or deletions.

I would like to have a way to clearly distinguish moves from additions or deletions in the report.

It could be an HTML report with hyperlinks between source and destination of the move.

Can you do that? If you do this, I will buy the tool.

Posted: Thu Jun 19, 2008 2:29 pm
by grigsoft
Basically it's not a problem to include this information in html report, I just could not find any usable format for this. I will think about it again - maybe poor implementation is better than nothing in this case.

Posted: Thu Jun 19, 2008 8:05 pm
by tostme
Thank you for looking into this.

The minimum I need is to be able to find both legs of a moved block. So if this is an HTML report, then a hyperlink between two parts of a move will be enough. Color for moved out and moved in text should also be different from simple deletion and insertion. Actual text should stay where it is.

For hyperlink anchors I would generate some unique "change identifier", for example "md525" that stands for "move destination 525".

Other formats such as unified diff - they can't represent moves so I wouldn't worry about them.

Posted: Thu Jun 19, 2008 8:12 pm
by tostme
If you are interested, then what I am doing is trying to maintain two copies of code in sync. One original copy is C# and another is a close port (almost line by line) of it in Java.

While working on C# code we add, delete, change and move lines. Refactorings are rampant so lines could easily move between files or complete files could be moved too.

If I look at the unified diff then it shows me 250K out of 300K lines have changed within a year, but I can see there are plenty of moved unchanged lines, so following a traditonal diff I will waste a lot of time porting unchanged but moved lines.

I started to look for a tool that can find moves well. Apparently there is no tool that can find moves across multiple files, but I figured a way to workaround this. I basically glue all my source files into a single file and then compare just two files. Compare It is the best tool I have found so far. If I can detect both legs of a move that will probably be all I need.