forked from halostatue/diff-lcs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Austin Ziegler
committed
Jul 31, 2011
1 parent
9feacf8
commit 743cff6
Showing
11 changed files
with
795 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
spec/ldap.yml | ||
.rvmrc | ||
pkg/ | ||
*.swp | ||
*.pyc | ||
html/ | ||
doc/ | ||
publish/ | ||
coverage/ | ||
coverage.info | ||
.rake_tasks~ | ||
.DS_Store | ||
website/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
== License | ||
|
||
This software is available under three licenses: the GNU GPL version 2 (or at | ||
your option, a later version), the Perl Artistic license, or the MIT license. | ||
Note that my preference for licensing is the MIT license, but Algorithm::Diff | ||
was dually originally licensed with the Perl Artistic and the GNU GPL and that | ||
the Ruby implementation hews pretty closely to the Perl version, so I must | ||
maintain the additional licensing terms. | ||
|
||
* Copyright 2004–2011 Austin Ziegler. | ||
* Adapted from Algorithm::Diff (Perl) by Ned Konz and a Smalltalk versionby | ||
Mario I. Wolczko <mario@wolczko.com> | ||
|
||
=== MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
=== Perl Artistic License (version 2) | ||
See the file docs/artistic.txt in the main distribution. | ||
|
||
=== GNU GPL version 2 | ||
See the file docs/COPYING.txt in the main distribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
History.rdoc | ||
License.rdoc | ||
README.rdoc | ||
Rakefile | ||
bin/htmldiff | ||
bin/ldiff | ||
diff-lcs.gemspec | ||
docs/COPYING.txt | ||
docs/artistic.html | ||
lib/diff/lcs.rb | ||
lib/diff/lcs/array.rb | ||
lib/diff/lcs/block.rb | ||
lib/diff/lcs/callbacks.rb | ||
lib/diff/lcs/change.rb | ||
lib/diff/lcs/hunk.rb | ||
lib/diff/lcs/ldiff.rb | ||
lib/diff/lcs/string.rb | ||
tests/00test.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
= diff-lcs | ||
|
||
== Description | ||
Diff::LCS is a port of Perl's Algorithm::Diff that uses the McIlroy-Hunt | ||
longest common subsequence (LCS) algorithm to compute intelligent differences | ||
between two sequenced enumerable containers. The implementation is based on | ||
Mario I. Wolczko's {Smalltalk version 1.2}[ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st] | ||
(1993) and Ned Konz's Perl version | ||
{Algorithm::Diff}[http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/]. | ||
|
||
This is release 1.1.3, fixing several small bugs found over the years. Version | ||
1.1.0 added new features, including the ability to #patch and #unpatch changes | ||
as well as a new contextual diff callback, Diff::LCS::ContextDiffCallbacks, | ||
that should improve the context sensitivity of patching. | ||
|
||
This library is called Diff::LCS because of an early version of Algorithm::Diff | ||
which was restrictively licensed. This version has seen a minor license change: | ||
instead of being under Ruby's license as an option, the third optional license | ||
is the MIT license. | ||
|
||
== Where | ||
|
||
* {GitHub}[https://github.com/halostatue/diff-lcs] | ||
|
||
This is the new home of Diff::LCS (diff-lcs). The Ruwiki page still refers to | ||
it, but development is not happening there any longer. | ||
|
||
== Synopsis | ||
|
||
Using this module is quite simple. By default, Diff::LCS does not extend | ||
objects with the Diff::LCS interface, but will be called as if it were a | ||
function: | ||
|
||
require 'diff/lcs' | ||
|
||
seq1 = %w(a b c e h j l m n p) | ||
seq2 = %w(b c d e f j k l m r s t) | ||
|
||
lcs = Diff::LCS.LCS(seq1, seq2) | ||
diffs = Diff::LCS.diff(seq1, seq2) | ||
sdiff = Diff::LCS.sdiff(seq1, seq2) | ||
seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj) | ||
bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj) | ||
seq2 == Diff::LCS.patch!(seq1, diffs) | ||
seq1 == Diff::LCS.unpatch!(seq2, diffs) | ||
seq2 == Diff::LCS.patch!(seq1, sdiff) | ||
seq1 == Diff::LCS.unpatch!(seq2, sdiff) | ||
|
||
Objects can be extended with Diff::LCS: | ||
|
||
seq1.extend(Diff::LCS) | ||
lcs = seq1.lcs(seq2) | ||
diffs = seq1.diff(seq2) | ||
sdiff = seq1.sdiff(seq2) | ||
seq = seq1.traverse_sequences(seq2, callback_obj) | ||
bal = seq1.traverse_balanced(seq2, callback_obj) | ||
seq2 == seq1.patch!(diffs) | ||
seq1 == seq2.unpatch!(diffs) | ||
seq2 == seq1.patch!(sdiff) | ||
seq1 == seq2.unpatch!(sdiff) | ||
|
||
By requiring 'diff/lcs/array' or 'diff/lcs/string', Array or String will be | ||
extended for use this way. | ||
|
||
Note that Diff::LCS requires a sequenced enumerable container, which means that | ||
the order of enumeration is both predictable and consistent for the same set of | ||
data. While it is theoretically possible to generate a diff for unordereded | ||
hash, it will only be meaningful if the enumeration of the hashes is | ||
consistent. In general, this will mean that containers that behave like String | ||
or Array will perform best. | ||
|
||
:include: License.rdoc |
Oops, something went wrong.