Text_Diff - A PHP Component that supports multiple diff engines, data types, and output formats.

Source Code
Documentation

Lastest Release October, 2012
License LGPL-2.1
Maintainers Chuck Hagenbuch (as lead), Jan Schneider (as lead)

Engines

native 16K PHP, algorithm is mostly lifted from the perl module
xdiff 4k Pear PHP package. Supports patch & binary files
shell 8K GNU Diffutils' system diff command
string 12K PHP, for parsing diff files, I think

Outputs Formats

  • Context Diff (classic)
  • Wiki-style (inline)
  • Unified (classic)
  • 3 Way (merge)
  • Patch (text or binaries), - uses xdiff or shell

Development tools

* Bug tracker [1] [2]
* Code repository: [1] [2]

Dependencies

Horde_Util 96K These classes provide functionality useful for all kind of applications.
Horde_Exception 40k This class provides the default exception handlers for the Horde Application Framework.
Horde_Translation 32K Translation wrappers.

Related Issues

* #120955: Integrate Diff into Core
* #1821548: Add a "diff" of some kind to the CMI UI

Files: 

Comments

Project:Drupal core» Diff
Issue summary:View changes

Diff issues

Title:Add Horde_Text_Diff in CoreAdd Text_Diff Component in Core
Project:Diff» Drupal core

I think that's a fork of http://pear.php.net/package/Text_Diff

Diff module uses a class from phpwiki:
http://drupalcode.org/project/diff.git/blob/refs/heads/7.x-3.x:/DiffEngi...

This class is not only used for node revision diffs, but also by Features module.

Project:Drupal core» Diff
Issue summary:View changes

x

Project:Diff» Drupal core

> I think that's a fork of http://pear.php.net/package/Text_Diff
They're the same library. The Pear/Text_Diff homepage says that Horde_Text_diff supersedes it. There's also a discussion on pear-dev@lists.php.net, Horde components, deprecating old pear components.

> Diff module uses a class from phpwiki
Yes, but it is an old, invented-here-fork which is slow and very difficult to maintain. Another critical difference is that this library supports 3-way diff-ing, which allows merging configuration updates when there are local changes, as well as, for merging branched-revision workflows, see #1703168-24: [Meta] Ensure that configuration system functionality matches expected workflows for users and devs.

Project:Drupal core» Diff
Issue summary:View changes

x

Project:Diff» Drupal core
StatusFileSize
new933 bytes
new691 bytes

Here are two examples, the first is from a project called osmium, and the second is from /Horde_Text_Diff-2.0.0beta1/doc/Horde/Text/Diff/examples/diff.php.

Project:Drupal core» Diff
Issue summary:View changes

x

Issue summary:View changes

x

Issue summary:View changes

x

Project:Diff» Drupal core

For me it's clear that the first example is better. +1 for the idea.

Title:Add Text_Diff Component in CoreMove to Text_Diff library
Project:Drupal core» Diff
Version:8.x-dev» 7.x-3.x-dev
Component:other» Code

Switching this issue over to Diff module.
---

#458672-10: Use real HTML-Diff algorithm in Drupal Diff module contains a 2-year-old patch to diff.module to use Text_Diff. It was done to support the inline diff view mode. ( https://drupal.org/files/issues/diff.module_2.patch )

#1807350-10: Diff 7.x-3.x field support shows another example use case.

Issue summary:View changes

x

I did some analysis of four native PHP libraries at #1821548-6: Add a "diff" of some kind to the CMI UI for inclusion in core. We have somewhat different requirements for core inclusion than a contrib module does, but that information might still be useful for this issue.

can we postpone this in the interest of getting a stable 7.x-3.0 out? It seems like adopting new libraries will require quite a few code changes, in addition to possibly creating new features in the module.

This is definitely on hold unless another developer wants to stick their hands up to tackle this! We have had the standard Diff Engine since 4.7.

Note that I am simply waiting for two users to give a green light before tagging the latest dev version as 3.0.

Issue summary:View changes

development tools

Issue summary:View changes

Dependencies and other fixes

Status:Active» Closed (duplicate)

The DiffEngine is now in core (Drupal 8.x) so I'm thinking changes should be done here first and then possibly back ported to Diff 7.x. Otherwise we will end up with two comparison engines in Diff 8.x or loss features when reverting back to the phpwiki version.

As such, marking as duplicate of #1848264: Compare and merge PhpWiki diff*.php with MediaWiki's DairikiDiff.php and DiffEngine.php.

Issue summary:View changes

x