daff 1.2.6 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -29,7 +29,7 @@ module Coopy
|
|
29
29
|
attr_accessor :patch_row
|
30
30
|
|
31
31
|
def to_s
|
32
|
-
|
32
|
+
"(" + _hx_str(@code) + " patch " + _hx_str(@patch_row) + " source " + _hx_str(@source_prev_row) + ":" + _hx_str(@source_row) + ":" + _hx_str(@source_next_row) + "+" + _hx_str(@source_row_offset) + " dest " + _hx_str(@dest_row) + ")"
|
33
33
|
end
|
34
34
|
|
35
35
|
haxe_me ["coopy", "HighlightPatchUnit"]
|
data/lib/lib/coopy/index.rb
CHANGED
@@ -10,6 +10,7 @@ module Coopy
|
|
10
10
|
@keys = Array.new
|
11
11
|
@top_freq = 0
|
12
12
|
@height = 0
|
13
|
+
@hdr = 0
|
13
14
|
end
|
14
15
|
|
15
16
|
attr_accessor :items
|
@@ -22,6 +23,7 @@ module Coopy
|
|
22
23
|
attr_accessor :cols
|
23
24
|
attr_accessor :v
|
24
25
|
attr_accessor :indexed_table
|
26
|
+
attr_accessor :hdr
|
25
27
|
|
26
28
|
public
|
27
29
|
|
@@ -29,8 +31,9 @@ module Coopy
|
|
29
31
|
@cols.push(i)
|
30
32
|
end
|
31
33
|
|
32
|
-
def index_table(t)
|
34
|
+
def index_table(t,hdr)
|
33
35
|
@indexed_table = t
|
36
|
+
@hdr = hdr
|
34
37
|
@keys[t.get_height - 1] = nil if @keys.length != t.get_height && t.get_height > 0
|
35
38
|
begin
|
36
39
|
_g1 = 0
|
@@ -61,7 +64,12 @@ module Coopy
|
|
61
64
|
end
|
62
65
|
|
63
66
|
def to_key(t,i)
|
64
|
-
wide =
|
67
|
+
wide = nil
|
68
|
+
if i < @hdr
|
69
|
+
wide = "_"
|
70
|
+
else
|
71
|
+
wide = ""
|
72
|
+
end
|
65
73
|
@v = t.get_cell_view if @v == nil
|
66
74
|
begin
|
67
75
|
_g1 = 0
|
@@ -71,16 +79,21 @@ module Coopy
|
|
71
79
|
_g1+=1
|
72
80
|
d = t.get_cell(@cols[k],i)
|
73
81
|
txt = @v.to_s(d)
|
74
|
-
next if txt == nil || txt == "" || txt == "null" || txt == "undefined"
|
75
82
|
wide += " // " if k > 0
|
83
|
+
next if txt == nil || txt == "" || txt == "null" || txt == "undefined"
|
76
84
|
wide += txt
|
77
85
|
end
|
78
86
|
end
|
79
|
-
|
87
|
+
wide
|
80
88
|
end
|
81
89
|
|
82
90
|
def to_key_by_content(row)
|
83
|
-
wide =
|
91
|
+
wide = nil
|
92
|
+
if row.is_preamble
|
93
|
+
wide = "_"
|
94
|
+
else
|
95
|
+
wide = ""
|
96
|
+
end
|
84
97
|
begin
|
85
98
|
_g1 = 0
|
86
99
|
_g = @cols.length
|
@@ -88,16 +101,16 @@ module Coopy
|
|
88
101
|
k = _g1
|
89
102
|
_g1+=1
|
90
103
|
txt = row.get_row_string(@cols[k])
|
91
|
-
next if txt == nil || txt == "" || txt == "null" || txt == "undefined"
|
92
104
|
wide += " // " if k > 0
|
105
|
+
next if txt == nil || txt == "" || txt == "null" || txt == "undefined"
|
93
106
|
wide += txt
|
94
107
|
end
|
95
108
|
end
|
96
|
-
|
109
|
+
wide
|
97
110
|
end
|
98
111
|
|
99
112
|
def get_table
|
100
|
-
|
113
|
+
@indexed_table
|
101
114
|
end
|
102
115
|
|
103
116
|
haxe_me ["coopy", "Index"]
|
data/lib/lib/coopy/index_item.rb
CHANGED
@@ -16,15 +16,19 @@ module Coopy
|
|
16
16
|
def add(i)
|
17
17
|
@lst = Array.new if @lst == nil
|
18
18
|
@lst.push(i)
|
19
|
-
|
19
|
+
@lst.length
|
20
20
|
end
|
21
21
|
|
22
22
|
def length
|
23
|
-
|
23
|
+
@lst.length
|
24
24
|
end
|
25
25
|
|
26
26
|
def value
|
27
|
-
|
27
|
+
@lst[0]
|
28
|
+
end
|
29
|
+
|
30
|
+
def as_list
|
31
|
+
@lst
|
28
32
|
end
|
29
33
|
|
30
34
|
haxe_me ["coopy", "IndexItem"]
|
data/lib/lib/coopy/index_pair.rb
CHANGED
@@ -8,12 +8,14 @@ module Coopy
|
|
8
8
|
@ia = ::Coopy::Index.new
|
9
9
|
@ib = ::Coopy::Index.new
|
10
10
|
@quality = 0
|
11
|
+
@hdr = 0
|
11
12
|
end
|
12
13
|
|
13
14
|
protected
|
14
15
|
|
15
16
|
attr_accessor :ia
|
16
17
|
attr_accessor :ib
|
18
|
+
attr_accessor :hdr
|
17
19
|
attr_accessor :quality
|
18
20
|
|
19
21
|
public
|
@@ -23,9 +25,10 @@ module Coopy
|
|
23
25
|
@ib.add_column(cb)
|
24
26
|
end
|
25
27
|
|
26
|
-
def index_tables(a,b)
|
27
|
-
@ia.index_table(a)
|
28
|
-
@ib.index_table(b)
|
28
|
+
def index_tables(a,b,hdr)
|
29
|
+
@ia.index_table(a,hdr)
|
30
|
+
@ib.index_table(b,hdr)
|
31
|
+
@hdr = hdr
|
29
32
|
good = 0
|
30
33
|
_it = ::Rb::RubyIterator.new(@ia.items.keys)
|
31
34
|
while(_it.has_next) do
|
@@ -52,7 +55,7 @@ module Coopy
|
|
52
55
|
result.spot_a = result.item_a.lst.length if result.item_a != nil
|
53
56
|
result.spot_b = result.item_b.lst.length if result.item_b != nil
|
54
57
|
end
|
55
|
-
|
58
|
+
result
|
56
59
|
end
|
57
60
|
|
58
61
|
public
|
@@ -60,29 +63,29 @@ module Coopy
|
|
60
63
|
def query_by_content(row)
|
61
64
|
result = ::Coopy::CrossMatch.new
|
62
65
|
ka = @ia.to_key_by_content(row)
|
63
|
-
|
66
|
+
self.query_by_key(ka)
|
64
67
|
end
|
65
68
|
|
66
69
|
def query_local(row)
|
67
70
|
ka = @ia.to_key(@ia.get_table,row)
|
68
|
-
|
71
|
+
self.query_by_key(ka)
|
69
72
|
end
|
70
73
|
|
71
74
|
def local_key(row)
|
72
|
-
|
75
|
+
@ia.to_key(@ia.get_table,row)
|
73
76
|
end
|
74
77
|
|
75
78
|
def remote_key(row)
|
76
|
-
|
79
|
+
@ib.to_key(@ib.get_table,row)
|
77
80
|
end
|
78
81
|
|
79
82
|
def get_top_freq
|
80
83
|
return @ib.top_freq if @ib.top_freq > @ia.top_freq
|
81
|
-
|
84
|
+
@ia.top_freq
|
82
85
|
end
|
83
86
|
|
84
87
|
def get_quality
|
85
|
-
|
88
|
+
@quality
|
86
89
|
end
|
87
90
|
|
88
91
|
haxe_me ["coopy", "IndexPair"]
|
data/lib/lib/coopy/merger.rb
CHANGED
@@ -75,7 +75,7 @@ module Coopy
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
78
|
-
|
78
|
+
at
|
79
79
|
end
|
80
80
|
|
81
81
|
def shuffle_columns
|
@@ -171,13 +171,13 @@ module Coopy
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|
174
|
-
|
174
|
+
@conflicts
|
175
175
|
end
|
176
176
|
|
177
177
|
# protected - in ruby this doesn't play well with static/inline methods
|
178
178
|
|
179
179
|
def Merger.make_conflicted_cell(view,pcell,lcell,rcell)
|
180
|
-
|
180
|
+
view.to_datum("((( " + _hx_str(view.to_s(pcell)) + " ))) " + _hx_str(view.to_s(lcell)) + " /// " + _hx_str(view.to_s(rcell)))
|
181
181
|
end
|
182
182
|
|
183
183
|
haxe_me ["coopy", "Merger"]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class Meta
|
6
|
+
def alterColumns(columns) puts "Abstract Meta.alterColumns called" end
|
7
|
+
def changeRow(rc) puts "Abstract Meta.changeRow called" end
|
8
|
+
def applyFlags(flags) puts "Abstract Meta.applyFlags called" end
|
9
|
+
def asTable() puts "Abstract Meta.asTable called" end
|
10
|
+
def cloneMeta(table = nil) puts "Abstract Meta.cloneMeta called" end
|
11
|
+
def useForColumnChanges() puts "Abstract Meta.useForColumnChanges called" end
|
12
|
+
def useForRowChanges() puts "Abstract Meta.useForRowChanges called" end
|
13
|
+
def getRowStream() puts "Abstract Meta.getRowStream called" end
|
14
|
+
haxe_me ["coopy", "Meta"]
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/lib/lib/coopy/mover.rb
CHANGED
@@ -53,7 +53,7 @@ module Coopy
|
|
53
53
|
idest.push(v) if v != nil
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
56
|
+
::Coopy::Mover.move_without_extras(isrc,idest)
|
57
57
|
end
|
58
58
|
|
59
59
|
def Mover.move(isrc,idest)
|
@@ -104,7 +104,7 @@ module Coopy
|
|
104
104
|
dest.push(v) if in_src.include?(v)
|
105
105
|
end
|
106
106
|
end
|
107
|
-
|
107
|
+
::Coopy::Mover.move_without_extras(src,dest)
|
108
108
|
end
|
109
109
|
|
110
110
|
# protected - in ruby this doesn't play well with static/inline methods
|
@@ -155,8 +155,10 @@ module Coopy
|
|
155
155
|
k = _it._next
|
156
156
|
blks.push(k)
|
157
157
|
end
|
158
|
-
blks.sort {|a,b|
|
159
|
-
|
158
|
+
blks.sort! {|a,b|
|
159
|
+
diff = blk_len[b] - blk_len[a]
|
160
|
+
return diff if diff != 0
|
161
|
+
a - b
|
160
162
|
}
|
161
163
|
moved = Array.new
|
162
164
|
while(blks.length > 0)
|
@@ -186,7 +188,7 @@ module Coopy
|
|
186
188
|
i1-=1
|
187
189
|
end
|
188
190
|
end
|
189
|
-
|
191
|
+
moved
|
190
192
|
end
|
191
193
|
|
192
194
|
haxe_me ["coopy", "Mover"]
|
data/lib/lib/coopy/ndjson.rb
CHANGED
@@ -38,7 +38,7 @@ module Coopy
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
41
|
+
::Haxe::Format::JsonPrinter._print(row,nil,nil)
|
42
42
|
end
|
43
43
|
|
44
44
|
def render
|
@@ -58,7 +58,7 @@ module Coopy
|
|
58
58
|
txt += "\n"
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
61
|
+
txt
|
62
62
|
end
|
63
63
|
|
64
64
|
def add_row(r,txt)
|
@@ -14,7 +14,7 @@ module Coopy
|
|
14
14
|
public
|
15
15
|
|
16
16
|
def need_separator
|
17
|
-
|
17
|
+
false
|
18
18
|
end
|
19
19
|
|
20
20
|
def set_separator(separator)
|
@@ -31,7 +31,7 @@ module Coopy
|
|
31
31
|
h = @view.make_hash
|
32
32
|
@view.hash_set(h,"before",local)
|
33
33
|
@view.hash_set(h,"after",remote)
|
34
|
-
|
34
|
+
h
|
35
35
|
end
|
36
36
|
|
37
37
|
def conflict(parent,local,remote)
|
@@ -39,23 +39,23 @@ module Coopy
|
|
39
39
|
@view.hash_set(h,"before",parent)
|
40
40
|
@view.hash_set(h,"ours",local)
|
41
41
|
@view.hash_set(h,"theirs",remote)
|
42
|
-
|
42
|
+
h
|
43
43
|
end
|
44
44
|
|
45
45
|
def marker(label)
|
46
|
-
|
46
|
+
@view.to_datum(label)
|
47
47
|
end
|
48
48
|
|
49
49
|
protected
|
50
50
|
|
51
51
|
def neg_to_null(x)
|
52
52
|
return nil if x < 0
|
53
|
-
|
53
|
+
x
|
54
54
|
end
|
55
55
|
|
56
56
|
public
|
57
57
|
|
58
|
-
def links(unit)
|
58
|
+
def links(unit,row_like)
|
59
59
|
h = @view.make_hash
|
60
60
|
if unit.p >= -1
|
61
61
|
@view.hash_set(h,"before",self.neg_to_null(unit.p))
|
@@ -65,7 +65,7 @@ module Coopy
|
|
65
65
|
end
|
66
66
|
@view.hash_set(h,"before",self.neg_to_null(unit.l))
|
67
67
|
@view.hash_set(h,"after",self.neg_to_null(unit.r))
|
68
|
-
|
68
|
+
h
|
69
69
|
end
|
70
70
|
|
71
71
|
haxe_me ["coopy", "NestedCellBuilder"]
|
data/lib/lib/coopy/ordering.rb
CHANGED
@@ -22,7 +22,11 @@ module Coopy
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def get_list
|
25
|
-
|
25
|
+
@order
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_list(lst)
|
29
|
+
@order = lst
|
26
30
|
end
|
27
31
|
|
28
32
|
def to_s
|
@@ -37,7 +41,7 @@ module Coopy
|
|
37
41
|
txt += @order[i].to_s
|
38
42
|
end
|
39
43
|
end
|
40
|
-
|
44
|
+
txt
|
41
45
|
end
|
42
46
|
|
43
47
|
def ignore_parent
|
data/lib/lib/coopy/row.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class RowChange
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_accessor :cond
|
11
|
+
attr_accessor :val
|
12
|
+
attr_accessor :conflicting_val
|
13
|
+
attr_accessor :conflicting_parent_val
|
14
|
+
attr_accessor :conflicted
|
15
|
+
attr_accessor :is_key
|
16
|
+
attr_accessor :action
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def show_map(m)
|
21
|
+
return "{}" if m == nil
|
22
|
+
txt = ""
|
23
|
+
_it = ::Rb::RubyIterator.new(m.keys)
|
24
|
+
while(_it.has_next) do
|
25
|
+
k = _it._next
|
26
|
+
txt += ", " if txt != ""
|
27
|
+
v = m[k]
|
28
|
+
txt += _hx_str(k) + "=" + _hx_str(v.to_s)
|
29
|
+
end
|
30
|
+
"{ " + _hx_str(txt) + " }"
|
31
|
+
end
|
32
|
+
|
33
|
+
public
|
34
|
+
|
35
|
+
def to_s
|
36
|
+
_hx_str(@action) + " " + _hx_str(self.show_map(@cond)) + " : " + _hx_str(self.show_map(@val))
|
37
|
+
end
|
38
|
+
|
39
|
+
haxe_me ["coopy", "RowChange"]
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|