everypolitician-daff 1.3.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +252 -0
- data/bin/daff.rb +3 -0
- data/lib/daff.rb +150 -0
- data/lib/lib/coopy/alignment.rb +307 -0
- data/lib/lib/coopy/cell_builder.rb +17 -0
- data/lib/lib/coopy/cell_info.rb +33 -0
- data/lib/lib/coopy/column_change.rb +16 -0
- data/lib/lib/coopy/combined_table.rb +127 -0
- data/lib/lib/coopy/combined_table_body.rb +151 -0
- data/lib/lib/coopy/combined_table_head.rb +103 -0
- data/lib/lib/coopy/compare_flags.rb +127 -0
- data/lib/lib/coopy/compare_table.rb +688 -0
- data/lib/lib/coopy/conflict_info.rb +23 -0
- data/lib/lib/coopy/coopy.rb +1065 -0
- data/lib/lib/coopy/cross_match.rb +17 -0
- data/lib/lib/coopy/csv.rb +290 -0
- data/lib/lib/coopy/diff_render.rb +339 -0
- data/lib/lib/coopy/diff_summary.rb +28 -0
- data/lib/lib/coopy/flat_cell_builder.rb +75 -0
- data/lib/lib/coopy/highlight_patch.rb +977 -0
- data/lib/lib/coopy/highlight_patch_unit.rb +38 -0
- data/lib/lib/coopy/index.rb +131 -0
- data/lib/lib/coopy/index_item.rb +37 -0
- data/lib/lib/coopy/index_pair.rb +96 -0
- data/lib/lib/coopy/json_table.rb +165 -0
- data/lib/lib/coopy/json_tables.rb +129 -0
- data/lib/lib/coopy/merger.rb +197 -0
- data/lib/lib/coopy/meta.rb +20 -0
- data/lib/lib/coopy/mover.rb +197 -0
- data/lib/lib/coopy/ndjson.rb +134 -0
- data/lib/lib/coopy/nested_cell_builder.rb +74 -0
- data/lib/lib/coopy/ordering.rb +54 -0
- data/lib/lib/coopy/property_change.rb +16 -0
- data/lib/lib/coopy/row.rb +11 -0
- data/lib/lib/coopy/row_change.rb +42 -0
- data/lib/lib/coopy/row_stream.rb +11 -0
- data/lib/lib/coopy/simple_meta.rb +314 -0
- data/lib/lib/coopy/simple_table.rb +345 -0
- data/lib/lib/coopy/simple_view.rb +70 -0
- data/lib/lib/coopy/sparse_sheet.rb +51 -0
- data/lib/lib/coopy/sql_column.rb +47 -0
- data/lib/lib/coopy/sql_compare.rb +605 -0
- data/lib/lib/coopy/sql_database.rb +21 -0
- data/lib/lib/coopy/sql_helper.rb +17 -0
- data/lib/lib/coopy/sql_table.rb +335 -0
- data/lib/lib/coopy/sql_table_name.rb +23 -0
- data/lib/lib/coopy/sql_tables.rb +128 -0
- data/lib/lib/coopy/sqlite_helper.rb +316 -0
- data/lib/lib/coopy/table.rb +24 -0
- data/lib/lib/coopy/table_comparison_state.rb +50 -0
- data/lib/lib/coopy/table_diff.rb +1185 -0
- data/lib/lib/coopy/table_io.rb +72 -0
- data/lib/lib/coopy/table_modifier.rb +40 -0
- data/lib/lib/coopy/table_stream.rb +102 -0
- data/lib/lib/coopy/table_view.rb +148 -0
- data/lib/lib/coopy/tables.rb +52 -0
- data/lib/lib/coopy/terminal_diff_render.rb +213 -0
- data/lib/lib/coopy/unit.rb +93 -0
- data/lib/lib/coopy/view.rb +20 -0
- data/lib/lib/coopy/viterbi.rb +177 -0
- data/lib/lib/haxe/ds/int_map.rb +19 -0
- data/lib/lib/haxe/ds/string_map.rb +19 -0
- data/lib/lib/haxe/format/json_parser.rb +265 -0
- data/lib/lib/haxe/format/json_printer.rb +240 -0
- data/lib/lib/haxe/imap.rb +10 -0
- data/lib/lib/haxe/io/bytes.rb +34 -0
- data/lib/lib/haxe/io/eof.rb +18 -0
- data/lib/lib/haxe/io/error.rb +22 -0
- data/lib/lib/haxe/io/output.rb +41 -0
- data/lib/lib/hx_overrides.rb +19 -0
- data/lib/lib/hx_sys.rb +74 -0
- data/lib/lib/lambda.rb +37 -0
- data/lib/lib/list.rb +36 -0
- data/lib/lib/math.rb +5 -0
- data/lib/lib/rb/boot.rb +39 -0
- data/lib/lib/rb/ruby_iterator.rb +50 -0
- data/lib/lib/reflect.rb +41 -0
- data/lib/lib/std.rb +12 -0
- data/lib/lib/string_buf.rb +19 -0
- data/lib/lib/sys/io/file_handle.rb +18 -0
- data/lib/lib/sys/io/file_output.rb +36 -0
- data/lib/lib/sys/io/hx_file.rb +20 -0
- data/lib/lib/type.rb +37 -0
- data/lib/lib/value_type.rb +23 -0
- data/lib/lib/x_list/list_iterator.rb +32 -0
- metadata +235 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class DiffSummary
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_accessor :row_deletes
|
11
|
+
attr_accessor :row_inserts
|
12
|
+
attr_accessor :row_updates
|
13
|
+
attr_accessor :row_reorders
|
14
|
+
attr_accessor :col_deletes
|
15
|
+
attr_accessor :col_inserts
|
16
|
+
attr_accessor :col_updates
|
17
|
+
attr_accessor :col_renames
|
18
|
+
attr_accessor :col_reorders
|
19
|
+
attr_accessor :row_count_initial_with_header
|
20
|
+
attr_accessor :row_count_final_with_header
|
21
|
+
attr_accessor :row_count_initial
|
22
|
+
attr_accessor :row_count_final
|
23
|
+
attr_accessor :col_count_initial
|
24
|
+
attr_accessor :col_count_final
|
25
|
+
haxe_me ["coopy", "DiffSummary"]
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class FlatCellBuilder
|
6
|
+
|
7
|
+
def initialize(flags)
|
8
|
+
@flags = flags
|
9
|
+
end
|
10
|
+
|
11
|
+
# protected - in ruby this doesn't play well with static/inline methods
|
12
|
+
|
13
|
+
attr_accessor :view
|
14
|
+
attr_accessor :separator
|
15
|
+
attr_accessor :conflict_separator
|
16
|
+
attr_accessor :flags
|
17
|
+
|
18
|
+
public
|
19
|
+
|
20
|
+
def need_separator
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_separator(separator)
|
25
|
+
@separator = separator
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_conflict_separator(separator)
|
29
|
+
@conflict_separator = separator
|
30
|
+
end
|
31
|
+
|
32
|
+
def set_view(view)
|
33
|
+
@view = view
|
34
|
+
end
|
35
|
+
|
36
|
+
def update(local,remote)
|
37
|
+
@view.to_datum(_hx_str(::Coopy::FlatCellBuilder.quote_for_diff(@view,local)) + _hx_str(@separator) + _hx_str(::Coopy::FlatCellBuilder.quote_for_diff(@view,remote)))
|
38
|
+
end
|
39
|
+
|
40
|
+
def conflict(parent,local,remote)
|
41
|
+
_hx_str(@view.to_s(parent)) + _hx_str(@conflict_separator) + _hx_str(@view.to_s(local)) + _hx_str(@conflict_separator) + _hx_str(@view.to_s(remote))
|
42
|
+
end
|
43
|
+
|
44
|
+
def marker(label)
|
45
|
+
@view.to_datum(label)
|
46
|
+
end
|
47
|
+
|
48
|
+
def links(unit,row_like)
|
49
|
+
return @view.to_datum(unit.to_base26string) if @flags.count_like_a_spreadsheet && !row_like
|
50
|
+
@view.to_datum(unit.to_s)
|
51
|
+
end
|
52
|
+
|
53
|
+
def FlatCellBuilder.quote_for_diff(v,d)
|
54
|
+
_nil = "NULL"
|
55
|
+
return _nil if v.equals(d,nil)
|
56
|
+
str = v.to_s(d)
|
57
|
+
score = 0
|
58
|
+
begin
|
59
|
+
_g1 = 0
|
60
|
+
_g = str.length
|
61
|
+
while(_g1 < _g)
|
62
|
+
i = _g1
|
63
|
+
_g1+=1
|
64
|
+
break if (str[score].ord rescue nil) != 95
|
65
|
+
score+=1
|
66
|
+
end
|
67
|
+
end
|
68
|
+
str = "_" + _hx_str(str) if str[score..-1] == _nil
|
69
|
+
str
|
70
|
+
end
|
71
|
+
|
72
|
+
haxe_me ["coopy", "FlatCellBuilder"]
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
@@ -0,0 +1,977 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class HighlightPatch
|
6
|
+
|
7
|
+
def initialize(source,patch,flags = nil)
|
8
|
+
@source = source
|
9
|
+
@patch = patch
|
10
|
+
@flags = flags
|
11
|
+
@flags = ::Coopy::CompareFlags.new if flags == nil
|
12
|
+
@view = patch.get_cell_view
|
13
|
+
@source_view = source.get_cell_view
|
14
|
+
@meta = source.get_meta
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
attr_accessor :source
|
20
|
+
attr_accessor :patch
|
21
|
+
attr_accessor :view
|
22
|
+
attr_accessor :source_view
|
23
|
+
attr_accessor :csv
|
24
|
+
attr_accessor :header
|
25
|
+
attr_accessor :header_pre
|
26
|
+
attr_accessor :header_post
|
27
|
+
attr_accessor :header_rename
|
28
|
+
attr_accessor :header_move
|
29
|
+
attr_accessor :modifier
|
30
|
+
attr_accessor :current_row
|
31
|
+
attr_accessor :payload_col
|
32
|
+
attr_accessor :payload_top
|
33
|
+
attr_accessor :mods
|
34
|
+
attr_accessor :cmods
|
35
|
+
attr_accessor :row_info
|
36
|
+
attr_accessor :cell_info
|
37
|
+
attr_accessor :rc_offset
|
38
|
+
attr_accessor :indexes
|
39
|
+
attr_accessor :source_in_patch_col
|
40
|
+
attr_accessor :patch_in_source_col
|
41
|
+
attr_accessor :dest_in_patch_col
|
42
|
+
attr_accessor :patch_in_dest_col
|
43
|
+
attr_accessor :patch_in_source_row
|
44
|
+
attr_accessor :last_source_row
|
45
|
+
attr_accessor :actions
|
46
|
+
attr_accessor :row_permutation
|
47
|
+
attr_accessor :row_permutation_rev
|
48
|
+
attr_accessor :col_permutation
|
49
|
+
attr_accessor :col_permutation_rev
|
50
|
+
attr_accessor :have_dropped_columns
|
51
|
+
attr_accessor :header_row
|
52
|
+
attr_accessor :preamble_row
|
53
|
+
attr_accessor :flags
|
54
|
+
attr_accessor :meta_change
|
55
|
+
attr_accessor :process_meta
|
56
|
+
attr_accessor :prev_meta
|
57
|
+
attr_accessor :next_meta
|
58
|
+
attr_accessor :finished_columns
|
59
|
+
attr_accessor :meta
|
60
|
+
|
61
|
+
def reset
|
62
|
+
@header = {}
|
63
|
+
@header_pre = {}
|
64
|
+
@header_post = {}
|
65
|
+
@header_rename = {}
|
66
|
+
@header_move = nil
|
67
|
+
@modifier = {}
|
68
|
+
@mods = Array.new
|
69
|
+
@cmods = Array.new
|
70
|
+
@csv = ::Coopy::Csv.new
|
71
|
+
@rc_offset = 0
|
72
|
+
@current_row = -1
|
73
|
+
@row_info = ::Coopy::CellInfo.new
|
74
|
+
@cell_info = ::Coopy::CellInfo.new
|
75
|
+
@source_in_patch_col = @patch_in_source_col = @patch_in_dest_col = nil
|
76
|
+
@patch_in_source_row = {}
|
77
|
+
@indexes = nil
|
78
|
+
@last_source_row = -1
|
79
|
+
@actions = Array.new
|
80
|
+
@row_permutation = nil
|
81
|
+
@row_permutation_rev = nil
|
82
|
+
@col_permutation = nil
|
83
|
+
@col_permutation_rev = nil
|
84
|
+
@have_dropped_columns = false
|
85
|
+
@header_row = 0
|
86
|
+
@preamble_row = 0
|
87
|
+
@meta_change = false
|
88
|
+
@process_meta = false
|
89
|
+
@prev_meta = nil
|
90
|
+
@next_meta = nil
|
91
|
+
@finished_columns = false
|
92
|
+
end
|
93
|
+
|
94
|
+
def process_meta
|
95
|
+
@process_meta = true
|
96
|
+
end
|
97
|
+
|
98
|
+
public
|
99
|
+
|
100
|
+
def apply
|
101
|
+
self.reset
|
102
|
+
return true if @patch.get_width < 2
|
103
|
+
return true if @patch.get_height < 1
|
104
|
+
@payload_col = 1 + @rc_offset
|
105
|
+
@payload_top = @patch.get_width
|
106
|
+
corner = @patch.get_cell_view.to_s(@patch.get_cell(0,0))
|
107
|
+
if corner == "@:@"
|
108
|
+
@rc_offset = 1
|
109
|
+
else
|
110
|
+
@rc_offset = 0
|
111
|
+
end
|
112
|
+
begin
|
113
|
+
_g1 = 0
|
114
|
+
_g = @patch.get_height
|
115
|
+
while(_g1 < _g)
|
116
|
+
r = _g1
|
117
|
+
_g1+=1
|
118
|
+
str = @view.to_s(@patch.get_cell(@rc_offset,r))
|
119
|
+
@actions.push(((str != nil) ? str : ""))
|
120
|
+
end
|
121
|
+
end
|
122
|
+
@preamble_row = @header_row = @rc_offset
|
123
|
+
begin
|
124
|
+
_g11 = 0
|
125
|
+
_g2 = @patch.get_height
|
126
|
+
while(_g11 < _g2)
|
127
|
+
r1 = _g11
|
128
|
+
_g11+=1
|
129
|
+
self.apply_row(r1)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
self.finish_columns
|
133
|
+
self.finish_rows
|
134
|
+
true
|
135
|
+
end
|
136
|
+
|
137
|
+
protected
|
138
|
+
|
139
|
+
def need_source_columns
|
140
|
+
return if @source_in_patch_col != nil
|
141
|
+
@source_in_patch_col = {}
|
142
|
+
@patch_in_source_col = {}
|
143
|
+
av = @source.get_cell_view
|
144
|
+
begin
|
145
|
+
_g1 = 0
|
146
|
+
_g = @source.get_width
|
147
|
+
while(_g1 < _g)
|
148
|
+
i = _g1
|
149
|
+
_g1+=1
|
150
|
+
name = av.to_s(@source.get_cell(i,0))
|
151
|
+
at = @header_pre[name]
|
152
|
+
next if at == nil
|
153
|
+
@source_in_patch_col[i] = at
|
154
|
+
@patch_in_source_col[at] = i
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def need_dest_columns
|
160
|
+
return if @patch_in_dest_col != nil
|
161
|
+
@patch_in_dest_col = {}
|
162
|
+
@dest_in_patch_col = {}
|
163
|
+
begin
|
164
|
+
_g = 0
|
165
|
+
_g1 = @cmods
|
166
|
+
while(_g < _g1.length)
|
167
|
+
cmod = _g1[_g]
|
168
|
+
_g+=1
|
169
|
+
if cmod.patch_row != -1
|
170
|
+
@patch_in_dest_col[cmod.patch_row] = cmod.dest_row
|
171
|
+
@dest_in_patch_col[cmod.dest_row] = cmod.patch_row
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def need_source_index
|
178
|
+
return if @indexes != nil
|
179
|
+
state = ::Coopy::TableComparisonState.new
|
180
|
+
state.a = @source
|
181
|
+
state.b = @source
|
182
|
+
comp = ::Coopy::CompareTable.new(state)
|
183
|
+
comp.store_indexes
|
184
|
+
comp.run
|
185
|
+
comp.align
|
186
|
+
@indexes = comp.get_indexes
|
187
|
+
self.need_source_columns
|
188
|
+
end
|
189
|
+
|
190
|
+
def set_meta_prop(target,column_name,prop_name,value)
|
191
|
+
return if column_name == nil
|
192
|
+
return if prop_name == nil
|
193
|
+
if !target.include?(column_name)
|
194
|
+
value1 = Array.new
|
195
|
+
target[column_name] = value1
|
196
|
+
end
|
197
|
+
change = ::Coopy::PropertyChange.new
|
198
|
+
change.prev_name = prop_name
|
199
|
+
change.name = prop_name
|
200
|
+
value = nil if value == ""
|
201
|
+
change.val = value
|
202
|
+
target[column_name].push(change)
|
203
|
+
end
|
204
|
+
|
205
|
+
def apply_meta_row(code)
|
206
|
+
self.need_source_columns
|
207
|
+
codes = code.split("@")
|
208
|
+
prop_name = ""
|
209
|
+
prop_name = codes[codes.length - 2] if codes.length > 1
|
210
|
+
code = codes[codes.length - 1] if codes.length > 0
|
211
|
+
@prev_meta = {} if @prev_meta == nil
|
212
|
+
@next_meta = {} if @next_meta == nil
|
213
|
+
begin
|
214
|
+
_g1 = @payload_col
|
215
|
+
_g = @payload_top
|
216
|
+
while(_g1 < _g)
|
217
|
+
i = _g1
|
218
|
+
_g1+=1
|
219
|
+
txt = self.get_datum(i)
|
220
|
+
idx_patch = i
|
221
|
+
idx_src = nil
|
222
|
+
if @patch_in_source_col.include?(idx_patch)
|
223
|
+
idx_src = @patch_in_source_col[idx_patch]
|
224
|
+
else
|
225
|
+
idx_src = -1
|
226
|
+
end
|
227
|
+
prev_name = nil
|
228
|
+
name = nil
|
229
|
+
prev_name = @source.get_cell(idx_src,0) if idx_src != -1
|
230
|
+
name = @header[idx_patch] if @header.include?(idx_patch)
|
231
|
+
::Coopy::DiffRender.examine_cell(0,0,@view,txt,"",code,"",@cell_info)
|
232
|
+
if @cell_info.updated
|
233
|
+
self.set_meta_prop(@prev_meta,prev_name,prop_name,@cell_info.lvalue)
|
234
|
+
self.set_meta_prop(@next_meta,name,prop_name,@cell_info.rvalue)
|
235
|
+
else
|
236
|
+
self.set_meta_prop(@prev_meta,prev_name,prop_name,@cell_info.value)
|
237
|
+
self.set_meta_prop(@next_meta,name,prop_name,@cell_info.value)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
def apply_row(r)
|
244
|
+
@current_row = r
|
245
|
+
code = @actions[r]
|
246
|
+
done = false
|
247
|
+
if r == 0 && @rc_offset > 0
|
248
|
+
done = true
|
249
|
+
elsif code == "@@"
|
250
|
+
@preamble_row = @header_row = r
|
251
|
+
self.apply_header
|
252
|
+
self.apply_action("@@")
|
253
|
+
done = true
|
254
|
+
elsif code == "!"
|
255
|
+
@preamble_row = @header_row = r
|
256
|
+
self.apply_meta
|
257
|
+
done = true
|
258
|
+
elsif (code.index("@",nil || 0) || -1) == 0
|
259
|
+
@flags.add_warning("cannot usefully apply diffs with metadata yet: '" + _hx_str(code) + "'")
|
260
|
+
@preamble_row = r
|
261
|
+
self.apply_meta_row(code)
|
262
|
+
if @process_meta
|
263
|
+
codes = code.split("@")
|
264
|
+
code = codes[codes.length - 1] if codes.length > 0
|
265
|
+
else
|
266
|
+
@meta_change = true
|
267
|
+
done = true
|
268
|
+
end
|
269
|
+
@meta_change = true
|
270
|
+
done = true
|
271
|
+
end
|
272
|
+
return if @process_meta
|
273
|
+
if !done
|
274
|
+
self.finish_columns
|
275
|
+
if code == "+++"
|
276
|
+
self.apply_action(code)
|
277
|
+
elsif code == "---"
|
278
|
+
self.apply_action(code)
|
279
|
+
elsif code == "+" || code == ":"
|
280
|
+
self.apply_action(code)
|
281
|
+
elsif (code.index("->",nil || 0) || -1) >= 0
|
282
|
+
self.apply_action("->")
|
283
|
+
else
|
284
|
+
@last_source_row = -1
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
def get_datum(c)
|
290
|
+
@patch.get_cell(c,@current_row)
|
291
|
+
end
|
292
|
+
|
293
|
+
def get_string(c)
|
294
|
+
@view.to_s(self.get_datum(c))
|
295
|
+
end
|
296
|
+
|
297
|
+
def get_string_null(c)
|
298
|
+
d = self.get_datum(c)
|
299
|
+
return nil if d == nil
|
300
|
+
@view.to_s(d)
|
301
|
+
end
|
302
|
+
|
303
|
+
def apply_meta
|
304
|
+
_g1 = @payload_col
|
305
|
+
_g = @payload_top
|
306
|
+
while(_g1 < _g)
|
307
|
+
i = _g1
|
308
|
+
_g1+=1
|
309
|
+
name = self.get_string(i)
|
310
|
+
next if name == ""
|
311
|
+
@modifier[i] = name
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
def apply_header
|
316
|
+
begin
|
317
|
+
_g1 = @payload_col
|
318
|
+
_g = @payload_top
|
319
|
+
while(_g1 < _g)
|
320
|
+
i = _g1
|
321
|
+
_g1+=1
|
322
|
+
name = self.get_string(i)
|
323
|
+
if name == "..."
|
324
|
+
@modifier[i] = "..."
|
325
|
+
@have_dropped_columns = true
|
326
|
+
next
|
327
|
+
end
|
328
|
+
mod = @modifier[i]
|
329
|
+
move = false
|
330
|
+
if mod != nil
|
331
|
+
if (mod[0].ord rescue nil) == 58
|
332
|
+
move = true
|
333
|
+
mod = mod[1,mod.length]
|
334
|
+
end
|
335
|
+
end
|
336
|
+
@header[i] = name
|
337
|
+
if mod != nil
|
338
|
+
if (mod[0].ord rescue nil) == 40
|
339
|
+
prev_name = mod[1,mod.length - 2]
|
340
|
+
@header_pre[prev_name] = i
|
341
|
+
@header_post[name] = i
|
342
|
+
@header_rename[prev_name] = name
|
343
|
+
next
|
344
|
+
end
|
345
|
+
end
|
346
|
+
@header_pre[name] = i if mod != "+++"
|
347
|
+
@header_post[name] = i if mod != "---"
|
348
|
+
if move
|
349
|
+
@header_move = {} if @header_move == nil
|
350
|
+
@header_move[name] = 1
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
354
|
+
if !self.use_meta_for_row_changes
|
355
|
+
self.apply_action("+++") if @source.get_height == 0
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
def look_up(del = 0)
|
360
|
+
return @patch_in_source_row[@current_row + del] if @patch_in_source_row.include?(@current_row + del)
|
361
|
+
result = -1
|
362
|
+
@current_row += del
|
363
|
+
if @current_row >= 0 && @current_row < @patch.get_height
|
364
|
+
_g = 0
|
365
|
+
_g1 = @indexes
|
366
|
+
while(_g < _g1.length)
|
367
|
+
idx = _g1[_g]
|
368
|
+
_g+=1
|
369
|
+
match = idx.query_by_content(self)
|
370
|
+
next if match.spot_a == 0
|
371
|
+
if match.spot_a == 1
|
372
|
+
result = match.item_a.lst[0]
|
373
|
+
break
|
374
|
+
end
|
375
|
+
if @current_row > 0
|
376
|
+
prev = @patch_in_source_row[@current_row - 1]
|
377
|
+
if prev != nil
|
378
|
+
lst = match.item_a.lst
|
379
|
+
begin
|
380
|
+
_g2 = 0
|
381
|
+
while(_g2 < lst.length)
|
382
|
+
row = lst[_g2]
|
383
|
+
_g2+=1
|
384
|
+
if row == prev + 1
|
385
|
+
result = row
|
386
|
+
break
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
begin
|
395
|
+
@patch_in_source_row[@current_row] = result
|
396
|
+
result
|
397
|
+
end
|
398
|
+
@current_row -= del
|
399
|
+
result
|
400
|
+
end
|
401
|
+
|
402
|
+
def apply_action_external(code)
|
403
|
+
return if code == "@@"
|
404
|
+
rc = ::Coopy::RowChange.new
|
405
|
+
rc.action = code
|
406
|
+
self.check_act
|
407
|
+
rc.cond = {} if code != "+++"
|
408
|
+
rc.val = {} if code != "---"
|
409
|
+
have_column = false
|
410
|
+
begin
|
411
|
+
_g1 = @payload_col
|
412
|
+
_g = @payload_top
|
413
|
+
while(_g1 < _g)
|
414
|
+
i = _g1
|
415
|
+
_g1+=1
|
416
|
+
prev_name = @header[i]
|
417
|
+
name = prev_name
|
418
|
+
name = @header_rename[prev_name] if @header_rename.include?(prev_name)
|
419
|
+
cact = @modifier[i]
|
420
|
+
next if cact == "..."
|
421
|
+
next if name == nil || name == ""
|
422
|
+
txt = @csv.parse_cell(self.get_string_null(i))
|
423
|
+
updated = false
|
424
|
+
if @row_info.updated
|
425
|
+
self.get_pre_string(txt)
|
426
|
+
updated = @cell_info.updated
|
427
|
+
end
|
428
|
+
if cact == "+++" && code != "---"
|
429
|
+
if txt != nil && txt != ""
|
430
|
+
rc.val = {} if rc.val == nil
|
431
|
+
rc.val[name] = txt
|
432
|
+
have_column = true
|
433
|
+
end
|
434
|
+
end
|
435
|
+
if updated
|
436
|
+
begin
|
437
|
+
value = @csv.parse_cell(@cell_info.lvalue)
|
438
|
+
begin
|
439
|
+
value1 = value
|
440
|
+
rc.cond[name] = value1
|
441
|
+
end
|
442
|
+
end
|
443
|
+
begin
|
444
|
+
value2 = @csv.parse_cell(@cell_info.rvalue)
|
445
|
+
begin
|
446
|
+
value3 = value2
|
447
|
+
rc.val[name] = value3
|
448
|
+
end
|
449
|
+
end
|
450
|
+
elsif code == "+++"
|
451
|
+
rc.val[name] = txt if cact != "---"
|
452
|
+
elsif cact != "+++" && cact != "---"
|
453
|
+
rc.cond[name] = txt
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
if rc.action == "+"
|
458
|
+
return if !have_column
|
459
|
+
rc.action = "->"
|
460
|
+
end
|
461
|
+
@meta.change_row(rc)
|
462
|
+
end
|
463
|
+
|
464
|
+
def apply_action(code)
|
465
|
+
if self.use_meta_for_row_changes
|
466
|
+
self.apply_action_external(code)
|
467
|
+
return
|
468
|
+
end
|
469
|
+
mod = ::Coopy::HighlightPatchUnit.new
|
470
|
+
mod.code = code
|
471
|
+
mod.add = code == "+++"
|
472
|
+
mod.rem = code == "---"
|
473
|
+
mod.update = code == "->"
|
474
|
+
self.need_source_index
|
475
|
+
@last_source_row = self.look_up(-1) if @last_source_row == -1
|
476
|
+
mod.source_prev_row = @last_source_row
|
477
|
+
next_act = @actions[@current_row + 1]
|
478
|
+
mod.source_next_row = self.look_up(1) if next_act != "+++" && next_act != "..."
|
479
|
+
if mod.add
|
480
|
+
if @actions[@current_row - 1] != "+++"
|
481
|
+
if @actions[@current_row - 1] == "@@"
|
482
|
+
mod.source_prev_row = 0
|
483
|
+
@last_source_row = 0
|
484
|
+
else
|
485
|
+
mod.source_prev_row = self.look_up(-1)
|
486
|
+
end
|
487
|
+
end
|
488
|
+
mod.source_row = mod.source_prev_row
|
489
|
+
mod.source_row_offset = 1 if mod.source_row != -1
|
490
|
+
else
|
491
|
+
mod.source_row = @last_source_row = self.look_up
|
492
|
+
end
|
493
|
+
@last_source_row = mod.source_next_row if @actions[@current_row + 1] == ""
|
494
|
+
mod.patch_row = @current_row
|
495
|
+
mod.source_row = 0 if code == "@@"
|
496
|
+
@mods.push(mod)
|
497
|
+
end
|
498
|
+
|
499
|
+
def check_act
|
500
|
+
act = self.get_string(@rc_offset)
|
501
|
+
::Coopy::DiffRender.examine_cell(0,0,@view,act,"",act,"",@row_info) if @row_info.value != act
|
502
|
+
end
|
503
|
+
|
504
|
+
def get_pre_string(txt)
|
505
|
+
self.check_act
|
506
|
+
return txt if !@row_info.updated
|
507
|
+
::Coopy::DiffRender.examine_cell(0,0,@view,txt,"",@row_info.value,"",@cell_info)
|
508
|
+
return txt if !@cell_info.updated
|
509
|
+
@cell_info.lvalue
|
510
|
+
end
|
511
|
+
|
512
|
+
public
|
513
|
+
|
514
|
+
def get_row_string(c)
|
515
|
+
at = @source_in_patch_col[c]
|
516
|
+
return "NOT_FOUND" if at == nil
|
517
|
+
self.get_pre_string(self.get_string(at))
|
518
|
+
end
|
519
|
+
|
520
|
+
def is_preamble
|
521
|
+
@current_row <= @preamble_row
|
522
|
+
end
|
523
|
+
|
524
|
+
protected
|
525
|
+
|
526
|
+
def sort_mods(a,b)
|
527
|
+
return 1 if b.code == "@@" && a.code != "@@"
|
528
|
+
return -1 if a.code == "@@" && b.code != "@@"
|
529
|
+
return 1 if a.source_row == -1 && !a.add && b.source_row != -1
|
530
|
+
return -1 if a.source_row != -1 && !b.add && b.source_row == -1
|
531
|
+
return 1 if a.source_row + a.source_row_offset > b.source_row + b.source_row_offset
|
532
|
+
return -1 if a.source_row + a.source_row_offset < b.source_row + b.source_row_offset
|
533
|
+
return 1 if a.patch_row > b.patch_row
|
534
|
+
return -1 if a.patch_row < b.patch_row
|
535
|
+
0
|
536
|
+
end
|
537
|
+
|
538
|
+
def process_mods(rmods,fate,len)
|
539
|
+
rmods.sort!{|a,b| self.sort_mods(a,b)}
|
540
|
+
offset = 0
|
541
|
+
last = -1
|
542
|
+
target = 0
|
543
|
+
if rmods.length > 0
|
544
|
+
last = 0 if rmods[0].source_prev_row == -1
|
545
|
+
end
|
546
|
+
begin
|
547
|
+
_g = 0
|
548
|
+
while(_g < rmods.length)
|
549
|
+
mod = rmods[_g]
|
550
|
+
_g+=1
|
551
|
+
if last != -1
|
552
|
+
_g2 = last
|
553
|
+
_g1 = mod.source_row + mod.source_row_offset
|
554
|
+
while(_g2 < _g1)
|
555
|
+
i = _g2
|
556
|
+
_g2+=1
|
557
|
+
fate.push(i + offset)
|
558
|
+
target+=1
|
559
|
+
last+=1
|
560
|
+
end
|
561
|
+
end
|
562
|
+
if mod.rem
|
563
|
+
fate.push(-1)
|
564
|
+
offset-=1
|
565
|
+
elsif mod.add
|
566
|
+
mod.dest_row = target
|
567
|
+
target+=1
|
568
|
+
offset+=1
|
569
|
+
else
|
570
|
+
mod.dest_row = target
|
571
|
+
end
|
572
|
+
if mod.source_row >= 0
|
573
|
+
last = mod.source_row + mod.source_row_offset
|
574
|
+
last+=1 if mod.rem
|
575
|
+
elsif mod.add && mod.source_next_row != -1
|
576
|
+
last = mod.source_next_row + mod.source_row_offset
|
577
|
+
elsif mod.rem || mod.add
|
578
|
+
last = -1
|
579
|
+
end
|
580
|
+
end
|
581
|
+
end
|
582
|
+
if last != -1
|
583
|
+
_g3 = last
|
584
|
+
while(_g3 < len)
|
585
|
+
i1 = _g3
|
586
|
+
_g3+=1
|
587
|
+
fate.push(i1 + offset)
|
588
|
+
target+=1
|
589
|
+
last+=1
|
590
|
+
end
|
591
|
+
end
|
592
|
+
len + offset
|
593
|
+
end
|
594
|
+
|
595
|
+
def use_meta_for_column_changes
|
596
|
+
return false if @meta == nil
|
597
|
+
@meta.use_for_column_changes
|
598
|
+
end
|
599
|
+
|
600
|
+
def use_meta_for_row_changes
|
601
|
+
return false if @meta == nil
|
602
|
+
@meta.use_for_row_changes
|
603
|
+
end
|
604
|
+
|
605
|
+
def compute_ordering(mods,permutation,permutation_rev,dim)
|
606
|
+
to_unit = {}
|
607
|
+
from_unit = {}
|
608
|
+
meta_from_unit = {}
|
609
|
+
ct = 0
|
610
|
+
begin
|
611
|
+
_g = 0
|
612
|
+
while(_g < mods.length)
|
613
|
+
mod = mods[_g]
|
614
|
+
_g+=1
|
615
|
+
next if mod.add || mod.rem
|
616
|
+
next if mod.source_row < 0
|
617
|
+
if mod.source_prev_row >= 0
|
618
|
+
begin
|
619
|
+
v = mod.source_row
|
620
|
+
to_unit[mod.source_prev_row] = v
|
621
|
+
v
|
622
|
+
end
|
623
|
+
begin
|
624
|
+
v1 = mod.source_prev_row
|
625
|
+
from_unit[mod.source_row] = v1
|
626
|
+
v1
|
627
|
+
end
|
628
|
+
ct+=1 if mod.source_prev_row + 1 != mod.source_row
|
629
|
+
end
|
630
|
+
if mod.source_next_row >= 0
|
631
|
+
begin
|
632
|
+
v2 = mod.source_next_row
|
633
|
+
to_unit[mod.source_row] = v2
|
634
|
+
v2
|
635
|
+
end
|
636
|
+
begin
|
637
|
+
v3 = mod.source_row
|
638
|
+
from_unit[mod.source_next_row] = v3
|
639
|
+
v3
|
640
|
+
end
|
641
|
+
ct+=1 if mod.source_row + 1 != mod.source_next_row
|
642
|
+
end
|
643
|
+
end
|
644
|
+
end
|
645
|
+
if ct > 0
|
646
|
+
cursor = nil
|
647
|
+
logical = nil
|
648
|
+
starts = []
|
649
|
+
begin
|
650
|
+
_g1 = 0
|
651
|
+
while(_g1 < dim)
|
652
|
+
i = _g1
|
653
|
+
_g1+=1
|
654
|
+
u = from_unit[i]
|
655
|
+
if u != nil
|
656
|
+
begin
|
657
|
+
meta_from_unit[u] = i
|
658
|
+
i
|
659
|
+
end
|
660
|
+
else
|
661
|
+
starts.push(i)
|
662
|
+
end
|
663
|
+
end
|
664
|
+
end
|
665
|
+
used = {}
|
666
|
+
len = 0
|
667
|
+
begin
|
668
|
+
_g2 = 0
|
669
|
+
while(_g2 < dim)
|
670
|
+
i1 = _g2
|
671
|
+
_g2+=1
|
672
|
+
if logical != nil && meta_from_unit.include?(logical)
|
673
|
+
cursor = meta_from_unit[logical]
|
674
|
+
else
|
675
|
+
cursor = nil
|
676
|
+
end
|
677
|
+
if cursor == nil
|
678
|
+
v4 = starts.shift
|
679
|
+
cursor = v4
|
680
|
+
logical = v4
|
681
|
+
end
|
682
|
+
cursor = 0 if cursor == nil
|
683
|
+
while(used.include?(cursor))
|
684
|
+
cursor = ((cursor + 1).remainder(dim) rescue Float::NAN)
|
685
|
+
end
|
686
|
+
logical = cursor
|
687
|
+
permutation_rev.push(cursor)
|
688
|
+
begin
|
689
|
+
used[cursor] = 1
|
690
|
+
1
|
691
|
+
end
|
692
|
+
end
|
693
|
+
end
|
694
|
+
begin
|
695
|
+
_g11 = 0
|
696
|
+
_g3 = permutation_rev.length
|
697
|
+
while(_g11 < _g3)
|
698
|
+
i2 = _g11
|
699
|
+
_g11+=1
|
700
|
+
permutation[i2] = -1
|
701
|
+
end
|
702
|
+
end
|
703
|
+
begin
|
704
|
+
_g12 = 0
|
705
|
+
_g4 = permutation.length
|
706
|
+
while(_g12 < _g4)
|
707
|
+
i3 = _g12
|
708
|
+
_g12+=1
|
709
|
+
permutation[permutation_rev[i3]] = i3
|
710
|
+
end
|
711
|
+
end
|
712
|
+
end
|
713
|
+
end
|
714
|
+
|
715
|
+
def permute_rows
|
716
|
+
@row_permutation = Array.new
|
717
|
+
@row_permutation_rev = Array.new
|
718
|
+
self.compute_ordering(@mods,@row_permutation,@row_permutation_rev,@source.get_height)
|
719
|
+
end
|
720
|
+
|
721
|
+
def fill_in_new_columns
|
722
|
+
_g = 0
|
723
|
+
_g1 = @cmods
|
724
|
+
while(_g < _g1.length)
|
725
|
+
cmod = _g1[_g]
|
726
|
+
_g+=1
|
727
|
+
if !cmod.rem
|
728
|
+
if cmod.add
|
729
|
+
begin
|
730
|
+
_g2 = 0
|
731
|
+
_g3 = @mods
|
732
|
+
while(_g2 < _g3.length)
|
733
|
+
mod = _g3[_g2]
|
734
|
+
_g2+=1
|
735
|
+
if mod.patch_row != -1 && mod.dest_row != -1
|
736
|
+
d = @patch.get_cell(cmod.patch_row,mod.patch_row)
|
737
|
+
@source.set_cell(cmod.dest_row,mod.dest_row,d)
|
738
|
+
end
|
739
|
+
end
|
740
|
+
end
|
741
|
+
hdr = @header[cmod.patch_row]
|
742
|
+
@source.set_cell(cmod.dest_row,0,@view.to_datum(hdr))
|
743
|
+
end
|
744
|
+
end
|
745
|
+
end
|
746
|
+
end
|
747
|
+
|
748
|
+
def finish_rows
|
749
|
+
return if self.use_meta_for_row_changes
|
750
|
+
if @source.get_width == 0
|
751
|
+
@source.resize(0,0) if @source.get_height != 0
|
752
|
+
return
|
753
|
+
end
|
754
|
+
fate = Array.new
|
755
|
+
self.permute_rows
|
756
|
+
if @row_permutation.length > 0
|
757
|
+
_g = 0
|
758
|
+
_g1 = @mods
|
759
|
+
while(_g < _g1.length)
|
760
|
+
mod = _g1[_g]
|
761
|
+
_g+=1
|
762
|
+
mod.source_row = @row_permutation[mod.source_row] if mod.source_row >= 0
|
763
|
+
end
|
764
|
+
end
|
765
|
+
@source.insert_or_delete_rows(@row_permutation,@row_permutation.length) if @row_permutation.length > 0
|
766
|
+
len = self.process_mods(@mods,fate,@source.get_height)
|
767
|
+
@source.insert_or_delete_rows(fate,len)
|
768
|
+
self.need_dest_columns
|
769
|
+
begin
|
770
|
+
_g2 = 0
|
771
|
+
_g11 = @mods
|
772
|
+
while(_g2 < _g11.length)
|
773
|
+
mod1 = _g11[_g2]
|
774
|
+
_g2+=1
|
775
|
+
if !mod1.rem
|
776
|
+
if mod1.add
|
777
|
+
_it = ::Rb::RubyIterator.new(@header_post.values)
|
778
|
+
while(_it.has_next) do
|
779
|
+
c = _it._next
|
780
|
+
offset = @patch_in_dest_col[c]
|
781
|
+
@source.set_cell(offset,mod1.dest_row,@patch.get_cell(c,mod1.patch_row)) if offset != nil && offset >= 0
|
782
|
+
end
|
783
|
+
elsif mod1.update
|
784
|
+
@current_row = mod1.patch_row
|
785
|
+
self.check_act
|
786
|
+
next if !@row_info.updated
|
787
|
+
_it2 = ::Rb::RubyIterator.new(@header_pre.values)
|
788
|
+
while(_it2.has_next) do
|
789
|
+
c1 = _it2._next
|
790
|
+
txt = @view.to_s(@patch.get_cell(c1,mod1.patch_row))
|
791
|
+
::Coopy::DiffRender.examine_cell(0,0,@view,txt,"",@row_info.value,"",@cell_info)
|
792
|
+
next if !@cell_info.updated
|
793
|
+
next if @cell_info.conflicted
|
794
|
+
d = @view.to_datum(@csv.parse_cell(@cell_info.rvalue))
|
795
|
+
offset1 = @patch_in_dest_col[c1]
|
796
|
+
@source.set_cell(@patch_in_dest_col[c1],mod1.dest_row,d) if offset1 != nil && offset1 >= 0
|
797
|
+
end
|
798
|
+
end
|
799
|
+
end
|
800
|
+
end
|
801
|
+
end
|
802
|
+
self.fill_in_new_columns
|
803
|
+
begin
|
804
|
+
_g12 = 0
|
805
|
+
_g3 = @source.get_width
|
806
|
+
while(_g12 < _g3)
|
807
|
+
i = _g12
|
808
|
+
_g12+=1
|
809
|
+
name = @view.to_s(@source.get_cell(i,0))
|
810
|
+
next_name = @header_rename[name]
|
811
|
+
next if next_name == nil
|
812
|
+
@source.set_cell(i,0,@view.to_datum(next_name))
|
813
|
+
end
|
814
|
+
end
|
815
|
+
end
|
816
|
+
|
817
|
+
def permute_columns
|
818
|
+
return if @header_move == nil
|
819
|
+
@col_permutation = Array.new
|
820
|
+
@col_permutation_rev = Array.new
|
821
|
+
self.compute_ordering(@cmods,@col_permutation,@col_permutation_rev,@source.get_width)
|
822
|
+
return if @col_permutation.length == 0
|
823
|
+
end
|
824
|
+
|
825
|
+
def finish_columns
|
826
|
+
return if @finished_columns
|
827
|
+
@finished_columns = true
|
828
|
+
self.need_source_columns
|
829
|
+
begin
|
830
|
+
_g1 = @payload_col
|
831
|
+
_g = @payload_top
|
832
|
+
while(_g1 < _g)
|
833
|
+
i = _g1
|
834
|
+
_g1+=1
|
835
|
+
act = @modifier[i]
|
836
|
+
hdr = @header[i]
|
837
|
+
act = "" if act == nil
|
838
|
+
if act == "---"
|
839
|
+
at = -1
|
840
|
+
at = @patch_in_source_col[i] if @patch_in_source_col.include?(i)
|
841
|
+
mod = ::Coopy::HighlightPatchUnit.new
|
842
|
+
mod.code = act
|
843
|
+
mod.rem = true
|
844
|
+
mod.source_row = at
|
845
|
+
mod.patch_row = i
|
846
|
+
@cmods.push(mod)
|
847
|
+
elsif act == "+++"
|
848
|
+
mod1 = ::Coopy::HighlightPatchUnit.new
|
849
|
+
mod1.code = act
|
850
|
+
mod1.add = true
|
851
|
+
prev = -1
|
852
|
+
cont = false
|
853
|
+
mod1.source_row = -1
|
854
|
+
mod1.source_row = @cmods[@cmods.length - 1].source_row if @cmods.length > 0
|
855
|
+
mod1.source_row_offset = 1 if mod1.source_row != -1
|
856
|
+
mod1.patch_row = i
|
857
|
+
@cmods.push(mod1)
|
858
|
+
elsif act != "..."
|
859
|
+
at1 = -1
|
860
|
+
at1 = @patch_in_source_col[i] if @patch_in_source_col.include?(i)
|
861
|
+
mod2 = ::Coopy::HighlightPatchUnit.new
|
862
|
+
mod2.code = act
|
863
|
+
mod2.patch_row = i
|
864
|
+
mod2.source_row = at1
|
865
|
+
@cmods.push(mod2)
|
866
|
+
end
|
867
|
+
end
|
868
|
+
end
|
869
|
+
at2 = -1
|
870
|
+
rat = -1
|
871
|
+
begin
|
872
|
+
_g11 = 0
|
873
|
+
_g2 = @cmods.length - 1
|
874
|
+
while(_g11 < _g2)
|
875
|
+
i1 = _g11
|
876
|
+
_g11+=1
|
877
|
+
icode = @cmods[i1].code
|
878
|
+
at2 = @cmods[i1].source_row if icode != "+++" && icode != "---"
|
879
|
+
@cmods[i1 + 1].source_prev_row = at2
|
880
|
+
j = @cmods.length - 1 - i1
|
881
|
+
jcode = @cmods[j].code
|
882
|
+
rat = @cmods[j].source_row if jcode != "+++" && jcode != "---"
|
883
|
+
@cmods[j - 1].source_next_row = rat
|
884
|
+
end
|
885
|
+
end
|
886
|
+
fate = Array.new
|
887
|
+
self.permute_columns
|
888
|
+
if @header_move != nil
|
889
|
+
if @col_permutation.length > 0
|
890
|
+
begin
|
891
|
+
_g3 = 0
|
892
|
+
_g12 = @cmods
|
893
|
+
while(_g3 < _g12.length)
|
894
|
+
mod3 = _g12[_g3]
|
895
|
+
_g3+=1
|
896
|
+
mod3.source_row = @col_permutation[mod3.source_row] if mod3.source_row >= 0
|
897
|
+
end
|
898
|
+
end
|
899
|
+
@source.insert_or_delete_columns(@col_permutation,@col_permutation.length) if !self.use_meta_for_column_changes
|
900
|
+
end
|
901
|
+
end
|
902
|
+
len = self.process_mods(@cmods,fate,@source.get_width)
|
903
|
+
if !self.use_meta_for_column_changes
|
904
|
+
@source.insert_or_delete_columns(fate,len)
|
905
|
+
return
|
906
|
+
end
|
907
|
+
changed = false
|
908
|
+
begin
|
909
|
+
_g4 = 0
|
910
|
+
_g13 = @cmods
|
911
|
+
while(_g4 < _g13.length)
|
912
|
+
mod4 = _g13[_g4]
|
913
|
+
_g4+=1
|
914
|
+
if mod4.code != ""
|
915
|
+
changed = true
|
916
|
+
break
|
917
|
+
end
|
918
|
+
end
|
919
|
+
end
|
920
|
+
return if !changed
|
921
|
+
columns = Array.new
|
922
|
+
target = {}
|
923
|
+
inc = lambda {|x|
|
924
|
+
if x < 0
|
925
|
+
return x
|
926
|
+
else
|
927
|
+
return x + 1
|
928
|
+
end
|
929
|
+
}
|
930
|
+
begin
|
931
|
+
_g14 = 0
|
932
|
+
_g5 = fate.length
|
933
|
+
while(_g14 < _g5)
|
934
|
+
i2 = _g14
|
935
|
+
_g14+=1
|
936
|
+
begin
|
937
|
+
value = (inc).call(fate[i2])
|
938
|
+
target[i2] = value
|
939
|
+
end
|
940
|
+
end
|
941
|
+
end
|
942
|
+
self.need_source_columns
|
943
|
+
self.need_dest_columns
|
944
|
+
begin
|
945
|
+
_g15 = 1
|
946
|
+
_g6 = @patch.get_width
|
947
|
+
while(_g15 < _g6)
|
948
|
+
idx_patch = _g15
|
949
|
+
_g15+=1
|
950
|
+
change = ::Coopy::ColumnChange.new
|
951
|
+
idx_src = nil
|
952
|
+
if @patch_in_source_col.include?(idx_patch)
|
953
|
+
idx_src = @patch_in_source_col[idx_patch]
|
954
|
+
else
|
955
|
+
idx_src = -1
|
956
|
+
end
|
957
|
+
prev_name = nil
|
958
|
+
name = nil
|
959
|
+
prev_name = @source.get_cell(idx_src,0) if idx_src != -1
|
960
|
+
if @modifier[idx_patch] != "---"
|
961
|
+
name = @header[idx_patch] if @header.include?(idx_patch)
|
962
|
+
end
|
963
|
+
change.prev_name = prev_name
|
964
|
+
change.name = name
|
965
|
+
if @next_meta != nil
|
966
|
+
change.props = @next_meta[name] if @next_meta.include?(name)
|
967
|
+
end
|
968
|
+
columns.push(change)
|
969
|
+
end
|
970
|
+
end
|
971
|
+
@meta.alter_columns(columns)
|
972
|
+
end
|
973
|
+
|
974
|
+
haxe_me ["coopy", "HighlightPatch"]
|
975
|
+
end
|
976
|
+
|
977
|
+
end
|