daff 1.2.6 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/bin/daff.rb +0 -0
- data/lib/daff.rb +6 -0
- data/lib/lib/coopy/alignment.rb +146 -169
- data/lib/lib/coopy/cell_builder.rb +1 -1
- data/lib/lib/coopy/cell_info.rb +2 -1
- data/lib/lib/coopy/column_change.rb +16 -0
- data/lib/lib/coopy/compare_flags.rb +33 -5
- data/lib/lib/coopy/compare_table.rb +219 -99
- data/lib/lib/coopy/coopy.rb +205 -99
- data/lib/lib/coopy/csv.rb +17 -22
- data/lib/lib/coopy/diff_render.rb +16 -8
- data/lib/lib/coopy/flat_cell_builder.rb +11 -8
- data/lib/lib/coopy/highlight_patch.rb +363 -63
- data/lib/lib/coopy/highlight_patch_unit.rb +1 -1
- data/lib/lib/coopy/index.rb +21 -8
- data/lib/lib/coopy/index_item.rb +7 -3
- data/lib/lib/coopy/index_pair.rb +13 -10
- data/lib/lib/coopy/merger.rb +3 -3
- data/lib/lib/coopy/meta.rb +17 -0
- data/lib/lib/coopy/mover.rb +7 -5
- data/lib/lib/coopy/ndjson.rb +2 -2
- data/lib/lib/coopy/nested_cell_builder.rb +7 -7
- data/lib/lib/coopy/ordering.rb +6 -2
- data/lib/lib/coopy/property_change.rb +16 -0
- data/lib/lib/coopy/row.rb +1 -0
- data/lib/lib/coopy/row_change.rb +42 -0
- data/lib/lib/coopy/row_stream.rb +11 -0
- data/lib/lib/coopy/simple_table.rb +84 -30
- data/lib/lib/coopy/simple_view.rb +8 -8
- data/lib/lib/coopy/sparse_sheet.rb +1 -1
- data/lib/lib/coopy/sql_column.rb +22 -10
- data/lib/lib/coopy/sql_compare.rb +397 -85
- data/lib/lib/coopy/sql_database.rb +2 -0
- data/lib/lib/coopy/sql_helper.rb +5 -0
- data/lib/lib/coopy/sql_table.rb +122 -19
- data/lib/lib/coopy/sql_table_name.rb +1 -1
- data/lib/lib/coopy/sqlite_helper.rb +250 -3
- data/lib/lib/coopy/table.rb +1 -0
- data/lib/lib/coopy/table_diff.rb +643 -464
- data/lib/lib/coopy/table_io.rb +19 -6
- data/lib/lib/coopy/table_modifier.rb +1 -1
- data/lib/lib/coopy/table_stream.rb +102 -0
- data/lib/lib/coopy/terminal_diff_render.rb +4 -3
- data/lib/lib/coopy/unit.rb +22 -2
- data/lib/lib/coopy/viterbi.rb +4 -4
- data/lib/lib/haxe/ds/int_map.rb +1 -1
- data/lib/lib/haxe/ds/string_map.rb +1 -1
- data/lib/lib/haxe/format/json_parser.rb +1 -1
- data/lib/lib/haxe/format/json_printer.rb +1 -1
- data/lib/lib/haxe/io/bytes.rb +2 -2
- data/lib/lib/haxe/io/eof.rb +1 -1
- data/lib/lib/haxe/io/output.rb +1 -1
- data/lib/lib/hx_overrides.rb +1 -1
- data/lib/lib/hx_sys.rb +9 -5
- data/lib/lib/lambda.rb +3 -3
- data/lib/lib/list.rb +1 -1
- data/lib/lib/rb/ruby_iterator.rb +2 -2
- data/lib/lib/reflect.rb +1 -1
- data/lib/lib/sys/io/file_output.rb +1 -1
- data/lib/lib/sys/io/hx_file.rb +1 -1
- data/lib/lib/x_list/list_iterator.rb +2 -2
- metadata +29 -25
- data/lib/lib/coopy/table_text.rb +0 -26
- data/lib/lib/haxe/io/bytes_buffer.rb +0 -19
- data/lib/lib/haxe/io/bytes_input.rb +0 -13
- data/lib/lib/haxe/io/bytes_output.rb +0 -33
- data/lib/lib/haxe/io/input.rb +0 -11
data/lib/lib/coopy/table.rb
CHANGED
@@ -16,6 +16,7 @@ module Coopy
|
|
16
16
|
def get_height() puts "Abstract Table.get_height called" end
|
17
17
|
def getData() puts "Abstract Table.getData called" end
|
18
18
|
def clone() puts "Abstract Table.clone called" end
|
19
|
+
def getMeta() puts "Abstract Table.getMeta called" end
|
19
20
|
haxe_me ["coopy", "Table"]
|
20
21
|
end
|
21
22
|
|
data/lib/lib/coopy/table_diff.rb
CHANGED
@@ -8,6 +8,7 @@ module Coopy
|
|
8
8
|
@align = align
|
9
9
|
@flags = flags
|
10
10
|
@builder = nil
|
11
|
+
@preserve_columns = false
|
11
12
|
end
|
12
13
|
|
13
14
|
protected
|
@@ -15,6 +16,41 @@ module Coopy
|
|
15
16
|
attr_accessor :align
|
16
17
|
attr_accessor :flags
|
17
18
|
attr_accessor :builder
|
19
|
+
attr_accessor :row_map
|
20
|
+
attr_accessor :col_map
|
21
|
+
attr_accessor :has_parent
|
22
|
+
attr_accessor :a
|
23
|
+
attr_accessor :b
|
24
|
+
attr_accessor :p
|
25
|
+
attr_accessor :rp_header
|
26
|
+
attr_accessor :ra_header
|
27
|
+
attr_accessor :rb_header
|
28
|
+
attr_accessor :is_index_p
|
29
|
+
attr_accessor :is_index_a
|
30
|
+
attr_accessor :is_index_b
|
31
|
+
attr_accessor :order
|
32
|
+
attr_accessor :row_units
|
33
|
+
attr_accessor :column_units
|
34
|
+
attr_accessor :show_rc_numbers
|
35
|
+
attr_accessor :row_moves
|
36
|
+
attr_accessor :col_moves
|
37
|
+
attr_accessor :active_row
|
38
|
+
attr_accessor :active_column
|
39
|
+
attr_accessor :allow_insert
|
40
|
+
attr_accessor :allow_delete
|
41
|
+
attr_accessor :allow_update
|
42
|
+
attr_accessor :v
|
43
|
+
attr_accessor :sep
|
44
|
+
attr_accessor :conflict_sep
|
45
|
+
attr_accessor :schema
|
46
|
+
attr_accessor :have_schema
|
47
|
+
attr_accessor :top_line_done
|
48
|
+
attr_accessor :have_addition
|
49
|
+
attr_accessor :act
|
50
|
+
attr_accessor :publish
|
51
|
+
attr_accessor :diff_found
|
52
|
+
attr_accessor :schema_diff_found
|
53
|
+
attr_accessor :preserve_columns
|
18
54
|
|
19
55
|
public
|
20
56
|
|
@@ -71,7 +107,7 @@ module Coopy
|
|
71
107
|
end
|
72
108
|
end
|
73
109
|
end
|
74
|
-
|
110
|
+
sep
|
75
111
|
end
|
76
112
|
|
77
113
|
def quote_for_diff(v,d)
|
@@ -90,7 +126,7 @@ module Coopy
|
|
90
126
|
end
|
91
127
|
end
|
92
128
|
str = "_" + _hx_str(str) if str[score..-1] == _nil
|
93
|
-
|
129
|
+
str
|
94
130
|
end
|
95
131
|
|
96
132
|
def is_reordered(m,ct)
|
@@ -120,7 +156,7 @@ module Coopy
|
|
120
156
|
end
|
121
157
|
end
|
122
158
|
end
|
123
|
-
|
159
|
+
reordered
|
124
160
|
end
|
125
161
|
|
126
162
|
def spread_context(units,del,active)
|
@@ -209,51 +245,47 @@ module Coopy
|
|
209
245
|
ct+=1
|
210
246
|
end
|
211
247
|
end
|
212
|
-
|
248
|
+
ct
|
213
249
|
end
|
214
250
|
|
215
|
-
|
251
|
+
def reset
|
252
|
+
@has_parent = false
|
253
|
+
@rp_header = @ra_header = @rb_header = 0
|
254
|
+
@is_index_p = {}
|
255
|
+
@is_index_a = {}
|
256
|
+
@is_index_b = {}
|
257
|
+
@row_map = {}
|
258
|
+
@col_map = {}
|
259
|
+
@show_rc_numbers = false
|
260
|
+
@row_moves = nil
|
261
|
+
@col_moves = nil
|
262
|
+
@allow_insert = @allow_delete = @allow_update = true
|
263
|
+
@sep = ""
|
264
|
+
@conflict_sep = ""
|
265
|
+
@top_line_done = false
|
266
|
+
@diff_found = false
|
267
|
+
@schema_diff_found = false
|
268
|
+
end
|
216
269
|
|
217
|
-
def
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
row_map = {}
|
229
|
-
col_map = {}
|
230
|
-
order = @align.to_order
|
231
|
-
units = order.get_list
|
232
|
-
has_parent = @align.reference != nil
|
233
|
-
a = nil
|
234
|
-
b = nil
|
235
|
-
p = nil
|
236
|
-
rp_header = 0
|
237
|
-
ra_header = 0
|
238
|
-
rb_header = 0
|
239
|
-
is_index_p = {}
|
240
|
-
is_index_a = {}
|
241
|
-
is_index_b = {}
|
242
|
-
if has_parent
|
243
|
-
p = @align.get_source
|
244
|
-
a = @align.reference.get_target
|
245
|
-
b = @align.get_target
|
246
|
-
rp_header = @align.reference.meta.get_source_header
|
247
|
-
ra_header = @align.reference.meta.get_target_header
|
248
|
-
rb_header = @align.meta.get_target_header
|
270
|
+
def setup_tables
|
271
|
+
@order = @align.to_order
|
272
|
+
@row_units = @order.get_list
|
273
|
+
@has_parent = @align.reference != nil
|
274
|
+
if @has_parent
|
275
|
+
@p = @align.get_source
|
276
|
+
@a = @align.reference.get_target
|
277
|
+
@b = @align.get_target
|
278
|
+
@rp_header = @align.reference.meta.get_source_header
|
279
|
+
@ra_header = @align.reference.meta.get_target_header
|
280
|
+
@rb_header = @align.meta.get_target_header
|
249
281
|
if @align.get_index_columns != nil
|
250
282
|
_g = 0
|
251
283
|
_g1 = @align.get_index_columns
|
252
284
|
while(_g < _g1.length)
|
253
285
|
p2b = _g1[_g]
|
254
286
|
_g+=1
|
255
|
-
is_index_p[p2b.l] = true if p2b.l >= 0
|
256
|
-
is_index_b[p2b.r] = true if p2b.r >= 0
|
287
|
+
@is_index_p[p2b.l] = true if p2b.l >= 0
|
288
|
+
@is_index_b[p2b.r] = true if p2b.r >= 0
|
257
289
|
end
|
258
290
|
end
|
259
291
|
if @align.reference.get_index_columns != nil
|
@@ -262,491 +294,259 @@ module Coopy
|
|
262
294
|
while(_g2 < _g11.length)
|
263
295
|
p2a = _g11[_g2]
|
264
296
|
_g2+=1
|
265
|
-
is_index_p[p2a.l] = true if p2a.l >= 0
|
266
|
-
is_index_a[p2a.r] = true if p2a.r >= 0
|
297
|
+
@is_index_p[p2a.l] = true if p2a.l >= 0
|
298
|
+
@is_index_a[p2a.r] = true if p2a.r >= 0
|
267
299
|
end
|
268
300
|
end
|
269
301
|
else
|
270
|
-
a = @align.get_source
|
271
|
-
b = @align.get_target
|
272
|
-
p = a
|
273
|
-
ra_header = @align.meta.get_source_header
|
274
|
-
rp_header = ra_header
|
275
|
-
rb_header = @align.meta.get_target_header
|
302
|
+
@a = @align.get_source
|
303
|
+
@b = @align.get_target
|
304
|
+
@p = @a
|
305
|
+
@ra_header = @align.meta.get_source_header
|
306
|
+
@rp_header = @ra_header
|
307
|
+
@rb_header = @align.meta.get_target_header
|
276
308
|
if @align.get_index_columns != nil
|
277
309
|
_g3 = 0
|
278
310
|
_g12 = @align.get_index_columns
|
279
311
|
while(_g3 < _g12.length)
|
280
312
|
a2b = _g12[_g3]
|
281
313
|
_g3+=1
|
282
|
-
is_index_a[a2b.l] = true if a2b.l >= 0
|
283
|
-
is_index_b[a2b.r] = true if a2b.r >= 0
|
314
|
+
@is_index_a[a2b.l] = true if a2b.l >= 0
|
315
|
+
@is_index_b[a2b.r] = true if a2b.r >= 0
|
284
316
|
end
|
285
317
|
end
|
286
318
|
end
|
319
|
+
@allow_insert = @flags.allow_insert
|
320
|
+
@allow_delete = @flags.allow_delete
|
321
|
+
@allow_update = @flags.allow_update
|
322
|
+
@v = @a.get_cell_view
|
323
|
+
@builder.set_view(@v)
|
324
|
+
end
|
325
|
+
|
326
|
+
def scan_activity
|
327
|
+
@active_row = Array.new
|
328
|
+
@active_column = nil
|
329
|
+
if !@flags.show_unchanged
|
330
|
+
_g1 = 0
|
331
|
+
_g = @row_units.length
|
332
|
+
while(_g1 < _g)
|
333
|
+
i = _g1
|
334
|
+
_g1+=1
|
335
|
+
@active_row[@row_units.length - 1 - i] = 0
|
336
|
+
end
|
337
|
+
end
|
338
|
+
if !@flags.show_unchanged_columns
|
339
|
+
@active_column = Array.new
|
340
|
+
begin
|
341
|
+
_g11 = 0
|
342
|
+
_g2 = @column_units.length
|
343
|
+
while(_g11 < _g2)
|
344
|
+
i1 = _g11
|
345
|
+
_g11+=1
|
346
|
+
v = 0
|
347
|
+
unit = @column_units[i1]
|
348
|
+
v = 1 if unit.l >= 0 && @is_index_a[unit.l]
|
349
|
+
v = 1 if unit.r >= 0 && @is_index_b[unit.r]
|
350
|
+
v = 1 if unit.p >= 0 && @is_index_p[unit.p]
|
351
|
+
@active_column[i1] = v
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
def setup_columns
|
287
358
|
column_order = @align.meta.to_order
|
288
|
-
column_units = column_order.get_list
|
289
|
-
p_ignore = {}
|
290
|
-
a_ignore = {}
|
291
|
-
b_ignore = {}
|
359
|
+
@column_units = column_order.get_list
|
292
360
|
ignore = @flags.get_ignored_columns
|
293
361
|
if ignore != nil
|
294
|
-
|
295
|
-
|
296
|
-
|
362
|
+
p_ignore = {}
|
363
|
+
a_ignore = {}
|
364
|
+
b_ignore = {}
|
365
|
+
self.set_ignore(ignore,p_ignore,@p,@rp_header)
|
366
|
+
self.set_ignore(ignore,a_ignore,@a,@ra_header)
|
367
|
+
self.set_ignore(ignore,b_ignore,@b,@rb_header)
|
297
368
|
ncolumn_units = Array.new
|
298
369
|
begin
|
299
|
-
|
300
|
-
|
301
|
-
while(
|
302
|
-
j =
|
303
|
-
|
304
|
-
cunit = column_units[j]
|
370
|
+
_g1 = 0
|
371
|
+
_g = @column_units.length
|
372
|
+
while(_g1 < _g)
|
373
|
+
j = _g1
|
374
|
+
_g1+=1
|
375
|
+
cunit = @column_units[j]
|
305
376
|
next if p_ignore.include?(cunit.p) || a_ignore.include?(cunit.l) || b_ignore.include?(cunit.r)
|
306
377
|
ncolumn_units.push(cunit)
|
307
378
|
end
|
308
379
|
end
|
309
|
-
column_units = ncolumn_units
|
380
|
+
@column_units = ncolumn_units
|
310
381
|
end
|
311
|
-
|
312
|
-
|
313
|
-
|
382
|
+
end
|
383
|
+
|
384
|
+
def setup_moves
|
314
385
|
if @flags.ordered
|
315
|
-
row_moves = {}
|
316
|
-
moves = ::Coopy::Mover.move_units(
|
386
|
+
@row_moves = {}
|
387
|
+
moves = ::Coopy::Mover.move_units(@row_units)
|
317
388
|
begin
|
318
|
-
|
319
|
-
|
320
|
-
while(
|
321
|
-
i =
|
322
|
-
|
389
|
+
_g1 = 0
|
390
|
+
_g = moves.length
|
391
|
+
while(_g1 < _g)
|
392
|
+
i = _g1
|
393
|
+
_g1+=1
|
323
394
|
begin
|
324
|
-
row_moves[moves[i]] = i
|
395
|
+
@row_moves[moves[i]] = i
|
325
396
|
i
|
326
397
|
end
|
327
398
|
end
|
328
399
|
end
|
329
|
-
col_moves = {}
|
330
|
-
moves = ::Coopy::Mover.move_units(column_units)
|
400
|
+
@col_moves = {}
|
401
|
+
moves = ::Coopy::Mover.move_units(@column_units)
|
331
402
|
begin
|
332
|
-
|
333
|
-
|
334
|
-
while(
|
335
|
-
i1 =
|
336
|
-
|
403
|
+
_g11 = 0
|
404
|
+
_g2 = moves.length
|
405
|
+
while(_g11 < _g2)
|
406
|
+
i1 = _g11
|
407
|
+
_g11+=1
|
337
408
|
begin
|
338
|
-
col_moves[moves[i1]] = i1
|
409
|
+
@col_moves[moves[i1]] = i1
|
339
410
|
i1
|
340
411
|
end
|
341
412
|
end
|
342
413
|
end
|
343
414
|
end
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
while(_g16 < _g7)
|
350
|
-
i2 = _g16
|
351
|
-
_g16+=1
|
352
|
-
active[units.length - 1 - i2] = 0
|
353
|
-
end
|
354
|
-
end
|
355
|
-
allow_insert = @flags.allow_insert
|
356
|
-
allow_delete = @flags.allow_delete
|
357
|
-
allow_update = @flags.allow_update
|
358
|
-
if !@flags.show_unchanged_columns
|
359
|
-
active_column = Array.new
|
360
|
-
begin
|
361
|
-
_g17 = 0
|
362
|
-
_g8 = column_units.length
|
363
|
-
while(_g17 < _g8)
|
364
|
-
i3 = _g17
|
365
|
-
_g17+=1
|
366
|
-
v = 0
|
367
|
-
unit = column_units[i3]
|
368
|
-
v = 1 if unit.l >= 0 && is_index_a[unit.l]
|
369
|
-
v = 1 if unit.r >= 0 && is_index_b[unit.r]
|
370
|
-
v = 1 if unit.p >= 0 && is_index_p[unit.p]
|
371
|
-
active_column[i3] = v
|
372
|
-
end
|
373
|
-
end
|
374
|
-
end
|
375
|
-
v1 = a.get_cell_view
|
376
|
-
@builder.set_view(v1)
|
377
|
-
outer_reps_needed = nil
|
378
|
-
if @flags.show_unchanged && @flags.show_unchanged_columns
|
379
|
-
outer_reps_needed = 1
|
380
|
-
else
|
381
|
-
outer_reps_needed = 2
|
382
|
-
end
|
383
|
-
sep = ""
|
384
|
-
conflict_sep = ""
|
385
|
-
schema = Array.new
|
386
|
-
have_schema = false
|
415
|
+
end
|
416
|
+
|
417
|
+
def scan_schema
|
418
|
+
@schema = Array.new
|
419
|
+
@have_schema = false
|
387
420
|
begin
|
388
|
-
|
389
|
-
|
390
|
-
while(
|
391
|
-
|
392
|
-
|
393
|
-
|
421
|
+
_g1 = 0
|
422
|
+
_g = @column_units.length
|
423
|
+
while(_g1 < _g)
|
424
|
+
j = _g1
|
425
|
+
_g1+=1
|
426
|
+
cunit = @column_units[j]
|
394
427
|
reordered = false
|
395
428
|
if @flags.ordered
|
396
|
-
reordered = true if col_moves.include?(
|
397
|
-
show_rc_numbers = true if reordered
|
429
|
+
reordered = true if @col_moves.include?(j)
|
430
|
+
@show_rc_numbers = true if reordered
|
398
431
|
end
|
399
432
|
act = ""
|
400
|
-
if
|
401
|
-
have_schema = true
|
433
|
+
if cunit.r >= 0 && cunit.lp == -1
|
434
|
+
@have_schema = true
|
402
435
|
act = "+++"
|
403
|
-
if active_column != nil
|
404
|
-
active_column[
|
436
|
+
if @active_column != nil
|
437
|
+
@active_column[j] = 1 if @allow_update
|
405
438
|
end
|
406
439
|
end
|
407
|
-
if
|
408
|
-
have_schema = true
|
440
|
+
if cunit.r < 0 && cunit.lp >= 0
|
441
|
+
@have_schema = true
|
409
442
|
act = "---"
|
410
|
-
if active_column != nil
|
411
|
-
active_column[
|
443
|
+
if @active_column != nil
|
444
|
+
@active_column[j] = 1 if @allow_update
|
412
445
|
end
|
413
446
|
end
|
414
|
-
if
|
415
|
-
if p.get_height >= rp_header && b.get_height >= rb_header
|
416
|
-
pp = p.get_cell(
|
417
|
-
bb = b.get_cell(
|
418
|
-
if
|
419
|
-
have_schema = true
|
447
|
+
if cunit.r >= 0 && cunit.lp >= 0
|
448
|
+
if @p.get_height >= @rp_header && @b.get_height >= @rb_header
|
449
|
+
pp = @p.get_cell(cunit.lp,@rp_header)
|
450
|
+
bb = @b.get_cell(cunit.r,@rb_header)
|
451
|
+
if !@v.equals(pp,bb)
|
452
|
+
@have_schema = true
|
420
453
|
act = "("
|
421
|
-
act +=
|
454
|
+
act += @v.to_s(pp)
|
422
455
|
act += ")"
|
423
|
-
active_column[
|
456
|
+
@active_column[j] = 1 if @active_column != nil
|
424
457
|
end
|
425
458
|
end
|
426
459
|
end
|
427
460
|
if reordered
|
428
461
|
act = ":" + _hx_str(act)
|
429
|
-
have_schema = true
|
430
|
-
active_column = nil if active_column != nil
|
431
|
-
end
|
432
|
-
schema.push(act)
|
433
|
-
end
|
434
|
-
end
|
435
|
-
if have_schema
|
436
|
-
at = output.get_height
|
437
|
-
output.resize(column_units.length + 1,at + 1)
|
438
|
-
output.set_cell(0,at,@builder.marker("!"))
|
439
|
-
begin
|
440
|
-
_g19 = 0
|
441
|
-
_g10 = column_units.length
|
442
|
-
while(_g19 < _g10)
|
443
|
-
j2 = _g19
|
444
|
-
_g19+=1
|
445
|
-
output.set_cell(j2 + 1,at,v1.to_datum(schema[j2]))
|
446
|
-
end
|
447
|
-
end
|
448
|
-
end
|
449
|
-
top_line_done = false
|
450
|
-
if @flags.always_show_header
|
451
|
-
at1 = output.get_height
|
452
|
-
output.resize(column_units.length + 1,at1 + 1)
|
453
|
-
output.set_cell(0,at1,@builder.marker("@@"))
|
454
|
-
begin
|
455
|
-
_g110 = 0
|
456
|
-
_g20 = column_units.length
|
457
|
-
while(_g110 < _g20)
|
458
|
-
j3 = _g110
|
459
|
-
_g110+=1
|
460
|
-
cunit2 = column_units[j3]
|
461
|
-
if cunit2.r >= 0
|
462
|
-
output.set_cell(j3 + 1,at1,b.get_cell(cunit2.r,rb_header)) if b.get_height != 0
|
463
|
-
elsif cunit2.lp >= 0
|
464
|
-
output.set_cell(j3 + 1,at1,p.get_cell(cunit2.lp,rp_header)) if p.get_height != 0
|
465
|
-
end
|
466
|
-
col_map[j3 + 1] = cunit2
|
467
|
-
end
|
468
|
-
end
|
469
|
-
top_line_done = true
|
470
|
-
end
|
471
|
-
output_height = output.get_height
|
472
|
-
output_height_init = output.get_height
|
473
|
-
begin
|
474
|
-
_g21 = 0
|
475
|
-
while(_g21 < outer_reps_needed)
|
476
|
-
out = _g21
|
477
|
-
_g21+=1
|
478
|
-
if out == 1
|
479
|
-
self.spread_context(units,@flags.unchanged_context,active)
|
480
|
-
self.spread_context(column_units,@flags.unchanged_column_context,active_column)
|
481
|
-
if active_column != nil
|
482
|
-
_g22 = 0
|
483
|
-
_g111 = column_units.length
|
484
|
-
while(_g22 < _g111)
|
485
|
-
i4 = _g22
|
486
|
-
_g22+=1
|
487
|
-
active_column[i4] = 0 if active_column[i4] == 3
|
488
|
-
end
|
489
|
-
end
|
490
|
-
rows = self.count_active(active) + output_height_init
|
491
|
-
rows-=1 if top_line_done
|
492
|
-
output_height = output_height_init
|
493
|
-
output.resize(column_units.length + 1,rows) if rows > output.get_height
|
494
|
-
end
|
495
|
-
showed_dummy = false
|
496
|
-
l = -1
|
497
|
-
r = -1
|
498
|
-
begin
|
499
|
-
_g23 = 0
|
500
|
-
_g112 = units.length
|
501
|
-
while(_g23 < _g112)
|
502
|
-
i5 = _g23
|
503
|
-
_g23+=1
|
504
|
-
unit1 = units[i5]
|
505
|
-
reordered1 = false
|
506
|
-
if @flags.ordered
|
507
|
-
reordered1 = true if row_moves.include?(i5)
|
508
|
-
show_rc_numbers = true if reordered1
|
509
|
-
end
|
510
|
-
next if unit1.r < 0 && unit1.l < 0
|
511
|
-
next if unit1.r == 0 && unit1.lp == 0 && top_line_done
|
512
|
-
act1 = ""
|
513
|
-
act1 = ":" if reordered1
|
514
|
-
publish = @flags.show_unchanged
|
515
|
-
dummy = false
|
516
|
-
if out == 1
|
517
|
-
publish = active[i5] > 0
|
518
|
-
dummy = active[i5] == 3
|
519
|
-
next if dummy && showed_dummy
|
520
|
-
next if !publish
|
521
|
-
end
|
522
|
-
showed_dummy = false if !dummy
|
523
|
-
at2 = output_height
|
524
|
-
if publish
|
525
|
-
output_height+=1
|
526
|
-
output.resize(column_units.length + 1,output_height) if output.get_height < output_height
|
527
|
-
end
|
528
|
-
if dummy
|
529
|
-
begin
|
530
|
-
_g41 = 0
|
531
|
-
_g31 = column_units.length + 1
|
532
|
-
while(_g41 < _g31)
|
533
|
-
j4 = _g41
|
534
|
-
_g41+=1
|
535
|
-
output.set_cell(j4,at2,v1.to_datum("..."))
|
536
|
-
end
|
537
|
-
end
|
538
|
-
showed_dummy = true
|
539
|
-
next
|
540
|
-
end
|
541
|
-
have_addition = false
|
542
|
-
skip = false
|
543
|
-
if unit1.p < 0 && unit1.l < 0 && unit1.r >= 0
|
544
|
-
skip = true if !allow_insert
|
545
|
-
act1 = "+++"
|
546
|
-
end
|
547
|
-
if (unit1.p >= 0 || !has_parent) && unit1.l >= 0 && unit1.r < 0
|
548
|
-
skip = true if !allow_delete
|
549
|
-
act1 = "---"
|
550
|
-
end
|
551
|
-
if skip
|
552
|
-
if !publish
|
553
|
-
active[i5] = -3 if active != nil
|
554
|
-
end
|
555
|
-
next
|
556
|
-
end
|
557
|
-
begin
|
558
|
-
_g42 = 0
|
559
|
-
_g32 = column_units.length
|
560
|
-
while(_g42 < _g32)
|
561
|
-
j5 = _g42
|
562
|
-
_g42+=1
|
563
|
-
cunit3 = column_units[j5]
|
564
|
-
pp1 = nil
|
565
|
-
ll = nil
|
566
|
-
rr = nil
|
567
|
-
dd = nil
|
568
|
-
dd_to = nil
|
569
|
-
have_dd_to = false
|
570
|
-
dd_to_alt = nil
|
571
|
-
have_dd_to_alt = false
|
572
|
-
have_pp = false
|
573
|
-
have_ll = false
|
574
|
-
have_rr = false
|
575
|
-
if cunit3.p >= 0 && unit1.p >= 0
|
576
|
-
pp1 = p.get_cell(cunit3.p,unit1.p)
|
577
|
-
have_pp = true
|
578
|
-
end
|
579
|
-
if cunit3.l >= 0 && unit1.l >= 0
|
580
|
-
ll = a.get_cell(cunit3.l,unit1.l)
|
581
|
-
have_ll = true
|
582
|
-
end
|
583
|
-
if cunit3.r >= 0 && unit1.r >= 0
|
584
|
-
rr = b.get_cell(cunit3.r,unit1.r)
|
585
|
-
have_rr = true
|
586
|
-
if (((have_pp) ? cunit3.p : cunit3.l)) < 0
|
587
|
-
if rr != nil
|
588
|
-
if v1.to_s(rr) != ""
|
589
|
-
have_addition = true if @flags.allow_update
|
590
|
-
end
|
591
|
-
end
|
592
|
-
end
|
593
|
-
end
|
594
|
-
if have_pp
|
595
|
-
if !have_rr
|
596
|
-
dd = pp1
|
597
|
-
elsif v1.equals(pp1,rr)
|
598
|
-
dd = pp1
|
599
|
-
else
|
600
|
-
dd = pp1
|
601
|
-
dd_to = rr
|
602
|
-
have_dd_to = true
|
603
|
-
if !v1.equals(pp1,ll)
|
604
|
-
if !v1.equals(pp1,rr)
|
605
|
-
dd_to_alt = ll
|
606
|
-
have_dd_to_alt = true
|
607
|
-
end
|
608
|
-
end
|
609
|
-
end
|
610
|
-
elsif have_ll
|
611
|
-
if !have_rr
|
612
|
-
dd = ll
|
613
|
-
elsif v1.equals(ll,rr)
|
614
|
-
dd = ll
|
615
|
-
else
|
616
|
-
dd = ll
|
617
|
-
dd_to = rr
|
618
|
-
have_dd_to = true
|
619
|
-
end
|
620
|
-
else
|
621
|
-
dd = rr
|
622
|
-
end
|
623
|
-
cell = dd
|
624
|
-
if have_dd_to && allow_update
|
625
|
-
active_column[j5] = 1 if active_column != nil
|
626
|
-
if sep == ""
|
627
|
-
if @builder.need_separator
|
628
|
-
sep = self.get_separator(a,b,"->")
|
629
|
-
@builder.set_separator(sep)
|
630
|
-
else
|
631
|
-
sep = "->"
|
632
|
-
end
|
633
|
-
end
|
634
|
-
is_conflict = false
|
635
|
-
if have_dd_to_alt
|
636
|
-
is_conflict = true if !v1.equals(dd_to,dd_to_alt)
|
637
|
-
end
|
638
|
-
if !is_conflict
|
639
|
-
cell = @builder.update(dd,dd_to)
|
640
|
-
act1 = sep if sep.length > act1.length
|
641
|
-
else
|
642
|
-
if conflict_sep == ""
|
643
|
-
if @builder.need_separator
|
644
|
-
conflict_sep = _hx_str(self.get_separator(p,a,"!")) + _hx_str(sep)
|
645
|
-
@builder.set_conflict_separator(conflict_sep)
|
646
|
-
else
|
647
|
-
conflict_sep = "!->"
|
648
|
-
end
|
649
|
-
end
|
650
|
-
cell = @builder.conflict(dd,dd_to_alt,dd_to)
|
651
|
-
act1 = conflict_sep
|
652
|
-
end
|
653
|
-
end
|
654
|
-
act1 = "+" if act1 == "" && have_addition
|
655
|
-
if act1 == "+++"
|
656
|
-
if have_rr
|
657
|
-
active_column[j5] = 1 if active_column != nil
|
658
|
-
end
|
659
|
-
end
|
660
|
-
if publish
|
661
|
-
output.set_cell(j5 + 1,at2,cell) if active_column == nil || active_column[j5] > 0
|
662
|
-
end
|
663
|
-
end
|
664
|
-
end
|
665
|
-
if publish
|
666
|
-
output.set_cell(0,at2,@builder.marker(act1))
|
667
|
-
row_map[at2] = unit1
|
668
|
-
end
|
669
|
-
if act1 != ""
|
670
|
-
if !publish
|
671
|
-
active[i5] = 1 if active != nil
|
672
|
-
end
|
673
|
-
end
|
674
|
-
end
|
462
|
+
@have_schema = true
|
463
|
+
@active_column = nil if @active_column != nil
|
675
464
|
end
|
465
|
+
@schema.push(act)
|
676
466
|
end
|
677
467
|
end
|
678
|
-
|
468
|
+
end
|
469
|
+
|
470
|
+
def check_rc_numbers(w,h)
|
471
|
+
if !@show_rc_numbers
|
679
472
|
if @flags.always_show_order
|
680
|
-
show_rc_numbers = true
|
473
|
+
@show_rc_numbers = true
|
681
474
|
elsif @flags.ordered
|
682
|
-
show_rc_numbers = self.is_reordered(row_map,
|
683
|
-
show_rc_numbers = self.is_reordered(col_map,
|
475
|
+
@show_rc_numbers = self.is_reordered(@row_map,h)
|
476
|
+
@show_rc_numbers = self.is_reordered(@col_map,w) if !@show_rc_numbers
|
684
477
|
end
|
685
478
|
end
|
479
|
+
end
|
480
|
+
|
481
|
+
def add_rc_numbers(output)
|
686
482
|
admin_w = 1
|
687
|
-
if show_rc_numbers && !@flags.never_show_order
|
483
|
+
if @show_rc_numbers && !@flags.never_show_order
|
688
484
|
admin_w+=1
|
689
485
|
target = Array.new
|
690
486
|
begin
|
691
|
-
|
692
|
-
|
693
|
-
while(
|
694
|
-
|
695
|
-
|
696
|
-
target.push(
|
487
|
+
_g1 = 0
|
488
|
+
_g = output.get_width
|
489
|
+
while(_g1 < _g)
|
490
|
+
i = _g1
|
491
|
+
_g1+=1
|
492
|
+
target.push(i + 1)
|
697
493
|
end
|
698
494
|
end
|
699
495
|
output.insert_or_delete_columns(target,output.get_width + 1)
|
700
496
|
begin
|
701
|
-
|
702
|
-
|
703
|
-
while(
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
if
|
708
|
-
output.set_cell(0,
|
497
|
+
_g11 = 0
|
498
|
+
_g2 = output.get_height
|
499
|
+
while(_g11 < _g2)
|
500
|
+
i1 = _g11
|
501
|
+
_g11+=1
|
502
|
+
unit = @row_map[i1]
|
503
|
+
if unit == nil
|
504
|
+
output.set_cell(0,i1,"")
|
709
505
|
next
|
710
506
|
end
|
711
|
-
output.set_cell(0,
|
507
|
+
output.set_cell(0,i1,@builder.links(unit,true))
|
712
508
|
end
|
713
509
|
end
|
714
510
|
target = Array.new
|
715
511
|
begin
|
716
|
-
|
717
|
-
|
718
|
-
while(
|
719
|
-
|
720
|
-
|
721
|
-
target.push(
|
512
|
+
_g12 = 0
|
513
|
+
_g3 = output.get_height
|
514
|
+
while(_g12 < _g3)
|
515
|
+
i2 = _g12
|
516
|
+
_g12+=1
|
517
|
+
target.push(i2 + 1)
|
722
518
|
end
|
723
519
|
end
|
724
520
|
output.insert_or_delete_rows(target,output.get_height + 1)
|
725
521
|
begin
|
726
|
-
|
727
|
-
|
728
|
-
while(
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
if
|
733
|
-
output.set_cell(
|
522
|
+
_g13 = 1
|
523
|
+
_g4 = output.get_width
|
524
|
+
while(_g13 < _g4)
|
525
|
+
i3 = _g13
|
526
|
+
_g13+=1
|
527
|
+
unit1 = @col_map[i3 - 1]
|
528
|
+
if unit1 == nil
|
529
|
+
output.set_cell(i3,0,"")
|
734
530
|
next
|
735
531
|
end
|
736
|
-
output.set_cell(
|
532
|
+
output.set_cell(i3,0,@builder.links(unit1,false))
|
737
533
|
end
|
738
534
|
end
|
739
535
|
output.set_cell(0,0,@builder.marker("@:@"))
|
740
536
|
end
|
741
|
-
|
537
|
+
admin_w
|
538
|
+
end
|
539
|
+
|
540
|
+
def elide_columns(output,admin_w)
|
541
|
+
if @active_column != nil
|
742
542
|
all_active = true
|
743
543
|
begin
|
744
|
-
|
745
|
-
|
746
|
-
while(
|
747
|
-
|
748
|
-
|
749
|
-
if active_column[
|
544
|
+
_g1 = 0
|
545
|
+
_g = @active_column.length
|
546
|
+
while(_g1 < _g)
|
547
|
+
i = _g1
|
548
|
+
_g1+=1
|
549
|
+
if @active_column[i] == 0
|
750
550
|
all_active = false
|
751
551
|
break
|
752
552
|
end
|
@@ -755,23 +555,23 @@ module Coopy
|
|
755
555
|
if !all_active
|
756
556
|
fate = Array.new
|
757
557
|
begin
|
758
|
-
|
759
|
-
while(
|
760
|
-
|
761
|
-
|
762
|
-
fate.push(
|
558
|
+
_g2 = 0
|
559
|
+
while(_g2 < admin_w)
|
560
|
+
i1 = _g2
|
561
|
+
_g2+=1
|
562
|
+
fate.push(i1)
|
763
563
|
end
|
764
564
|
end
|
765
|
-
|
565
|
+
at = admin_w
|
766
566
|
ct = 0
|
767
567
|
dots = Array.new
|
768
568
|
begin
|
769
|
-
|
770
|
-
|
771
|
-
while(
|
772
|
-
|
773
|
-
|
774
|
-
off = active_column[
|
569
|
+
_g11 = 0
|
570
|
+
_g3 = @active_column.length
|
571
|
+
while(_g11 < _g3)
|
572
|
+
i2 = _g11
|
573
|
+
_g11+=1
|
574
|
+
off = @active_column[i2] == 0
|
775
575
|
if off
|
776
576
|
ct = ct + 1
|
777
577
|
else
|
@@ -780,32 +580,411 @@ module Coopy
|
|
780
580
|
if off && ct > 1
|
781
581
|
fate.push(-1)
|
782
582
|
else
|
783
|
-
dots.push(
|
784
|
-
fate.push(
|
785
|
-
|
583
|
+
dots.push(at) if off
|
584
|
+
fate.push(at)
|
585
|
+
at+=1
|
786
586
|
end
|
787
587
|
end
|
788
588
|
end
|
789
|
-
output.insert_or_delete_columns(fate,
|
589
|
+
output.insert_or_delete_columns(fate,at)
|
790
590
|
begin
|
791
|
-
|
792
|
-
while(
|
793
|
-
d = dots[
|
794
|
-
|
591
|
+
_g4 = 0
|
592
|
+
while(_g4 < dots.length)
|
593
|
+
d = dots[_g4]
|
594
|
+
_g4+=1
|
795
595
|
begin
|
796
|
-
|
797
|
-
|
798
|
-
while(
|
799
|
-
|
800
|
-
|
801
|
-
output.set_cell(d,
|
596
|
+
_g21 = 0
|
597
|
+
_g12 = output.get_height
|
598
|
+
while(_g21 < _g12)
|
599
|
+
j = _g21
|
600
|
+
_g21+=1
|
601
|
+
output.set_cell(d,j,@builder.marker("..."))
|
802
602
|
end
|
803
603
|
end
|
804
604
|
end
|
805
605
|
end
|
806
606
|
end
|
807
607
|
end
|
808
|
-
|
608
|
+
end
|
609
|
+
|
610
|
+
def add_schema(output)
|
611
|
+
if @have_schema
|
612
|
+
at = output.get_height
|
613
|
+
output.resize(@column_units.length + 1,at + 1)
|
614
|
+
output.set_cell(0,at,@builder.marker("!"))
|
615
|
+
begin
|
616
|
+
_g1 = 0
|
617
|
+
_g = @column_units.length
|
618
|
+
while(_g1 < _g)
|
619
|
+
j = _g1
|
620
|
+
_g1+=1
|
621
|
+
output.set_cell(j + 1,at,@v.to_datum(@schema[j]))
|
622
|
+
end
|
623
|
+
end
|
624
|
+
@schema_diff_found = true
|
625
|
+
end
|
626
|
+
end
|
627
|
+
|
628
|
+
def add_header(output)
|
629
|
+
if @flags.always_show_header
|
630
|
+
at = output.get_height
|
631
|
+
output.resize(@column_units.length + 1,at + 1)
|
632
|
+
output.set_cell(0,at,@builder.marker("@@"))
|
633
|
+
begin
|
634
|
+
_g1 = 0
|
635
|
+
_g = @column_units.length
|
636
|
+
while(_g1 < _g)
|
637
|
+
j = _g1
|
638
|
+
_g1+=1
|
639
|
+
cunit = @column_units[j]
|
640
|
+
if cunit.r >= 0
|
641
|
+
output.set_cell(j + 1,at,@b.get_cell(cunit.r,@rb_header)) if @b.get_height != 0
|
642
|
+
elsif cunit.l >= 0
|
643
|
+
output.set_cell(j + 1,at,@a.get_cell(cunit.l,@ra_header)) if @a.get_height != 0
|
644
|
+
elsif cunit.lp >= 0
|
645
|
+
output.set_cell(j + 1,at,@p.get_cell(cunit.lp,@rp_header)) if @p.get_height != 0
|
646
|
+
end
|
647
|
+
@col_map[j + 1] = cunit
|
648
|
+
end
|
649
|
+
end
|
650
|
+
@top_line_done = true
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
def check_meta(t,meta)
|
655
|
+
return false if meta.get_width != t.get_width + 1
|
656
|
+
return false if meta.get_width == 0 || meta.get_height == 0
|
657
|
+
true
|
658
|
+
end
|
659
|
+
|
660
|
+
def get_meta_table(t)
|
661
|
+
meta = t.get_meta
|
662
|
+
return nil if meta == nil
|
663
|
+
meta.as_table
|
664
|
+
end
|
665
|
+
|
666
|
+
def add_meta(output)
|
667
|
+
a_meta = nil
|
668
|
+
b_meta = nil
|
669
|
+
p_meta = nil
|
670
|
+
a_meta = self.get_meta_table(@a)
|
671
|
+
b_meta = self.get_meta_table(@b)
|
672
|
+
p_meta = self.get_meta_table(@p)
|
673
|
+
return false if a_meta == nil || b_meta == nil || p_meta == nil
|
674
|
+
return false if !self.check_meta(@a,a_meta)
|
675
|
+
return false if !self.check_meta(@b,b_meta)
|
676
|
+
return false if !self.check_meta(@p,p_meta)
|
677
|
+
return false if !@flags.show_meta
|
678
|
+
meta_diff = ::Coopy::SimpleTable.new(0,0)
|
679
|
+
meta_flags = ::Coopy::CompareFlags.new
|
680
|
+
meta_flags.add_primary_key("@@")
|
681
|
+
meta_flags.add_primary_key("@")
|
682
|
+
meta_flags.unchanged_column_context = 65536
|
683
|
+
meta_flags.unchanged_context = 0
|
684
|
+
meta_align = ::Coopy::Coopy.compare_tables3(((a_meta == p_meta) ? nil : p_meta),a_meta,b_meta,meta_flags).align
|
685
|
+
td = ::Coopy::TableDiff.new(meta_align,meta_flags)
|
686
|
+
td.preserve_columns = true
|
687
|
+
td.hilite(meta_diff)
|
688
|
+
if td.has_difference
|
689
|
+
h = output.get_height
|
690
|
+
dh = meta_diff.get_height
|
691
|
+
offset = nil
|
692
|
+
if td.has_schema_difference
|
693
|
+
offset = 2
|
694
|
+
else
|
695
|
+
offset = 1
|
696
|
+
end
|
697
|
+
output.resize(output.get_width,h + dh - offset)
|
698
|
+
v = meta_diff.get_cell_view
|
699
|
+
begin
|
700
|
+
_g = offset
|
701
|
+
while(_g < dh)
|
702
|
+
y = _g
|
703
|
+
_g+=1
|
704
|
+
begin
|
705
|
+
_g2 = 1
|
706
|
+
_g1 = meta_diff.get_width
|
707
|
+
while(_g2 < _g1)
|
708
|
+
x = _g2
|
709
|
+
_g2+=1
|
710
|
+
c = meta_diff.get_cell(x,y)
|
711
|
+
c = "@" + _hx_str(v.to_s(c)) + "@" + _hx_str(v.to_s(meta_diff.get_cell(0,y))) if x == 1
|
712
|
+
output.set_cell(x - 1,h + y - offset,c)
|
713
|
+
end
|
714
|
+
end
|
715
|
+
end
|
716
|
+
end
|
717
|
+
if @active_column != nil
|
718
|
+
if td.active_column.length == meta_diff.get_width
|
719
|
+
_g11 = 1
|
720
|
+
_g3 = meta_diff.get_width
|
721
|
+
while(_g11 < _g3)
|
722
|
+
i = _g11
|
723
|
+
_g11+=1
|
724
|
+
@active_column[i - 1] = 1 if td.active_column[i] >= 0
|
725
|
+
end
|
726
|
+
end
|
727
|
+
end
|
728
|
+
end
|
729
|
+
false
|
730
|
+
end
|
731
|
+
|
732
|
+
def refine_activity
|
733
|
+
self.spread_context(@row_units,@flags.unchanged_context,@active_row)
|
734
|
+
self.spread_context(@column_units,@flags.unchanged_column_context,@active_column)
|
735
|
+
if @active_column != nil
|
736
|
+
_g1 = 0
|
737
|
+
_g = @column_units.length
|
738
|
+
while(_g1 < _g)
|
739
|
+
i = _g1
|
740
|
+
_g1+=1
|
741
|
+
@active_column[i] = 0 if @active_column[i] == 3
|
742
|
+
end
|
743
|
+
end
|
744
|
+
end
|
745
|
+
|
746
|
+
def scan_row(unit,output,at,i)
|
747
|
+
begin
|
748
|
+
_g1 = 0
|
749
|
+
_g = @column_units.length
|
750
|
+
while(_g1 < _g)
|
751
|
+
j = _g1
|
752
|
+
_g1+=1
|
753
|
+
cunit = @column_units[j]
|
754
|
+
pp = nil
|
755
|
+
ll = nil
|
756
|
+
rr = nil
|
757
|
+
dd = nil
|
758
|
+
dd_to = nil
|
759
|
+
have_dd_to = false
|
760
|
+
dd_to_alt = nil
|
761
|
+
have_dd_to_alt = false
|
762
|
+
have_pp = false
|
763
|
+
have_ll = false
|
764
|
+
have_rr = false
|
765
|
+
if cunit.p >= 0 && unit.p >= 0
|
766
|
+
pp = @p.get_cell(cunit.p,unit.p)
|
767
|
+
have_pp = true
|
768
|
+
end
|
769
|
+
if cunit.l >= 0 && unit.l >= 0
|
770
|
+
ll = @a.get_cell(cunit.l,unit.l)
|
771
|
+
have_ll = true
|
772
|
+
end
|
773
|
+
if cunit.r >= 0 && unit.r >= 0
|
774
|
+
rr = @b.get_cell(cunit.r,unit.r)
|
775
|
+
have_rr = true
|
776
|
+
if (((have_pp) ? cunit.p : cunit.l)) < 0
|
777
|
+
if rr != nil
|
778
|
+
if @v.to_s(rr) != ""
|
779
|
+
@have_addition = true if @flags.allow_update
|
780
|
+
end
|
781
|
+
end
|
782
|
+
end
|
783
|
+
end
|
784
|
+
if have_pp
|
785
|
+
if !have_rr
|
786
|
+
dd = pp
|
787
|
+
elsif @v.equals(pp,rr)
|
788
|
+
dd = ll
|
789
|
+
else
|
790
|
+
dd = pp
|
791
|
+
dd_to = rr
|
792
|
+
have_dd_to = true
|
793
|
+
if !@v.equals(pp,ll)
|
794
|
+
if !@v.equals(pp,rr)
|
795
|
+
dd_to_alt = ll
|
796
|
+
have_dd_to_alt = true
|
797
|
+
end
|
798
|
+
end
|
799
|
+
end
|
800
|
+
elsif have_ll
|
801
|
+
if !have_rr
|
802
|
+
dd = ll
|
803
|
+
elsif @v.equals(ll,rr)
|
804
|
+
dd = ll
|
805
|
+
else
|
806
|
+
dd = ll
|
807
|
+
dd_to = rr
|
808
|
+
have_dd_to = true
|
809
|
+
end
|
810
|
+
else
|
811
|
+
dd = rr
|
812
|
+
end
|
813
|
+
cell = dd
|
814
|
+
if have_dd_to && @allow_update
|
815
|
+
@active_column[j] = 1 if @active_column != nil
|
816
|
+
if @sep == ""
|
817
|
+
if @builder.need_separator
|
818
|
+
@sep = self.get_separator(@a,@b,"->")
|
819
|
+
@builder.set_separator(@sep)
|
820
|
+
else
|
821
|
+
@sep = "->"
|
822
|
+
end
|
823
|
+
end
|
824
|
+
is_conflict = false
|
825
|
+
if have_dd_to_alt
|
826
|
+
is_conflict = true if !@v.equals(dd_to,dd_to_alt)
|
827
|
+
end
|
828
|
+
if !is_conflict
|
829
|
+
cell = @builder.update(dd,dd_to)
|
830
|
+
@act = @sep if @sep.length > @act.length
|
831
|
+
else
|
832
|
+
if @conflict_sep == ""
|
833
|
+
if @builder.need_separator
|
834
|
+
@conflict_sep = _hx_str(self.get_separator(@p,@a,"!")) + _hx_str(@sep)
|
835
|
+
@builder.set_conflict_separator(@conflict_sep)
|
836
|
+
else
|
837
|
+
@conflict_sep = "!->"
|
838
|
+
end
|
839
|
+
end
|
840
|
+
cell = @builder.conflict(dd,dd_to_alt,dd_to)
|
841
|
+
@act = @conflict_sep
|
842
|
+
end
|
843
|
+
end
|
844
|
+
@act = "+" if @act == "" && @have_addition
|
845
|
+
if @act == "+++"
|
846
|
+
if have_rr
|
847
|
+
@active_column[j] = 1 if @active_column != nil
|
848
|
+
end
|
849
|
+
end
|
850
|
+
if @publish
|
851
|
+
output.set_cell(j + 1,at,cell) if @active_column == nil || @active_column[j] > 0
|
852
|
+
end
|
853
|
+
end
|
854
|
+
end
|
855
|
+
if @publish
|
856
|
+
output.set_cell(0,at,@builder.marker(@act))
|
857
|
+
@row_map[at] = unit
|
858
|
+
end
|
859
|
+
if @act != ""
|
860
|
+
@diff_found = true
|
861
|
+
if !@publish
|
862
|
+
@active_row[i] = 1 if @active_row != nil
|
863
|
+
end
|
864
|
+
end
|
865
|
+
end
|
866
|
+
|
867
|
+
public
|
868
|
+
|
869
|
+
def hilite(output)
|
870
|
+
return false if !output.is_resizable
|
871
|
+
if @builder == nil
|
872
|
+
if @flags.allow_nested_cells
|
873
|
+
@builder = ::Coopy::NestedCellBuilder.new
|
874
|
+
else
|
875
|
+
@builder = ::Coopy::FlatCellBuilder.new(@flags)
|
876
|
+
end
|
877
|
+
end
|
878
|
+
output.resize(0,0)
|
879
|
+
output.clear
|
880
|
+
self.reset
|
881
|
+
self.setup_tables
|
882
|
+
self.setup_columns
|
883
|
+
self.setup_moves
|
884
|
+
self.scan_activity
|
885
|
+
self.scan_schema
|
886
|
+
self.add_schema(output)
|
887
|
+
self.add_header(output)
|
888
|
+
self.add_meta(output)
|
889
|
+
outer_reps_needed = nil
|
890
|
+
if @flags.show_unchanged && @flags.show_unchanged_columns
|
891
|
+
outer_reps_needed = 1
|
892
|
+
else
|
893
|
+
outer_reps_needed = 2
|
894
|
+
end
|
895
|
+
output_height = output.get_height
|
896
|
+
output_height_init = output.get_height
|
897
|
+
begin
|
898
|
+
_g = 0
|
899
|
+
while(_g < outer_reps_needed)
|
900
|
+
out = _g
|
901
|
+
_g+=1
|
902
|
+
if out == 1
|
903
|
+
self.refine_activity
|
904
|
+
rows = self.count_active(@active_row) + output_height_init
|
905
|
+
rows-=1 if @top_line_done
|
906
|
+
output_height = output_height_init
|
907
|
+
output.resize(@column_units.length + 1,rows) if rows > output.get_height
|
908
|
+
end
|
909
|
+
showed_dummy = false
|
910
|
+
l = -1
|
911
|
+
r = -1
|
912
|
+
begin
|
913
|
+
_g2 = 0
|
914
|
+
_g1 = @row_units.length
|
915
|
+
while(_g2 < _g1)
|
916
|
+
i = _g2
|
917
|
+
_g2+=1
|
918
|
+
unit = @row_units[i]
|
919
|
+
reordered = false
|
920
|
+
if @flags.ordered
|
921
|
+
reordered = true if @row_moves.include?(i)
|
922
|
+
@show_rc_numbers = true if reordered
|
923
|
+
end
|
924
|
+
next if unit.r < 0 && unit.l < 0
|
925
|
+
next if unit.r == 0 && unit.lp <= 0 && @top_line_done
|
926
|
+
@publish = @flags.show_unchanged
|
927
|
+
dummy = false
|
928
|
+
if out == 1
|
929
|
+
@publish = @active_row[i] > 0
|
930
|
+
dummy = @active_row[i] == 3
|
931
|
+
next if dummy && showed_dummy
|
932
|
+
next if !@publish
|
933
|
+
end
|
934
|
+
showed_dummy = false if !dummy
|
935
|
+
at = output_height
|
936
|
+
if @publish
|
937
|
+
output_height+=1
|
938
|
+
output.resize(@column_units.length + 1,output_height) if output.get_height < output_height
|
939
|
+
end
|
940
|
+
if dummy
|
941
|
+
begin
|
942
|
+
_g4 = 0
|
943
|
+
_g3 = @column_units.length + 1
|
944
|
+
while(_g4 < _g3)
|
945
|
+
j = _g4
|
946
|
+
_g4+=1
|
947
|
+
output.set_cell(j,at,@v.to_datum("..."))
|
948
|
+
end
|
949
|
+
end
|
950
|
+
showed_dummy = true
|
951
|
+
next
|
952
|
+
end
|
953
|
+
@have_addition = false
|
954
|
+
skip = false
|
955
|
+
@act = ""
|
956
|
+
@act = ":" if reordered
|
957
|
+
if unit.p < 0 && unit.l < 0 && unit.r >= 0
|
958
|
+
skip = true if !@allow_insert
|
959
|
+
@act = "+++"
|
960
|
+
end
|
961
|
+
if (unit.p >= 0 || !@has_parent) && unit.l >= 0 && unit.r < 0
|
962
|
+
skip = true if !@allow_delete
|
963
|
+
@act = "---"
|
964
|
+
end
|
965
|
+
if skip
|
966
|
+
if !@publish
|
967
|
+
@active_row[i] = -3 if @active_row != nil
|
968
|
+
end
|
969
|
+
next
|
970
|
+
end
|
971
|
+
self.scan_row(unit,output,at,i)
|
972
|
+
end
|
973
|
+
end
|
974
|
+
end
|
975
|
+
end
|
976
|
+
self.check_rc_numbers(output.get_width,output.get_height)
|
977
|
+
admin_w = self.add_rc_numbers(output)
|
978
|
+
self.elide_columns(output,admin_w) if !@preserve_columns
|
979
|
+
true
|
980
|
+
end
|
981
|
+
|
982
|
+
def has_difference
|
983
|
+
@diff_found
|
984
|
+
end
|
985
|
+
|
986
|
+
def has_schema_difference
|
987
|
+
@schema_diff_found
|
809
988
|
end
|
810
989
|
|
811
990
|
haxe_me ["coopy", "TableDiff"]
|