[ZCM] [ZC] 32/ 3 Resolve "Far better "diff""
Collector: Zope Bugs and Patches ...
zope-coders@zope.org
Fri, 15 Feb 2002 12:59:40 -0500
Issue #32 Update (Resolve) "Far better "diff""
Status Resolved, Zope/feature+solution low
To followup, visit:
http://collector.zope.org/Zope/32
==============================================================
= Resolve - Entry #3 by evan on Feb 15, 2002 12:59 pm
Status: Accepted => Resolved
I incorporated this into the trunk. It looks good.
________________________________________
= Assign - Entry #2 by matt on Nov 30, 2001 2:35 pm
Status: Pending => Accepted
Supporters added: klm
Ken, you were interested in this a while back I think. Can you take ownership of this request?
________________________________________
= Request - Entry #1 by Anonymous User on Nov 13, 2001 4:46 pm
"diffing" between two versions of an object shows a very confusing result if you insert or delete lines.
Python 2.1 and up have a library "difflib" that shows far better behaviour. The replacement is trivial and pain free.
In "lib/OFS/History.py" change the line:
cruncher=ndiff.SequenceMatcher(isjunk=split, a=a, b=b)
to:
import difflib
cruncher=difflib.SequenceMatcher()
cruncher.set_seqs(a,b)
This change requires Python 2.1, at least.
If you want compatibility with Python 2.0 and previous, consider adding the "difflib" library to the Zope distribution instead of the ugly "ndiff".
If you don't want to include "difflib" use "try...except" to fallback to the current "unusable" visualization.
==============================================================