Skip to content

Commit

Permalink
Treat all metadata-related files as mapped
Browse files Browse the repository at this point in the history
* Fix metadata files being treated as untracked files
* Add SquotPathPattern to match .squot-contents files
  • Loading branch information
MariusDoe committed Oct 4, 2024
1 parent 24cff90 commit b801220
Show file tree
Hide file tree
Showing 51 changed files with 165 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
paths
mappedPathPatterns
^ self allMappers gather: #mappedPathPatterns

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
paths
mapperThatMaps: aPath
^ self allMappers
detect: [:mapper | SquotPathUtilities path: aPath collidesWithAnyOf: mapper mappedPaths]
detect: [:mapper | mapper mappedPathPatterns anySatisfy: [:each | each matches: aPath]]
ifNone: [nil]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
paths
unmappedReferencesIn: anFSCommit do: aBlock
SquotUnmappedReferencesVisitor new
mappedPaths: self mappedPaths;
mappedPathPatterns: self mappedPathPatterns;
block: aBlock;
show: anFSCommit filesystem root.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@
"isSqueakRef:" : "mad 9/18/2023 13:58",
"isUnmappedPath:" : "mad 7/3/2024 15:30",
"lastImageHashForMigration" : "mad 11/29/2023 15:11",
"mappedPaths" : "mad 10/21/2023 22:58",
"mapperThatMaps:" : "mad 10/2/2024 17:09",
"mappedPathPatterns" : "mad 10/4/2024 15:33",
"mapperThatMaps:" : "mad 10/4/2024 15:36",
"mappers" : "mad 6/1/2023 22:35",
"mappers:" : "mad 3/19/2024 21:25",
"mappersOfKind:" : "mad 9/20/2023 17:29",
Expand Down Expand Up @@ -169,7 +169,7 @@
"setUpstreamRemoteNameAndRefFor:" : "mad 12/13/2023 19:07",
"splitRemoteRef:" : "mad 12/8/2023 19:45",
"unitOfWork" : "mad 6/3/2023 14:15",
"unmappedReferencesIn:do:" : "mad 10/21/2023 23:37",
"unmappedReferencesIn:do:" : "mad 10/4/2024 15:34",
"unregister" : "mad 9/19/2023 12:07",
"update:" : "mad 5/15/2024 21:21",
"updateHeadRefToNewCommit:" : "mad 4/29/2024 20:55",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
mappedPathPatterns
^ {SquotPathPattern exactMatch: self path}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"loadAssetFileFrom:" : "mad 9/29/2024 19:35",
"loadAssetFileFromImage:" : "mad 9/29/2024 16:35",
"loadAssetFromImage:" : "mad 9/29/2024 17:42",
"mappedPaths" : "mad 10/21/2023 22:53",
"mappedPathPatterns" : "mad 10/4/2024 15:33",
"materialize:in:" : "mad 9/29/2024 19:37",
"materializeAsset:in:" : "mad 9/29/2024 17:43",
"mergeAssetFile:into:withBase:" : "mad 9/29/2024 17:03",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
mappedPathPatterns
^ {SquotPathPattern startsWith: self packagePath}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"hexHashIn:" : "mad 10/1/2024 23:00",
"initialize" : "mad 4/25/2023 19:41",
"loadSnapshotFrom:" : "mad 10/16/2023 17:22",
"mappedPaths" : "mad 4/29/2024 22:21",
"mappedPathPatterns" : "mad 10/4/2024 15:33",
"mergeCommit:into:withBase:" : "mad 10/2/2024 00:31",
"operationFrom:to:" : "mad 8/13/2024 17:52",
"package" : "mad 4/21/2023 23:34",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
accessing
mappedPaths
mappedPathPatterns
self subclassResponsibility.
2 changes: 1 addition & 1 deletion src/Squot.package/SquotMapper.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"isTracked" : "mad 9/30/2024 15:01",
"isTracked:" : "mad 9/30/2024 15:01",
"isUntracked" : "mad 9/30/2024 15:41",
"mappedPaths" : "mad 10/21/2023 22:52",
"mappedPathPatterns" : "mad 10/4/2024 15:33",
"mergeCommit:into:withBase:" : "mad 9/6/2023 12:52",
"printDescriptionOn:" : "mad 10/2/2024 20:07",
"printOn:" : "mad 10/2/2024 20:07",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
mappedPathPatterns
^ (self trackedMappers copyWith: SquotMetadataMapper new) gather: #mappedPathPatterns
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
untracked-mappers
unmappedReferencesIn: aFileSystem do: aBlock
SquotUnmappedReferencesVisitor new
mappedPaths: (self trackedMappers gather: #mappedPaths);
mappedPathPatterns: self mappedPathPatterns;
block: aBlock;
show: aFileSystem root
3 changes: 2 additions & 1 deletion src/Squot.package/SquotMetadata.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"fromSton:" : "mad 8/16/2024 00:55",
"hasUntrackedMappers" : "mad 9/30/2024 15:40",
"hash" : "mad 9/27/2024 17:56",
"mappedPathPatterns" : "mad 10/4/2024 15:49",
"mappers" : "mad 6/12/2024 13:54",
"mappers:" : "mad 6/12/2024 13:54",
"name" : "mad 6/12/2024 13:54",
Expand All @@ -21,7 +22,7 @@
"setLegacyVersion" : "mad 8/27/2024 21:07",
"stonShouldWriteNilInstVars" : "mad 8/15/2024 18:54",
"trackedMappers" : "mad 9/30/2024 15:35",
"unmappedReferencesIn:do:" : "mad 10/2/2024 16:47",
"unmappedReferencesIn:do:" : "mad 10/4/2024 15:49",
"version" : "mad 6/12/2024 13:54",
"version:" : "mad 6/12/2024 13:55",
"withAddedMappers:" : "mad 10/2/2024 16:59",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
metadata-loading
loadMetadatasWithUntrackedMappersFromFSCommits: aCollection in: aWorkingCopy
| fileSystems mappedPaths metadatas unmappedPaths untrackedMappers |
| fileSystems mappedPathPatterns metadatas unmappedPaths untrackedMappers |
fileSystems := aCollection collect: #filesystem.
metadatas := fileSystems collect: [:fileSystem | self loadMetadataFromFileSystem: fileSystem in: aWorkingCopy].
mappedPaths := Set new.
metadatas do: [:metadata | metadata mappers do: [:mapper | mappedPaths addAll: mapper mappedPaths]].
mappedPathPatterns := Set new.
metadatas do: [:metadata | metadata mappers do: [:mapper | mappedPathPatterns addAll: mapper mappedPathPatterns]].
unmappedPaths := Set new.
metadatas with: fileSystems do: [:metadata :fileSystem |
metadata unmappedReferencesIn: fileSystem do: [:each | unmappedPaths add: each path]].
Expand All @@ -14,7 +14,7 @@ loadMetadatasWithUntrackedMappersFromFSCommits: aCollection in: aWorkingCopy
(self
shouldLoadUntrackedMappersAt: path
fromFSCommits: aCollection
withMappedPaths: mappedPaths) ifTrue: [
withMappedPathPatterns: mappedPathPatterns) ifTrue: [
fileSystems with: untrackedMappers do: [:fileSystem :mappers | | reference |
reference := fileSystem referenceTo: path.
reference exists ifTrue: [mappers add: (self untrackedMapperForReference: reference)]]]]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
accessing
mappedPathPatterns
^ {
SquotPathPattern exactMatch: self metadataFilePath.
SquotPathPattern exactMatch: self legacyMappersFilePath.
SquotPathPattern exactMatch: self legacySquotFilePath.
SquotPathPattern endsWith: {self legacySquotContentsFileBaseName}.
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
metadata-loading
shouldLoadUntrackedMappersAt: aPath fromFSCommits: fsCommitsCollection withMappedPaths: mappedPathsCollection
^ (SquotPathUtilities path: aPath collidesWithAnyOf: mappedPathsCollection)
shouldLoadUntrackedMappersAt: aPath fromFSCommits: fsCommitsCollection withMappedPathPatterns: mappedPathPatternsCollection
^ (mappedPathPatternsCollection anySatisfy: [:each | each matches: aPath])
or: [(self allHexHashesAt: aPath equalInFSCommits: fsCommitsCollection) not]
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
"loadMetadataFromFSCommit:in:" : "mad 6/12/2024 13:59",
"loadMetadataFromFileSystem:in:" : "mad 8/24/2024 17:04",
"loadMetadataFromWorkingCopy:" : "mad 6/11/2024 18:37",
"loadMetadatasWithUntrackedMappersFromFSCommits:in:" : "mad 10/2/2024 18:37",
"loadMetadatasWithUntrackedMappersFromFSCommits:in:" : "mad 10/4/2024 15:50",
"loadSquotContentsReferencesAndSerializersFromLegacySquotFileIn:" : "mad 10/4/2024 15:32",
"mappedPaths" : "mad 10/4/2024 16:04",
"mappedPathPatterns" : "mad 10/4/2024 15:33",
"mappersChangeSetFromMappers:removing:changeSets:" : "mad 10/1/2024 14:39",
"mergeCommit:into:withBase:" : "mad 2/20/2024 15:11",
"mergeCommit:into:withBase:in:" : "mad 10/2/2024 20:05",
Expand All @@ -50,6 +50,6 @@
"metadataFileReferenceIn:" : "mad 6/11/2024 18:33",
"nameChangeSetFrom:to:" : "mad 9/27/2024 18:09",
"printDescriptionOn:" : "mad 10/2/2024 20:13",
"shouldLoadUntrackedMappersAt:fromFSCommits:withMappedPaths:" : "mad 10/2/2024 17:08",
"shouldLoadUntrackedMappersAt:fromFSCommits:withMappedPathPatterns:" : "mad 10/4/2024 15:46",
"untrackedMapperForReference:" : "mad 10/2/2024 16:59",
"untrackedMapperForStream:" : "mad 10/2/2024 16:59" } }
Empty file.
7 changes: 7 additions & 0 deletions src/Squot.package/SquotPathPattern.class/class/contains..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
instance creation
contains: aPath
^ self new
path: aPath;
allowLeading;
allowTrailing;
yourself
7 changes: 7 additions & 0 deletions src/Squot.package/SquotPathPattern.class/class/endsWith..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
instance creation
endsWith: aPath
^ self new
path: aPath;
allowLeading;
disallowTrailing;
yourself
7 changes: 7 additions & 0 deletions src/Squot.package/SquotPathPattern.class/class/exactMatch..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
instance creation
exactMatch: aPath
^ self new
path: aPath;
disallowLeading;
disallowTrailing;
yourself
7 changes: 7 additions & 0 deletions src/Squot.package/SquotPathPattern.class/class/startsWith..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
instance creation
startsWith: aPath
^ self new
path: aPath;
disallowLeading;
allowTrailing;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
allowLeading
self allowsLeading: true.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
allowTrailing
self allowsTrailing: true.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
allowsLeading: aBoolean
allowsLeading := aBoolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
allowsLeading
^ allowsLeading
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
allowsTrailing: aBoolean
allowsTrailing := aBoolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
allowsTrailing
^ allowsTrailing
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
disallowLeading
self allowsLeading: false.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
disallowTrailing
self allowsTrailing: false.
11 changes: 11 additions & 0 deletions src/Squot.package/SquotPathPattern.class/instance/matches..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
testing
matches: aPath
self path size = 0 ifTrue: [^ self allowsLeading or: [self allowsTrailing] or: [aPath size = 0]].
aPath size < self path size ifTrue: [^ false].
^ self allowsLeading
ifFalse: [self matches: aPath startingAt: 1]
ifTrue: [ | lastMatchStart |
lastMatchStart := aPath size - self path size + 1.
self allowsTrailing
ifFalse: [self matches: aPath startingAt: lastMatchStart]
ifTrue: [(1 to: lastMatchStart) anySatisfy: [:index | self matches: aPath startingAt: index]]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
testing
matches: aPath startingAt: aNumber
| matchEnd |
matchEnd := aNumber + self path size - 1.
aPath size < matchEnd ifTrue: [^ false].
(self allowsTrailing not ==> [aPath size = matchEnd]) ifFalse: [^ false].
aNumber to: matchEnd do: [:index |
(aPath at: index) = (self path at: index - aNumber + 1) ifFalse: [^ false]].
^ true
3 changes: 3 additions & 0 deletions src/Squot.package/SquotPathPattern.class/instance/path..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
path: aPath
path := aPath
3 changes: 3 additions & 0 deletions src/Squot.package/SquotPathPattern.class/instance/path.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
path
^ path
19 changes: 19 additions & 0 deletions src/Squot.package/SquotPathPattern.class/methodProperties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"class" : {
"contains:" : "mad 10/4/2024 15:28",
"endsWith:" : "mad 10/4/2024 15:28",
"exactMatch:" : "mad 10/4/2024 15:10",
"startsWith:" : "mad 10/4/2024 15:28" },
"instance" : {
"allowLeading" : "mad 10/4/2024 15:24",
"allowTrailing" : "mad 10/4/2024 15:25",
"allowsLeading" : "mad 10/4/2024 15:24",
"allowsLeading:" : "mad 10/4/2024 15:25",
"allowsTrailing" : "mad 10/4/2024 15:24",
"allowsTrailing:" : "mad 10/4/2024 15:25",
"disallowLeading" : "mad 10/4/2024 15:25",
"disallowTrailing" : "mad 10/4/2024 15:25",
"matches:" : "mad 10/4/2024 15:42",
"matches:startingAt:" : "mad 10/4/2024 15:43",
"path" : "mad 10/4/2024 15:10",
"path:" : "mad 10/4/2024 15:10" } }
16 changes: 16 additions & 0 deletions src/Squot.package/SquotPathPattern.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"category" : "Squot-Mapper-Utilities",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"path",
"allowsLeading",
"allowsTrailing" ],
"name" : "SquotPathPattern",
"pools" : [
],
"super" : "Object",
"type" : "normal" }

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"fromString:" : "mad 11/21/2023 14:34",
"mainDelimiter" : "mad 11/21/2023 15:02",
"otherDelimiters" : "mad 11/21/2023 14:03",
"path:collidesWith:" : "mad 10/21/2023 23:04",
"path:collidesWithAnyOf:" : "mad 10/2/2024 17:07",
"path:containsOrEquals:" : "mad 10/21/2023 23:56",
"requestAbsolute:initialAnswer:" : "mad 11/21/2023 14:32",
"resolve:withRootAt:" : "mad 6/16/2024 21:49",
"toAbsolutePath:" : "mad 11/21/2023 14:34" },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
accessing
isUnmapped: aPath
^ self mappedPaths noneSatisfy: [:each |
SquotPathUtilities path: each containsOrEquals: aPath]
^ self mappedPathPatterns noneSatisfy: [:each | each matches: aPath]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
mappedPathPatterns: aCollection
mappedPathPatterns := aCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
mappedPathPatterns
^ mappedPathPatterns

This file was deleted.

Loading

0 comments on commit b801220

Please sign in to comment.