Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Text_Diff - A PHP Component that supports multiple diff engines, data types, and output formats.
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
Comment | File | Size | Author |
---|---|---|---|
#4 | text_diff-example1.php_.txt | 691 bytes | mitchell |
#4 | text_diff-example2.php_.txt | 933 bytes | mitchell |
Comments
Comment #0.0
mitchell CreditAttribution: mitchell commentedDiff issues
Comment #1
mitchell CreditAttribution: mitchell commentedComment #2
sunI 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.
Comment #2.0
sunx
Comment #3
mitchell CreditAttribution: mitchell commented> 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.
Comment #3.0
mitchell CreditAttribution: mitchell commentedx
Comment #4
mitchell CreditAttribution: mitchell commentedHere 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
.Comment #4.0
mitchell CreditAttribution: mitchell commentedx
Comment #4.1
mitchell CreditAttribution: mitchell commentedx
Comment #4.2
mitchell CreditAttribution: mitchell commentedx
Comment #5
OnkelTem CreditAttribution: OnkelTem commentedFor me it's clear that the first example is better. +1 for the idea.
Comment #6
mitchell CreditAttribution: mitchell commentedSwitching 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.
Comment #6.0
mitchell CreditAttribution: mitchell commentedx
Comment #7
gddI 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.
Comment #8
kscheirercan 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.
Comment #9
Alan D. CreditAttribution: Alan D. commentedThis 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.
Comment #9.0
Alan D. CreditAttribution: Alan D. commenteddevelopment tools
Comment #9.1
mitchell CreditAttribution: mitchell commentedDependencies and other fixes
Comment #10
Alan D. CreditAttribution: Alan D. commentedThe 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.
Comment #10.0
Alan D. CreditAttribution: Alan D. commentedx