Skip to content

Commit e4233de

Browse files
committed
Fix not preserving cases of ports
1 parent 1342d29 commit e4233de

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ Also see [./doc/braindump.md](./doc/braindump.md)
6464

6565
* Implement diffing of graph properties
6666
* Implement basic grouping/heuristics/context to make the diff easier to understand
67-
* Fix inconsistencies in casing for port names
6867

6968
### Later
7069

examples/connections.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
to: |
77
'default' -> IN read(ReadSomething)
88
read OUT -> IN unconnected(Frobnitzer)
9-
diff: "+ read out -> in unconnected"
9+
diff: "+ read OUT -> IN unconnected"
1010

1111
'removed 1 edge':
1212
format: 'fbp'
@@ -16,21 +16,21 @@
1616
to: |
1717
'default' -> IN read(ReadSomething)
1818
unconnected(Frobnitzer)
19-
diff: "- read out -> in unconnected"
19+
diff: "- read OUT -> IN unconnected"
2020

2121
'add a string IIP':
2222
format: 'fbp'
2323
from: |
2424
read(ReadSomething)
2525
to: |
2626
'myiip' -> read(ReadSomething)
27-
diff: '+ "myiip" -> in read'
27+
diff: '+ "myiip" -> IN read'
2828

2929
'remove a string IIP':
3030
format: 'fbp'
3131
from: |
3232
'myiip' -> read(ReadSomething)
3333
to: |
3434
read(ReadSomething)
35-
diff: '- "myiip" -> in read'
35+
diff: '- "myiip" -> IN read'
3636

examples/exported-ports.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
to: |
55
INPORT=read.IN:FILENAME
66
'default' -> IN read(ReadSomething)
7-
diff: "+ INPORT=read.in:filename"
7+
diff: "+ INPORT=read.IN:FILENAME"
88

99
'removed inport':
1010
from: |
1111
INPORT=read.IN:FILENAME
1212
'default' -> IN read(ReadSomething)
1313
to: |
1414
'default' -> IN read(ReadSomething)
15-
diff: "- INPORT=read.in:filename" #FIXME casing
15+
diff: "- INPORT=read.IN:FILENAME"
1616

1717
'renamed inport':
1818
from: |
1919
INPORT=read.IN:FILENAME
2020
'default' -> IN read(ReadSomething)
2121
to: |
22-
INPORT=read.IN:NEWFILENAME
22+
INPORT=read.IN:newfilename
2323
'default' -> IN read(ReadSomething)
24-
diff: ".rename INPORT=read.in:newfilename was INPORT=read.in:filename"
24+
diff: ".rename INPORT=read.IN:newfilename was INPORT=read.IN:FILENAME"
2525

2626
'added outport':
2727
from: |
@@ -31,7 +31,7 @@
3131
INPORT=read.IN:FILENAME
3232
OUTPORT=read.OUT:OUTPUT
3333
'default' -> IN read(ReadSomething)
34-
diff: "+ OUTPORT=read.out:output"
34+
diff: "+ OUTPORT=read.OUT:OUTPUT"
3535

3636
'removed outport':
3737
from: |
@@ -43,7 +43,7 @@
4343
INPORT=read.IN:FILENAME
4444
OUTPORT=read.OUT:OUTPUT
4545
'default' -> IN read(ReadSomething)
46-
diff: "- OUTPORT=read.error:error" #FIXME casing
46+
diff: "- OUTPORT=read.ERROR:ERROR"
4747

4848
'change target of outport':
4949
from: |
@@ -54,4 +54,4 @@
5454
INPORT=read.IN:FILENAME
5555
OUTPORT=read.OUTPUT:OUTPUT
5656
'default' -> IN read(ReadSomething)
57-
diff: ". OUTPORT=read.output:output was OUTPORT=read.out:output" #FIXME casing
57+
diff: ". OUTPORT=read.OUTPUT:OUTPUT was OUTPORT=read.OUT:OUTPUT"

examples/real-life.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
ledchain SHOWN -> IN dummy(Forward)
3939
ledchain READY -> IN dummyB(Forward)
4040
diff: |
41-
- "true" -> hwspi ledchain
42-
+ "2" -> pindata ledchain
43-
+ "3" -> pinclk ledchain
44-
- OUTPORT=ledchain.pixelset:pixelset
41+
- "true" -> HWSPI ledchain
42+
+ "2" -> PINDATA ledchain
43+
+ "3" -> PINCLK ledchain
44+
- OUTPORT=ledchain.PIXELSET:PIXELSET

src/diff.coffee

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ formatDiffTextual = (diff, options) ->
285285
return lines.join('\n')
286286

287287
# TODO: validate graph against schema
288-
readGraph = (contents, type) ->
288+
readGraph = (contents, type, options) ->
289289
fbp = require 'fbp'
290290
if type == 'fbp'
291-
graph = fbp.parse contents
291+
graph = fbp.parse contents, { caseSensitive: options.caseSensitive }
292292
else if type == 'object'
293293
graph = contents
294294
else
@@ -308,17 +308,18 @@ exports.diff = (from, to, options) ->
308308
options.format = 'object' if not options.format?
309309
options.fromFormat = options.format if not options.fromFormat?
310310
options.toFormat = options.format if not options.toFormat?
311+
options.caseSensitive = true if not options.caseSensitive?
311312

312-
f = readGraph from, options.fromFormat
313-
t = readGraph to, options.toFormat
313+
f = readGraph from, options.fromFormat, options
314+
t = readGraph to, options.toFormat, options
314315

315316
diff = calculateDiff f, t
316317
out = formatDiffTextual diff
317318

318319
return out
319320

320321
# node.js only
321-
readGraphFile = (filepath, callback) ->
322+
readGraphFile = (filepath, options, callback) ->
322323
fs = require 'fs'
323324
path = require 'path'
324325

@@ -332,9 +333,9 @@ readGraphFile = (filepath, callback) ->
332333
return callback null, graph
333334

334335
diffFiles = (fromPath, toPath, options, callback) ->
335-
readGraphFile fromPath, (err, fromGraph) ->
336+
readGraphFile fromPath, options, (err, fromGraph) ->
336337
return callback err if err
337-
readGraphFile toPath, (err, toGraph) ->
338+
readGraphFile toPath, options, (err, toGraph) ->
338339
return callback err if err
339340

340341
options.format = 'object' # already loaded

0 commit comments

Comments
 (0)