daff 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lib/coopy/compare_flags.rb +2 -0
- data/lib/lib/coopy/compare_table.rb +2 -2
- data/lib/lib/coopy/coopy.rb +9 -3
- data/lib/lib/coopy/index.rb +6 -1
- data/lib/lib/coopy/index_pair.rb +5 -3
- data/lib/lib/coopy/table_diff.rb +12 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f83e7c531044c8304fe471789f88f1a25ccc3618
|
4
|
+
data.tar.gz: a131ce2c9f90a56e11c1cf7f0f7cf7216db7668a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3125f64b0ebf44d43e3fa7fa68223d093803842e360680720a7fbdba7a250f872b4e906ce8adc8265abec8e5072608da4e330a3d95653581f00ff394232046f4
|
7
|
+
data.tar.gz: 3ddd77a33fd57de5db60e056a9b269e07f3294e5a670d9ee5334d14e78bc75c1cff10dd867e768795217262091ebc6f04d1571a6c9003b882edfb7ce96ead4e1
|
@@ -24,6 +24,7 @@ module Coopy
|
|
24
24
|
@tables = nil
|
25
25
|
@parent = nil
|
26
26
|
@count_like_a_spreadsheet = true
|
27
|
+
@ignore_whitespace = false
|
27
28
|
end
|
28
29
|
|
29
30
|
attr_accessor :ordered
|
@@ -45,6 +46,7 @@ module Coopy
|
|
45
46
|
attr_accessor :show_unchanged_meta
|
46
47
|
attr_accessor :parent
|
47
48
|
attr_accessor :count_like_a_spreadsheet
|
49
|
+
attr_accessor :ignore_whitespace
|
48
50
|
|
49
51
|
def filter(act,allow)
|
50
52
|
if @acts == nil
|
@@ -121,7 +121,7 @@ module Coopy
|
|
121
121
|
used = {}
|
122
122
|
used_reverse = {}
|
123
123
|
if ids != nil
|
124
|
-
index_top = ::Coopy::IndexPair.new
|
124
|
+
index_top = ::Coopy::IndexPair.new(@comp.compare_flags)
|
125
125
|
ids_as_map = {}
|
126
126
|
begin
|
127
127
|
_g2 = 0
|
@@ -260,7 +260,7 @@ module Coopy
|
|
260
260
|
kk >>= 1
|
261
261
|
at+=1
|
262
262
|
end
|
263
|
-
index = ::Coopy::IndexPair.new
|
263
|
+
index = ::Coopy::IndexPair.new(@comp.compare_flags)
|
264
264
|
begin
|
265
265
|
_g23 = 0
|
266
266
|
_g13 = active_columns.length
|
data/lib/lib/coopy/coopy.rb
CHANGED
@@ -499,6 +499,11 @@ module Coopy
|
|
499
499
|
@flags.add_table(args[i + 1])
|
500
500
|
args.slice!(i,2)
|
501
501
|
break
|
502
|
+
elsif tag == "-w" || tag == "--ignore-whitespace"
|
503
|
+
more = true
|
504
|
+
@flags.ignore_whitespace = true
|
505
|
+
args.slice!(i,1)
|
506
|
+
break
|
502
507
|
end
|
503
508
|
end
|
504
509
|
end
|
@@ -567,6 +572,7 @@ module Coopy
|
|
567
572
|
io.write_stderr(" --output-format [csv|tsv|ssv|json|copy|html]: set format for output\n")
|
568
573
|
io.write_stderr(" --table NAME: compare the named table, used with SQL sources\n")
|
569
574
|
io.write_stderr(" --unordered: assume row order is meaningless (default for json formats)\n")
|
575
|
+
io.write_stderr(" -w / --ignore-whitespace: ignore changes in leading/trailing whitespace\n")
|
570
576
|
io.write_stderr("\n")
|
571
577
|
io.write_stderr(" daff render [--output OUTPUT.html] [--css CSS.css] [--fragment] [--plain] diff.csv\n")
|
572
578
|
io.write_stderr(" --css CSS.css: generate a suitable css file to go with the html\n")
|
@@ -685,7 +691,7 @@ module Coopy
|
|
685
691
|
class << self
|
686
692
|
attr_accessor :version
|
687
693
|
end
|
688
|
-
@version = "1.3.
|
694
|
+
@version = "1.3.2"
|
689
695
|
|
690
696
|
def Coopy.diff_as_html(local,remote,flags = nil)
|
691
697
|
o = ::Coopy::Coopy.diff(local,remote,flags)
|
@@ -743,9 +749,9 @@ module Coopy
|
|
743
749
|
st = ::Coopy::SimpleTable.new(1,1)
|
744
750
|
v = ::Coopy::Viterbi.new
|
745
751
|
td = ::Coopy::TableDiff.new(nil,nil)
|
746
|
-
idx = ::Coopy::Index.new
|
747
|
-
dr = ::Coopy::DiffRender.new
|
748
752
|
cf = ::Coopy::CompareFlags.new
|
753
|
+
idx = ::Coopy::Index.new(cf)
|
754
|
+
dr = ::Coopy::DiffRender.new
|
749
755
|
hp = ::Coopy::HighlightPatch.new(nil,nil)
|
750
756
|
csv = ::Coopy::Csv.new
|
751
757
|
tm = ::Coopy::TableModifier.new(nil)
|
data/lib/lib/coopy/index.rb
CHANGED
@@ -4,13 +4,15 @@
|
|
4
4
|
module Coopy
|
5
5
|
class Index
|
6
6
|
|
7
|
-
def initialize
|
7
|
+
def initialize(flags)
|
8
8
|
@items = {}
|
9
9
|
@cols = Array.new
|
10
10
|
@keys = Array.new
|
11
11
|
@top_freq = 0
|
12
12
|
@height = 0
|
13
13
|
@hdr = 0
|
14
|
+
@ignore_whitespace = false
|
15
|
+
@ignore_whitespace = flags.ignore_whitespace if flags != nil
|
14
16
|
end
|
15
17
|
|
16
18
|
attr_accessor :items
|
@@ -24,6 +26,7 @@ module Coopy
|
|
24
26
|
attr_accessor :v
|
25
27
|
attr_accessor :indexed_table
|
26
28
|
attr_accessor :hdr
|
29
|
+
attr_accessor :ignore_whitespace
|
27
30
|
|
28
31
|
public
|
29
32
|
|
@@ -79,6 +82,7 @@ module Coopy
|
|
79
82
|
_g1+=1
|
80
83
|
d = t.get_cell(@cols[k],i)
|
81
84
|
txt = @v.to_s(d)
|
85
|
+
txt = txt.strip if @ignore_whitespace
|
82
86
|
wide += " // " if k > 0
|
83
87
|
next if txt == nil || txt == "" || txt == "null" || txt == "undefined"
|
84
88
|
wide += txt
|
@@ -101,6 +105,7 @@ module Coopy
|
|
101
105
|
k = _g1
|
102
106
|
_g1+=1
|
103
107
|
txt = row.get_row_string(@cols[k])
|
108
|
+
txt = txt.strip if @ignore_whitespace
|
104
109
|
wide += " // " if k > 0
|
105
110
|
next if txt == nil || txt == "" || txt == "null" || txt == "undefined"
|
106
111
|
wide += txt
|
data/lib/lib/coopy/index_pair.rb
CHANGED
@@ -4,9 +4,10 @@
|
|
4
4
|
module Coopy
|
5
5
|
class IndexPair
|
6
6
|
|
7
|
-
def initialize
|
8
|
-
@
|
9
|
-
@
|
7
|
+
def initialize(flags)
|
8
|
+
@flags = flags
|
9
|
+
@ia = ::Coopy::Index.new(flags)
|
10
|
+
@ib = ::Coopy::Index.new(flags)
|
10
11
|
@quality = 0
|
11
12
|
@hdr = 0
|
12
13
|
end
|
@@ -17,6 +18,7 @@ module Coopy
|
|
17
18
|
attr_accessor :ib
|
18
19
|
attr_accessor :hdr
|
19
20
|
attr_accessor :quality
|
21
|
+
attr_accessor :flags
|
20
22
|
|
21
23
|
public
|
22
24
|
|
data/lib/lib/coopy/table_diff.rb
CHANGED
@@ -743,6 +743,13 @@ module Coopy
|
|
743
743
|
end
|
744
744
|
end
|
745
745
|
|
746
|
+
def is_equal(v,aa,bb)
|
747
|
+
return lambda{|_this_| s = v.to_s(aa)
|
748
|
+
_r = s.strip}.call(self) == lambda{|_this_| s1 = v.to_s(bb)
|
749
|
+
_r2 = s1.strip}.call(self) if @flags.ignore_whitespace
|
750
|
+
v.equals(aa,bb)
|
751
|
+
end
|
752
|
+
|
746
753
|
def scan_row(unit,output,at,i)
|
747
754
|
begin
|
748
755
|
_g1 = 0
|
@@ -784,14 +791,14 @@ module Coopy
|
|
784
791
|
if have_pp
|
785
792
|
if !have_rr
|
786
793
|
dd = pp
|
787
|
-
elsif @v
|
794
|
+
elsif self.is_equal(@v,pp,rr)
|
788
795
|
dd = ll
|
789
796
|
else
|
790
797
|
dd = pp
|
791
798
|
dd_to = rr
|
792
799
|
have_dd_to = true
|
793
|
-
if
|
794
|
-
if
|
800
|
+
if !self.is_equal(@v,pp,ll)
|
801
|
+
if !self.is_equal(@v,pp,rr)
|
795
802
|
dd_to_alt = ll
|
796
803
|
have_dd_to_alt = true
|
797
804
|
end
|
@@ -800,7 +807,7 @@ module Coopy
|
|
800
807
|
elsif have_ll
|
801
808
|
if !have_rr
|
802
809
|
dd = ll
|
803
|
-
elsif @v
|
810
|
+
elsif self.is_equal(@v,ll,rr)
|
804
811
|
dd = ll
|
805
812
|
else
|
806
813
|
dd = ll
|
@@ -823,7 +830,7 @@ module Coopy
|
|
823
830
|
end
|
824
831
|
is_conflict = false
|
825
832
|
if have_dd_to_alt
|
826
|
-
is_conflict = true if
|
833
|
+
is_conflict = true if !self.is_equal(@v,dd_to,dd_to_alt)
|
827
834
|
end
|
828
835
|
if !is_conflict
|
829
836
|
cell = @builder.update(dd,dd_to)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Diff and patch tables
|
15
15
|
email:
|