fix source indents of lib/diff.rb

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9317 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-04-03 15:20:39 +00:00
parent f0f7158d87
commit b96710fb57
1 changed files with 49 additions and 49 deletions

View File

@ -33,20 +33,20 @@ module RedmineDiff
next unless bmatches.has_key? aelem next unless bmatches.has_key? aelem
k = nil k = nil
bmatches[aelem].reverse.each { |bindex| bmatches[aelem].reverse.each { |bindex|
if k && (thresh[k] > bindex) && (thresh[k-1] < bindex) if k && (thresh[k] > bindex) && (thresh[k-1] < bindex)
thresh[k] = bindex thresh[k] = bindex
else else
k = thresh.replacenextlarger(bindex, k) k = thresh.replacenextlarger(bindex, k)
end end
links[k] = [ (k==0) ? nil : links[k-1], aindex, bindex ] if k links[k] = [ (k==0) ? nil : links[k-1], aindex, bindex ] if k
} }
} }
if !thresh.empty? if !thresh.empty?
link = links[thresh.length-1] link = links[thresh.length-1]
while link while link
mvector[link[1]] = link[2] mvector[link[1]] = link[2]
link = link[0] link = link[0]
end end
end end
@ -59,14 +59,14 @@ module RedmineDiff
while ai < mvector.length while ai < mvector.length
bline = mvector[ai] bline = mvector[ai]
if bline if bline
while bi < bline while bi < bline
discardb(bi, b[bi]) discardb(bi, b[bi])
bi += 1 bi += 1
end end
match(ai, bi) match(ai, bi)
bi += 1 bi += 1
else else
discarda(ai, a[ai]) discarda(ai, a[ai])
end end
ai += 1 ai += 1
end end
@ -88,17 +88,17 @@ module RedmineDiff
i = 0 i = 0
curdiff = [] curdiff = []
while i < df.length while i < df.length
whot = df[i][0] whot = df[i][0]
s = @isstring ? df[i][2].chr : [df[i][2]] s = @isstring ? df[i][2].chr : [df[i][2]]
p = df[i][1] p = df[i][1]
last = df[i][1] last = df[i][1]
i += 1 i += 1
while df[i] && df[i][0] == whot && df[i][1] == last+1 while df[i] && df[i][0] == whot && df[i][1] == last+1
s << df[i][2] s << df[i][2]
last = df[i][1] last = df[i][1]
i += 1 i += 1
end end
curdiff.push [whot, p, s] curdiff.push [whot, p, s]
end end
diffs.push curdiff diffs.push curdiff
} }
@ -160,9 +160,9 @@ module Diffable
range.each { |i| range.each { |i|
elem = self[i] elem = self[i]
if revmap.has_key? elem if revmap.has_key? elem
revmap[elem].push i revmap[elem].push i
else else
revmap[elem] = [i] revmap[elem] = [i]
end end
} }
return revmap return revmap
@ -181,9 +181,9 @@ module Diffable
found = self[index] found = self[index]
return nil if value == found return nil if value == found
if value > found if value > found
low = index + 1 low = index + 1
else else
high = index high = index
end end
end end
@ -206,25 +206,25 @@ module Diffable
bi = 0 bi = 0
diff.diffs.each { |d| diff.diffs.each { |d|
d.each { |mod| d.each { |mod|
case mod[0] case mod[0]
when '-' when '-'
while ai < mod[1] while ai < mod[1]
newary << self[ai] newary << self[ai]
ai += 1 ai += 1
bi += 1 bi += 1
end end
ai += 1 ai += 1
when '+' when '+'
while bi < mod[1] while bi < mod[1]
newary << self[ai] newary << self[ai]
ai += 1 ai += 1
bi += 1 bi += 1
end end
newary << mod[2] newary << mod[2]
bi += 1 bi += 1
else else
raise "Unknown diff action" raise "Unknown diff action"
end end
} }
} }
while ai < self.length while ai < self.length