-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix stringOrNilMerge not calling unchangedBlock or mergedBlock after …
…successful string merge
- Loading branch information
Showing
4 changed files
with
30 additions
and
13 deletions.
There are no files selected for viewing
19 changes: 8 additions & 11 deletions
19
src/Squot.package/SquotMergeUtilities.class/class/stringMergeLeft.right.base.ifConflict..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
merging | ||
stringMergeLeft: leftString right: rightString base: baseString ifConflict: aBlock | ||
| diffResult | | ||
diffResult := Diff3 new | ||
file0: baseString lines; | ||
file1: leftString lines; | ||
file2: rightString lines; | ||
diffClass: HuntMcilroyDiff; | ||
merge: true. | ||
^ (diffResult size = 1 and: [diffResult first key = #ok]) | ||
ifTrue: [diffResult first value joinSeparatedBy: Character cr] | ||
ifFalse: [aBlock value: (SquotMergeConflict left: leftString right: rightString base: baseString)] | ||
stringMergeLeft: leftString right: rightString base: baseString ifConflict: conflictBlock | ||
^ self | ||
stringMergeLeft: leftString | ||
right: rightString | ||
base: baseString | ||
ifUnchanged: [leftString] | ||
ifMerged: [:merged | merged] | ||
ifConflict: conflictBlock |
17 changes: 17 additions & 0 deletions
17
...MergeUtilities.class/class/stringMergeLeft.right.base.ifUnchanged.ifMerged.ifConflict..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
merging | ||
stringMergeLeft: leftString right: rightString base: baseString ifUnchanged: unchangedBlock ifMerged: mergedBlock ifConflict: conflictBlock | ||
| leftLines diffResult | | ||
leftLines := leftString lines. | ||
diffResult := Diff3 new | ||
file0: baseString lines; | ||
file1: leftLines; | ||
file2: rightString lines; | ||
diffClass: HuntMcilroyDiff; | ||
merge: true. | ||
^ (diffResult size = 1 and: [diffResult first key = #ok]) | ||
ifFalse: [conflictBlock value: (SquotMergeConflict left: leftString right: rightString base: baseString)] | ||
ifTrue: [ | mergedLines | | ||
mergedLines := diffResult first value. | ||
mergedLines = leftLines | ||
ifTrue: [unchangedBlock value] | ||
ifFalse: [mergedBlock value: (mergedLines joinSeparatedBy: Character cr)]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters