From 332c78f6910d2b13c216a222a3aa46e1a6d7bfc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20D=C3=B6rbandt?= Date: Mon, 7 Oct 2024 15:07:40 +0200 Subject: [PATCH] WIP: collisions --- .../collidingMappersAfterSerializeInto..st | 7 +++++++ .../methodProperties.json | 1 + .../collidingMappersAfterSerializeInto..st | 14 ++++++++++++++ .../methodProperties.json | 1 + .../GSPathPattern.class/instance/collidesWith..st | 7 +++++++ .../GSPathPattern.class/methodProperties.json | 1 + 6 files changed, 31 insertions(+) create mode 100644 src/GitS-Core.package/GSMetadataChangeSet.class/instance/collidingMappersAfterSerializeInto..st create mode 100644 src/GitS-Core.package/GSMetadataMappersChangeSet.class/instance/collidingMappersAfterSerializeInto..st create mode 100644 src/GitS-Core.package/GSPathPattern.class/instance/collidesWith..st diff --git a/src/GitS-Core.package/GSMetadataChangeSet.class/instance/collidingMappersAfterSerializeInto..st b/src/GitS-Core.package/GSMetadataChangeSet.class/instance/collidingMappersAfterSerializeInto..st new file mode 100644 index 000000000..bd8af038f --- /dev/null +++ b/src/GitS-Core.package/GSMetadataChangeSet.class/instance/collidingMappersAfterSerializeInto..st @@ -0,0 +1,7 @@ +collisions +collidingMappersAfterSerializeInto: aFileSystem + | mappersChangeSet | + mappersChangeSet := self changeSets + detect: [:each | each isKindOf: SquotMetadataMappersChangeSet] + ifNone: [^ {}]. + ^ mappersChangeSet collidingMappersAfterSerializeInto: aFileSystem \ No newline at end of file diff --git a/src/GitS-Core.package/GSMetadataChangeSet.class/methodProperties.json b/src/GitS-Core.package/GSMetadataChangeSet.class/methodProperties.json index 3f26ebcec..19d9f80a0 100644 --- a/src/GitS-Core.package/GSMetadataChangeSet.class/methodProperties.json +++ b/src/GitS-Core.package/GSMetadataChangeSet.class/methodProperties.json @@ -7,6 +7,7 @@ "canMapperBeRemovedAfterSerializeInto:" : "mad 8/15/2024 18:35", "canMapperBeRemovedAtAll" : "mad 8/15/2024 18:35", "changes" : "mad 8/24/2024 19:01", + "collidingMappersAfterSerializeInto:" : "mad 10/7/2024 14:24", "legacyReferencesIn:" : "mad 10/9/2024 18:02", "materializeIn:" : "mad 8/18/2024 18:47", "metadataReferenceIn:" : "mad 10/9/2024 17:18", diff --git a/src/GitS-Core.package/GSMetadataMappersChangeSet.class/instance/collidingMappersAfterSerializeInto..st b/src/GitS-Core.package/GSMetadataMappersChangeSet.class/instance/collidingMappersAfterSerializeInto..st new file mode 100644 index 000000000..f4954de55 --- /dev/null +++ b/src/GitS-Core.package/GSMetadataMappersChangeSet.class/instance/collidingMappersAfterSerializeInto..st @@ -0,0 +1,14 @@ +collisions +collidingMappersAfterSerializeInto: aFileSystem + | mappers seen | + mappers := self newMappersAfterSerializeInto: aFileSystem. + seen := Dictionary new. + ^ Array streamContents: [:stream | + mappers do: [:mapperA | | pathPatternsA | + pathPatternsA := mapperA mappedPathPatterns. + seen keysAndValuesDo: [:mapperB :pathPatternsB | + (pathPatternsA anySatisfy: [:pathPatternA | + pathPatternsB anySatisfy: [:pathPatternB | + pathPatternA collidesWith: pathPatternB]]) + ifTrue: [stream nextPut: {mapperA. mapperB}]]. + seen at: mapperA put: pathPatternsA]] \ No newline at end of file diff --git a/src/GitS-Core.package/GSMetadataMappersChangeSet.class/methodProperties.json b/src/GitS-Core.package/GSMetadataMappersChangeSet.class/methodProperties.json index 41fa0a4ce..bbc441105 100644 --- a/src/GitS-Core.package/GSMetadataMappersChangeSet.class/methodProperties.json +++ b/src/GitS-Core.package/GSMetadataMappersChangeSet.class/methodProperties.json @@ -6,6 +6,7 @@ "allMappers" : "mad 9/30/2024 15:00", "bumpMapperVersionIfNecessary:" : "mad 9/27/2024 17:45", "changes" : "mad 10/9/2024 16:01", + "collidingMappersAfterSerializeInto:" : "mad 10/7/2024 14:32", "isEmpty" : "mad 10/1/2024 14:42", "mapperChangeSets" : "mad 2/20/2024 14:51", "mapperChangeSets:" : "mad 2/20/2024 14:51", diff --git a/src/GitS-Core.package/GSPathPattern.class/instance/collidesWith..st b/src/GitS-Core.package/GSPathPattern.class/instance/collidesWith..st new file mode 100644 index 000000000..3407be2f7 --- /dev/null +++ b/src/GitS-Core.package/GSPathPattern.class/instance/collidesWith..st @@ -0,0 +1,7 @@ +testing +collidesWith: aPathPattern + (self allowsLeading or: [aPathPattern allowsLeading]) + ifTrue: ["ignore these for now, currently only used to catch .squot-contents" ^ false]. + 1 to: (self path size clampHigh: aPathPattern path size) do: [:index | + (self path at: index) = (aPathPattern path at: index) ifFalse: [^ false]]. + ^ true \ No newline at end of file diff --git a/src/GitS-Core.package/GSPathPattern.class/methodProperties.json b/src/GitS-Core.package/GSPathPattern.class/methodProperties.json index 1621539b6..360fec658 100644 --- a/src/GitS-Core.package/GSPathPattern.class/methodProperties.json +++ b/src/GitS-Core.package/GSPathPattern.class/methodProperties.json @@ -11,6 +11,7 @@ "allowsLeading:" : "mad 10/4/2024 15:25", "allowsTrailing" : "mad 10/4/2024 15:24", "allowsTrailing:" : "mad 10/4/2024 15:25", + "collidesWith:" : "mad 10/7/2024 14:20", "disallowLeading" : "mad 10/4/2024 15:25", "disallowTrailing" : "mad 10/4/2024 15:25", "matches:" : "mad 10/4/2024 15:42",