This is a port of Bram Cohen's patience diff algorithm, as found in the Bazaar 1.14.1 source code, available at http://bazaar-vcs.org.
This copyright notice was included:
# Copyright (C) 2005 Bram Cohen, Copyright (C) 2005, 2006 Canonical Ltd # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
matches a b
returns a list of pairs (i,j) such that a.(i) = b.(j) and such that the
list is strictly increasing in both its first and second coordinates. This is
essentially a "unfolded" version of what get_matching_blocks
returns. Instead of
grouping the consecutive matching block using length
this function would return all
the pairs (mine_start * other_start).
Same
context before and after New
, Old
, and Replace
ranges.
get_hunks a b ~context ~compare
will compare the arrays a
and b
using
compare
and produce a list of hunks. (The hunks will contain Same ranges
of at most context
elements.) context
defaults to infinity (producing a
singleton hunk list), compare
defaults to polymorphic compare.
get_status hunks
returns `Same if each hunk in hunks
has only Same ranges.