[ANN] Diff::LCS 1.1.1

A

Austin Ziegler

I am pleased to announce the release of Diff::LCS 1.1.1, a bugfix
release over Diff::LCS 1.1.0. This is one of two utility packages
required for installation and use of Ruwiki as a RubyGem.

For those who verify PGP signatures, note that I have changed to
signing my releases with GPG instead of PGP 8.

Diff::LCS README
================
Diff::LCS is a port of Algorithm::Diff[1] that uses the McIlroy-Hunt
longest common subsequence (LCS) algorithm to compute intelligent
differences between two sequenced enumerable containers[2]. The
implementation is based on Mario I. Wolczko's[3] Smalltalk version (1.2,
1993)[4] and Ned Konz's[5] Perl version (Algorithm::Diff)[6].

This release is version 1.1.1, fixing a reported #patch bug in 1.1.0.
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.

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.

Copyright
=========
# Copyright 2004 Austin Ziegler <[email protected]>
# adapted from:
# Algorithm::Diff (Perl) by Ned Konz <[email protected]>
# Smalltalk by Mario I. Wolczko <[email protected]>
# implements McIlroy-Hunt diff algorithm
#
# This program is free software. It may be redistributed and/or modified
# under the terms of the GPL version 2 (or later), the Perl Artistic
# licence, or the Ruby licence.
#
# $Id: README,v 1.6 2004/09/14 18:51:26 austin Exp $

Footnotes
=========
[1] This library is called Diff::LCS because there are multiple
Ruby libraries called Algorithm::Diff maintained by other authors.
[2] By sequenced enumerable, I mean that the order of enumeration is
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.
[3] (e-mail address removed)
[4] ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st
[5] (e-mail address removed)
[6] http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/
 
M

Mauricio Fernández

I am pleased to announce the release of Diff::LCS 1.1.1, a bugfix
release over Diff::LCS 1.1.0. This is one of two utility packages
required for installation and use of Ruwiki as a RubyGem.

Just packaged it for RPA (http://rpa-base.rubyforge.org) as 0.5.1-1 so
it can be installed/upgraded with
rpa update
rpa install archive-tar-minitar

There's a small issue with the tarball you provide (see my reply to the
Archive::Tar::Minitar announcement for a patch).

I also found some problems in bin/htmldiff, which I've fixed in the
RPA port/package:

$ ldiff -u htmldiff.orig htmldiff
--- htmldiff.orig 2004-09-26 18:39:01 +0200
+++ htmldiff 2004-09-26 18:39:52 +0200

@@ -18,6 +18,7 @@
require_gem 'diff-lcs', "1.1.1"
require 'diff/lcs/string'
rescue LoadError
+ require 'diff/lcs'
require 'diff/lcs/string'
end



@@ -32,17 +33,17 @@

# This will be called with both lines are the same
def match(event)
- @output << %Q|<pre class="match">#{event.old_el}</pre>\n|
+ @output << %Q|<pre class="match">#{event.old_element}</pre>\n|
end

# This will be called when there is a line in A that isn't in B
def discard_a(event)
- @output << %Q|<pre class="only_a">#{event.old_el}</pre>\n|
+ @output << %Q|<pre class="only_a">#{event.old_element}</pre>\n|
end

# This will be called when there is a line in B that isn't in A
def discard_b(event)
- @output << %Q|<pre class="only_b">#{event.new_el}</pre>\n|
+ @output << %Q|<pre class="only_b">#{event.new_element}</pre>\n|
end
end
 
D

David Ross

A good example how QA works and is better then
developer packaged software.

Thanks batsman

--dross

--- Mauricio Fernández said:
RubyGem.

Just packaged it for RPA
(http://rpa-base.rubyforge.org) as 0.5.1-1 so
it can be installed/upgraded with
rpa update
rpa install archive-tar-minitar

There's a small issue with the tarball you provide
(see my reply to the
Archive::Tar::Minitar announcement for a patch).

I also found some problems in bin/htmldiff, which
I've fixed in the
RPA port/package:

$ ldiff -u htmldiff.orig htmldiff
--- htmldiff.orig 2004-09-26 18:39:01 +0200
+++ htmldiff 2004-09-26 18:39:52 +0200

@@ -18,6 +18,7 @@
require_gem 'diff-lcs', "1.1.1"
require 'diff/lcs/string'
rescue LoadError
+ require 'diff/lcs'
require 'diff/lcs/string'
end



@@ -32,17 +33,17 @@

# This will be called with both lines are the
same
def match(event)
- @output << %Q|<pre
class="match">#{event.old_el}</pre>\n|
+ @output << %Q|<pre
class="match">#{event.old_element}</pre>\n|
end

# This will be called when there is a line in A
that isn't in B
def discard_a(event)
- @output << %Q|<pre
class="only_a">#{event.old_el}</pre>\n|
+ @output << %Q|<pre
class="only_a">#{event.old_element}</pre>\n|
end

# This will be called when there is a line in B
that isn't in A
def discard_b(event)
- @output << %Q|<pre
class="only_b">#{event.new_el}</pre>\n|
+ @output << %Q|<pre
class="only_b">#{event.new_element}</pre>\n|
end
end




_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
 
M

Mauricio Fernández

A good example how QA works and is better then
developer packaged software.

I am doing some basic verification of the software I package but it's
nowhere close to the amount of testing and the QA work that will get
done once the Ruby Production Archive is more mature.
 
A

Austin Ziegler

A good example how QA works and is better then
developer packaged software.

Thanks batsman

Please, David, shut up. The packaging error is not one that I would
have found because I don't generally test my applications on Linux or
other Unixes during normal operation; the htmldiff error was actually
something related to a planned shift.

In future versions of Diff::LCS, htmldiff will actually be
disappearing in favour of an extension to the ldiff. htmldiff is a
legacy application from the original Perl port.

QA does *not* catch all things; I know, as I work with highly
qualified QA people at work. I appreciate the work that Mauricio has
put into RPA, and I look forward to the stability that the RPA will
provide to people who can't afford to deal with the bleeding edge, but
still appreciate the ability to package my own software and make it
available to others.

There is a time, place, and purpose for both RPA-style and
RubyGem-style packaging systems and philosophies. There is little
time, place, and purpose for sycophants.

-austin
 
D

David Ross

Austin_: comment noted. RPA can have bleeding edge
software in it if batsman really wants a <name>-devl
pacakges.

--dross

--- Austin Ziegler said:
Please, David, shut up. The packaging error is not
one that I would
have found because I don't generally test my
applications on Linux or
other Unixes during normal operation; the htmldiff
error was actually
something related to a planned shift.

In future versions of Diff::LCS, htmldiff will
actually be
disappearing in favour of an extension to the ldiff.
htmldiff is a
legacy application from the original Perl port.

QA does *not* catch all things; I know, as I work
with highly
qualified QA people at work. I appreciate the work
that Mauricio has
put into RPA, and I look forward to the stability
that the RPA will
provide to people who can't afford to deal with the
bleeding edge, but
still appreciate the ability to package my own
software and make it
available to others.

There is a time, place, and purpose for both
RPA-style and
RubyGem-style packaging systems and philosophies.
There is little
time, place, and purpose for sycophants.

-austin





__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top