[dev] Issue with Text_Diff threeway

Jason Margolin jmargolin at digitalspy.co.uk
Mon Sep 26 14:18:04 UTC 2011


Hi,

The Text_Diff library is great, we use the native engine and the
unified renderer to output diff's on web pages (v1.0.1 from
pear.horde.org).

The problem is we want to use the threeway diff, however we can't get
it to work with the unified renderer.

We use this at the moment to output the lines that have been
added/deleted for two way:

$diff = new Horde_Text_Diff('native', array($lines1, $lines2));
$renderer = new Horde_Text_Diff_Renderer_Unified();
echo $renderer->render($diff);

For threeway we changed the $diff line to:

$diff = new Horde_Text_Diff_ThreeWay($lines1, $lines2, $lines3);

The $lines variables all being arrays of data split by line.

This however does not output the line differences, just the blockHeader.

In the threeway code there is a function called mergedOutput() which
returns an array, but this doesn't go through the renderer so we don't
know which lines have been added/deleted.

Any help would be much appreciated!

Jason


More information about the dev mailing list