@@ -9,14 +9,14 module RedmineDiff | |||||
9 | afinish = a.length-1 |
|
9 | afinish = a.length-1 | |
10 | bfinish = b.length-1 |
|
10 | bfinish = b.length-1 | |
11 | mvector = [] |
|
11 | mvector = [] | |
12 |
|
12 | |||
13 | # First we prune off any common elements at the beginning |
|
13 | # First we prune off any common elements at the beginning | |
14 | while (astart <= afinish && bstart <= afinish && a[astart] == b[bstart]) |
|
14 | while (astart <= afinish && bstart <= afinish && a[astart] == b[bstart]) | |
15 | mvector[astart] = bstart |
|
15 | mvector[astart] = bstart | |
16 | astart += 1 |
|
16 | astart += 1 | |
17 | bstart += 1 |
|
17 | bstart += 1 | |
18 | end |
|
18 | end | |
19 |
|
19 | |||
20 | # now the end |
|
20 | # now the end | |
21 | while (astart <= afinish && bstart <= bfinish && a[afinish] == b[bfinish]) |
|
21 | while (astart <= afinish && bstart <= bfinish && a[afinish] == b[bfinish]) | |
22 | mvector[afinish] = bfinish |
|
22 | mvector[afinish] = bfinish | |
@@ -27,7 +27,7 module RedmineDiff | |||||
27 | bmatches = b.reverse_hash(bstart..bfinish) |
|
27 | bmatches = b.reverse_hash(bstart..bfinish) | |
28 | thresh = [] |
|
28 | thresh = [] | |
29 | links = [] |
|
29 | links = [] | |
30 |
|
30 | |||
31 | (astart..afinish).each { |aindex| |
|
31 | (astart..afinish).each { |aindex| | |
32 | aelem = a[aindex] |
|
32 | aelem = a[aindex] | |
33 | next unless bmatches.has_key? aelem |
|
33 | next unless bmatches.has_key? aelem | |
@@ -118,7 +118,7 module RedmineDiff | |||||
118 | @difftype = diffs_or_a.class |
|
118 | @difftype = diffs_or_a.class | |
119 | end |
|
119 | end | |
120 | end |
|
120 | end | |
121 |
|
121 | |||
122 | def match(ai, bi) |
|
122 | def match(ai, bi) | |
123 | @diffs.push @curdiffs unless @curdiffs.empty? |
|
123 | @diffs.push @curdiffs unless @curdiffs.empty? | |
124 | @curdiffs = [] |
|
124 | @curdiffs = [] |
General Comments 0
You need to be logged in to leave comments.
Login now