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
data/lib/lib/coopy/table_io.rb
CHANGED
@@ -8,16 +8,16 @@ module Coopy
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def get_content(name)
|
11
|
-
|
11
|
+
::Sys::Io::HxFile.get_content(name)
|
12
12
|
end
|
13
13
|
|
14
14
|
def save_content(name,txt)
|
15
15
|
::Sys::Io::HxFile.save_content(name,txt)
|
16
|
-
|
16
|
+
true
|
17
17
|
end
|
18
18
|
|
19
19
|
def args
|
20
|
-
|
20
|
+
HxSys.args
|
21
21
|
end
|
22
22
|
|
23
23
|
def write_stdout(txt)
|
@@ -38,15 +38,28 @@ module Coopy
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def async
|
41
|
-
|
41
|
+
false
|
42
42
|
end
|
43
43
|
|
44
44
|
def exists(path)
|
45
|
-
|
45
|
+
File.exist?(path)
|
46
|
+
end
|
47
|
+
|
48
|
+
def is_tty_known
|
49
|
+
false
|
50
|
+
end
|
51
|
+
|
52
|
+
def is_tty
|
53
|
+
return true if HxSys.get_env("GIT_PAGER_IN_USE") == "true"
|
54
|
+
false
|
46
55
|
end
|
47
56
|
|
48
57
|
def open_sqlite_database(path)
|
49
|
-
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
|
61
|
+
def send_to_browser(html)
|
62
|
+
puts "do not know how to send to browser in this language"
|
50
63
|
end
|
51
64
|
|
52
65
|
haxe_me ["coopy", "TableIO"]
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class TableStream
|
6
|
+
|
7
|
+
def initialize(t)
|
8
|
+
@t = t
|
9
|
+
@at = -1
|
10
|
+
@h = t.get_height
|
11
|
+
@src = nil
|
12
|
+
if @h < 0
|
13
|
+
meta = t.get_meta
|
14
|
+
raise hx_raise("Cannot get meta information for table") if meta == nil
|
15
|
+
@src = meta.get_row_stream
|
16
|
+
raise hx_raise("Cannot iterate table") if @src == nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
attr_accessor :t
|
23
|
+
attr_accessor :at
|
24
|
+
attr_accessor :h
|
25
|
+
attr_accessor :src
|
26
|
+
attr_accessor :columns
|
27
|
+
attr_accessor :row
|
28
|
+
|
29
|
+
public
|
30
|
+
|
31
|
+
def fetch_columns
|
32
|
+
return @columns if @columns != nil
|
33
|
+
if @src != nil
|
34
|
+
@columns = @src.fetch_columns
|
35
|
+
return @columns
|
36
|
+
end
|
37
|
+
@columns = Array.new
|
38
|
+
begin
|
39
|
+
_g1 = 0
|
40
|
+
_g = @t.get_width
|
41
|
+
while(_g1 < _g)
|
42
|
+
i = _g1
|
43
|
+
_g1+=1
|
44
|
+
@columns.push(@t.get_cell(i,0))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
@columns
|
48
|
+
end
|
49
|
+
|
50
|
+
def fetch_row
|
51
|
+
return @src.fetch_row if @src != nil
|
52
|
+
return nil if @at >= @h
|
53
|
+
row = {}
|
54
|
+
begin
|
55
|
+
_g1 = 0
|
56
|
+
_g = @columns.length
|
57
|
+
while(_g1 < _g)
|
58
|
+
i = _g1
|
59
|
+
_g1+=1
|
60
|
+
begin
|
61
|
+
v = @t.get_cell(i,@at)
|
62
|
+
begin
|
63
|
+
value = v
|
64
|
+
row[@columns[i]] = value
|
65
|
+
end
|
66
|
+
v
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
row
|
71
|
+
end
|
72
|
+
|
73
|
+
def fetch
|
74
|
+
if @at == -1
|
75
|
+
@at+=1
|
76
|
+
self.fetch_columns if @src != nil
|
77
|
+
return true
|
78
|
+
end
|
79
|
+
if @src != nil
|
80
|
+
@at = 1
|
81
|
+
@row = self.fetch_row
|
82
|
+
return @row != nil
|
83
|
+
end
|
84
|
+
@at+=1
|
85
|
+
@at < @h
|
86
|
+
end
|
87
|
+
|
88
|
+
def get_cell(x)
|
89
|
+
return @columns[x] if @at == 0
|
90
|
+
return @row[@columns[x]] if @row != nil
|
91
|
+
@t.get_cell(x,@at)
|
92
|
+
end
|
93
|
+
|
94
|
+
def width
|
95
|
+
self.fetch_columns
|
96
|
+
@columns.length
|
97
|
+
end
|
98
|
+
|
99
|
+
haxe_me ["coopy", "TableStream"]
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
@@ -32,6 +32,7 @@ module Coopy
|
|
32
32
|
@v = t.get_cell_view
|
33
33
|
@codes = {}
|
34
34
|
@codes["header"] = "\x1B[0;1m"
|
35
|
+
@codes["meta"] = "\x1B[0;1m"
|
35
36
|
@codes["spec"] = "\x1B[35;1m"
|
36
37
|
@codes["add"] = "\x1B[32;1m"
|
37
38
|
@codes["conflict"] = "\x1B[33;1m"
|
@@ -74,7 +75,7 @@ module Coopy
|
|
74
75
|
@v = nil
|
75
76
|
@csv = nil
|
76
77
|
@codes = nil
|
77
|
-
|
78
|
+
txt
|
78
79
|
end
|
79
80
|
|
80
81
|
protected
|
@@ -101,7 +102,7 @@ module Coopy
|
|
101
102
|
else
|
102
103
|
val = cell.pretty_value
|
103
104
|
end
|
104
|
-
|
105
|
+
@csv.render_cell(@v,val)
|
105
106
|
end
|
106
107
|
|
107
108
|
def pick_sizes(t)
|
@@ -161,7 +162,7 @@ module Coopy
|
|
161
162
|
end
|
162
163
|
end
|
163
164
|
return nil if total > 130
|
164
|
-
|
165
|
+
sizes
|
165
166
|
end
|
166
167
|
|
167
168
|
haxe_me ["coopy", "TerminalDiffRender"]
|
data/lib/lib/coopy/unit.rb
CHANGED
@@ -24,7 +24,7 @@ module Coopy
|
|
24
24
|
|
25
25
|
def to_s
|
26
26
|
return _hx_str(::Coopy::Unit.describe(@p)) + "|" + _hx_str(::Coopy::Unit.describe(@l)) + ":" + _hx_str(::Coopy::Unit.describe(@r)) if @p >= -1
|
27
|
-
|
27
|
+
_hx_str(::Coopy::Unit.describe(@l)) + ":" + _hx_str(::Coopy::Unit.describe(@r))
|
28
28
|
end
|
29
29
|
|
30
30
|
def from_string(txt)
|
@@ -54,7 +54,27 @@ module Coopy
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
|
-
|
57
|
+
false
|
58
|
+
end
|
59
|
+
|
60
|
+
# protected - in ruby this doesn't play well with static/inline methods
|
61
|
+
|
62
|
+
def base26(num)
|
63
|
+
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
64
|
+
return "-" if num < 0
|
65
|
+
out = ""
|
66
|
+
begin
|
67
|
+
out = _hx_str(out) + _hx_str(alpha[num.remainder(26)])
|
68
|
+
num = (num / 26).floor - 1
|
69
|
+
end while(num >= 0)
|
70
|
+
out
|
71
|
+
end
|
72
|
+
|
73
|
+
public
|
74
|
+
|
75
|
+
def to_base26string
|
76
|
+
return _hx_str(self.base26(@p)) + "|" + _hx_str(self.base26(@l)) + ":" + _hx_str(self.base26(@r)) if @p >= -1
|
77
|
+
_hx_str(self.base26(@l)) + ":" + _hx_str(self.base26(@r))
|
58
78
|
end
|
59
79
|
|
60
80
|
# protected - in ruby this doesn't play well with static/inline methods
|
data/lib/lib/coopy/viterbi.rb
CHANGED
@@ -153,22 +153,22 @@ module Coopy
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
txt += " costs " + _hx_str(self.get_cost)
|
156
|
-
|
156
|
+
txt
|
157
157
|
end
|
158
158
|
|
159
159
|
def length
|
160
160
|
self.calculate_path if @index > 0
|
161
|
-
|
161
|
+
@index
|
162
162
|
end
|
163
163
|
|
164
164
|
def get(i)
|
165
165
|
self.calculate_path
|
166
|
-
|
166
|
+
@path.get(0,i)
|
167
167
|
end
|
168
168
|
|
169
169
|
def get_cost
|
170
170
|
self.calculate_path
|
171
|
-
|
171
|
+
@best_cost
|
172
172
|
end
|
173
173
|
|
174
174
|
haxe_me ["coopy", "Viterbi"]
|
data/lib/lib/haxe/ds/int_map.rb
CHANGED
@@ -230,7 +230,7 @@ module Format
|
|
230
230
|
def JsonPrinter._print(o,replacer = nil,space = nil)
|
231
231
|
printer = ::Haxe::Format::JsonPrinter.new(replacer,space)
|
232
232
|
printer.write("",o)
|
233
|
-
|
233
|
+
printer.buf.b
|
234
234
|
end
|
235
235
|
|
236
236
|
haxe_me ["haxe", "format", "JsonPrinter"]
|
data/lib/lib/haxe/io/bytes.rb
CHANGED
@@ -20,11 +20,11 @@ module Io
|
|
20
20
|
|
21
21
|
def get_string(pos,len)
|
22
22
|
raise hx_raise(::Haxe::Io::Error.outside_bounds) if pos < 0 || len < 0 || pos + len > @length
|
23
|
-
|
23
|
+
@b.byteslice(pos,len)
|
24
24
|
end
|
25
25
|
|
26
26
|
def Bytes.of_string(s)
|
27
|
-
|
27
|
+
::Haxe::Io::Bytes.new(s.bytesize,s)
|
28
28
|
end
|
29
29
|
|
30
30
|
haxe_me ["haxe", "io", "Bytes"]
|
data/lib/lib/haxe/io/eof.rb
CHANGED
data/lib/lib/haxe/io/output.rb
CHANGED
data/lib/lib/hx_overrides.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
h = date.get_hours
|
12
12
|
mi = date.get_minutes
|
13
13
|
s = date.get_seconds
|
14
|
-
|
14
|
+
_hx_str(date.get_full_year) + "-" + _hx_str((((m < 10) ? "0" + _hx_str(m) : "" + _hx_str(m)))) + "-" + _hx_str((((d < 10) ? "0" + _hx_str(d) : "" + _hx_str(d)))) + " " + _hx_str((((h < 10) ? "0" + _hx_str(h) : "" + _hx_str(h)))) + ":" + _hx_str((((mi < 10) ? "0" + _hx_str(mi) : "" + _hx_str(mi)))) + ":" + _hx_str((((s < 10) ? "0" + _hx_str(s) : "" + _hx_str(s))))
|
15
15
|
end
|
16
16
|
|
17
17
|
haxe_me ["HxOverrides"]
|
data/lib/lib/hx_sys.rb
CHANGED
@@ -4,7 +4,11 @@
|
|
4
4
|
class HxSys
|
5
5
|
|
6
6
|
def HxSys.args
|
7
|
-
|
7
|
+
ARGV
|
8
|
+
end
|
9
|
+
|
10
|
+
def HxSys.get_env(s)
|
11
|
+
getenv(s)
|
8
12
|
end
|
9
13
|
|
10
14
|
# protected - in ruby this doesn't play well with static/inline methods
|
@@ -27,7 +31,7 @@
|
|
27
31
|
end
|
28
32
|
end
|
29
33
|
return arg if ok
|
30
|
-
|
34
|
+
"\"" + _hx_str(arg.split("\"").join("\\\"")) + "\""
|
31
35
|
end
|
32
36
|
|
33
37
|
public
|
@@ -50,15 +54,15 @@
|
|
50
54
|
else
|
51
55
|
result = 1
|
52
56
|
end
|
53
|
-
|
57
|
+
result
|
54
58
|
end
|
55
59
|
|
56
60
|
def HxSys.stdout
|
57
|
-
|
61
|
+
::Sys::Io::FileOutput.new(STDOUT)
|
58
62
|
end
|
59
63
|
|
60
64
|
def HxSys.stderr
|
61
|
-
|
65
|
+
::Sys::Io::FileOutput.new(STDERR)
|
62
66
|
end
|
63
67
|
|
64
68
|
haxe_me ["Sys"]
|
data/lib/lib/lambda.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
i = _it._next
|
11
11
|
a.push(i)
|
12
12
|
end
|
13
|
-
|
13
|
+
a
|
14
14
|
end
|
15
15
|
|
16
16
|
def Lambda.map(it,f)
|
@@ -20,7 +20,7 @@
|
|
20
20
|
x = _it._next
|
21
21
|
l.add((f).call(x))
|
22
22
|
end
|
23
|
-
|
23
|
+
l
|
24
24
|
end
|
25
25
|
|
26
26
|
def Lambda.has(it,elt)
|
@@ -29,7 +29,7 @@
|
|
29
29
|
x = _it._next
|
30
30
|
return true if x == elt
|
31
31
|
end
|
32
|
-
|
32
|
+
false
|
33
33
|
end
|
34
34
|
|
35
35
|
haxe_me ["Lambda"]
|
data/lib/lib/list.rb
CHANGED
data/lib/lib/rb/ruby_iterator.rb
CHANGED
@@ -34,14 +34,14 @@ module Rb
|
|
34
34
|
def has_next
|
35
35
|
return @ref[:has_next].call if @at == -1
|
36
36
|
return @ref[:has_next][:call].call if @at == -2
|
37
|
-
|
37
|
+
@at < @len
|
38
38
|
end
|
39
39
|
|
40
40
|
def _next
|
41
41
|
return @ref[:_next].call if @at == -1
|
42
42
|
return @ref[:_next][:call].call if @at == -2
|
43
43
|
@at+=1
|
44
|
-
|
44
|
+
@ref.next
|
45
45
|
end
|
46
46
|
|
47
47
|
haxe_me ["rb", "RubyIterator"]
|