Skip to content

Commit

Permalink
Don't force metadata conversion for legacy squot file
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Oct 4, 2024
1 parent 97850ce commit 24cff90
Show file tree
Hide file tree
Showing 38 changed files with 118 additions and 113 deletions.

This file was deleted.

4 changes: 1 addition & 3 deletions src/Squot.package/SqueakWorkingCopy.class/instance/import.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
importing
import
self
checkForMissingHead;
importSquotContentsFromHeadCommit.
self checkForMissingHead.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"cloneFrom:" : "mad 5/23/2024 21:00",
"commitChangeSets:message:additionalParents:onlyAdditionalParents:" : "mad 4/29/2024 20:55",
"commitChangeSets:onCommit:message:additionalParents:onlyAdditionalParents:" : "mad 4/5/2024 00:19",
"commitImportedMappers:on:" : "mad 8/24/2024 18:59",
"computeRefsForCommits" : "mad 9/11/2023 16:47",
"createBranchNamed:at:" : "mad 10/16/2023 21:32",
"credentials" : "mad 9/18/2023 12:52",
Expand Down Expand Up @@ -97,10 +96,7 @@
"headRefName" : "mad 10/16/2023 22:47",
"ifRepositoryDoesNotExist:" : "mad 12/22/2023 17:47",
"imageHash" : "mad 11/28/2023 19:19",
"import" : "mad 4/29/2024 20:40",
"importSquotContents:from:into:fallbackSerializer:" : "mad 4/29/2024 21:39",
"importSquotContentsFromCommit:" : "mad 6/12/2024 13:37",
"importSquotContentsFromHeadCommit" : "mad 4/29/2024 20:55",
"import" : "mad 10/4/2024 15:01",
"initialRemoteRefNameFor:" : "mad 9/18/2023 13:58",
"initialize" : "mad 11/28/2023 19:19",
"initializeHead" : "mad 11/30/2023 13:17",
Expand Down Expand Up @@ -168,8 +164,6 @@
"requestUnmappedPathWithTitle:initialAnswer:" : "mad 7/3/2024 16:43",
"requestUnmappedPathWithTitle:initialAnswer:additionalOptions:" : "mad 7/3/2024 16:02",
"serializeChangeSets:onCommit:" : "mad 10/2/2024 18:35",
"serializerFromSquotContents:in:fallback:" : "mad 8/13/2024 18:04",
"serializerNameFromSquotContents:in:" : "mad 8/24/2024 16:28",
"setUpstreamRemoteName:andRef:for:" : "mad 12/13/2023 18:28",
"setUpstreamRemoteNameAndRef:for:" : "mad 12/8/2023 19:31",
"setUpstreamRemoteNameAndRefFor:" : "mad 12/13/2023 19:07",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ actionResetToCommit: aCommit
updateRef: headRef name
to: aCommit
message: 'reset ', aCommit hexHash.
self activeWorkingCopy import.
^ true
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
actions
actionSwitchToCommit: aCommit displayName: aString updateSymbolicHeadTo: anotherString
| workingCopy commit |
| workingCopy |
workingCopy := self activeWorkingCopyIfNilInformAnd: [^ self].
self warnIfImageNotClean: [^ self].
commit := aCommit.
(workingCopy importSquotContentsFromCommit: commit) ifNotNil: [:newCommit |
commit := newCommit.
(workingCopy isSqueakBranchRef: anotherString) ifTrue: [
workingCopy updateRef: anotherString toNewCommit: commit]].
(self
openDialogToMaterializeChangeSets: (workingCopy changeSetsFromImageToCommit: commit)
openDialogToMaterializeChangeSets: (workingCopy changeSetsFromImageToCommit: aCommit)
windowTitle: ('Switch to {1}: Load changes from the image to {1}'
format: {aString}))
then: [:dialog | workingCopy updateSymbolicHeadTo: anotherString].
4 changes: 2 additions & 2 deletions src/Squot.package/SquotBrowser.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"actionRenameActiveProject" : "mad 12/8/2023 18:46",
"actionResetToActiveCommit" : "mad 4/5/2024 19:34",
"actionResetToActiveCommitAndRestoreIt" : "mad 4/5/2024 19:35",
"actionResetToCommit:" : "mad 4/29/2024 22:52",
"actionResetToCommit:" : "mad 10/4/2024 15:04",
"actionResetToCommitAndRestoreIt:" : "mad 4/29/2024 21:44",
"actionRevert:" : "mad 4/5/2024 00:38",
"actionReword:" : "mad 4/5/2024 00:38",
Expand All @@ -71,7 +71,7 @@
"actionSwitchToActiveCommit" : "mad 4/5/2024 19:36",
"actionSwitchToBranch:" : "mad 4/7/2024 18:02",
"actionSwitchToCommit:" : "mad 4/7/2024 18:02",
"actionSwitchToCommit:displayName:updateSymbolicHeadTo:" : "mad 4/29/2024 21:26",
"actionSwitchToCommit:displayName:updateSymbolicHeadTo:" : "mad 10/4/2024 15:03",
"actionUnsetUpstreamOfActiveBranch" : "mad 4/5/2024 19:42",
"actionUnsetUpstreamOfBranch:" : "mad 4/5/2024 19:42",
"activeCommit" : "mad 9/14/2023 15:24",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mapper-importing
asMapperIn: aFilesystem at: aPath
asMapperFromReference: aReference
| packagePath |
packagePath := aPath parent.
packagePath := aReference path parent.
^ SquotCypressMapper
package: (MCPackage named: packagePath base)
path: packagePath parent
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"class" : {
"addPackageAndClassDirectoryForClass:to:" : "jr 9/20/2017 21:05",
"addPackageDirectoryForPackage:to:" : "jr 9/20/2017 21:01",
"asMapperIn:at:" : "mad 4/10/2024 19:38",
"asMapperFromReference:" : "mad 10/4/2024 14:59",
"rewritePath:for:" : "jr 1/25/2017 17:23",
"rewritePath:ofClass:" : "jr 9/20/2017 21:04",
"rewritePath:ofPackage:" : "jr 3/17/2019 00:19",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
operations
legacyReferencesIn: aFileSystem
^ {self legacyMappersFileReferenceIn: aFileSystem. self legacySquotFileReferenceIn: aFileSystem},
self loadLegacySquotContentsFileReferencesIn: aFileSystem
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
filesystem
legacySquotFileReferenceIn: aFileSystem
^ self mapper legacySquotFileReferenceIn: aFileSystem
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
filesystem
loadLegacySquotContentsFileReferencesIn: aFileSystem
^ self mapper loadLegacySquotContentsFileReferencesIn: aFileSystem
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ serializeInto: aFileSystem
| newMetadata |
newMetadata := self newMetadataAfterSerializeInto: aFileSystem.
(newMetadata equalsIncludingMapperVersions: self oldMetadata) ifTrue: [^ self].
(self legacyMappersFileReferenceIn: aFileSystem) ensureDeleted.
(self legacyReferencesIn: aFileSystem) do: #ensureDeleted.
(self metadataFileReferenceIn: aFileSystem) writeStreamDo: [:stream |
STON put: newMetadata onStreamPretty: stream].
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"canMapperBeRemovedAtAll" : "mad 8/15/2024 18:35",
"changes" : "mad 8/24/2024 19:01",
"legacyMappersFileReferenceIn:" : "mad 6/11/2024 19:51",
"legacyReferencesIn:" : "mad 10/4/2024 14:40",
"legacySquotFileReferenceIn:" : "mad 10/4/2024 14:39",
"loadLegacySquotContentsFileReferencesIn:" : "mad 10/4/2024 14:40",
"materializeIn:" : "mad 8/18/2024 18:47",
"metadataFileReferenceIn:" : "mad 6/11/2024 19:50",
"newMetadataAfterMaterializeIn:" : "mad 8/18/2024 19:43",
Expand All @@ -16,4 +19,4 @@
"oldMetadata:" : "mad 8/27/2024 20:52",
"propertyChangeSets" : "mad 8/24/2024 19:02",
"propertyChangeSets:" : "mad 8/24/2024 19:02",
"serializeInto:" : "mad 9/27/2024 18:25" } }
"serializeInto:" : "mad 10/4/2024 14:38" } }
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
testing
hasAnyFile: aFileSystem
^ (self hasMetadataFile: aFileSystem) or: [self hasLegacyMappersFile: aFileSystem]
^ (self hasMetadataFile: aFileSystem)
or: [self hasLegacyMappersFile: aFileSystem]
or: [self hasLegacySquotFile: aFileSystem]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
testing
hasLegacySquotFile: aFileSystem
^ (self legacySquotFileReferenceIn: aFileSystem) exists
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
legacySquotContentsFileBaseName
^ '.squot-contents'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
legacySquotFilePath
^ FSPath / '.squot'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
filesystem
legacySquotFileReferenceIn: aFileSystem
^ aFileSystem referenceTo: self legacySquotFilePath
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
metadata-loading
loadFallbackMappersFromFileSystem: aFileSystem
^ (self loadLegacyMappersFromFileSystem: aFileSystem) ifNil: [OrderedCollection new]
^ (self loadMappersFromLegacyMappersFileIn: aFileSystem)
ifNil: [(self loadMappersFromLegacySquotFileIn: aFileSystem)
ifNil: [OrderedCollection new]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
metadata-loading-legacy
loadLegacySerializerFromSquotContentsReference: aReference fallback: aSymbol
| serializerName |
serializerName := self loadLegacySerializerNameFromSquotContentsReference: aReference.
serializerName ifNil: [
self inform:
('Warning: failed to read serializer name from {1}
referenced in {2}. Assuming serializer {3}, as named in {2}.'
withoutLineEndings withBlanksCondensed
format: {
SquotPathUtilities asString: aReference path.
SquotPathUtilities asString: self legacySquotFilePath.
aSymbol}).
serializerName := aSymbol].
^ Environment current valueOf: serializerName
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
metadata-loading-legacy
loadLegacySerializerNameFromSquotContentsReference: aReference
| metadata |
aReference exists ifFalse: [^ nil].
metadata := aReference readStreamDo: [:stream | STON fromStream: stream].
^ (metadata at: #serializer ifAbsent: [^ nil]) asSymbol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
metadata-loading-legacy
loadLegacySquotContentsFileReferencesIn: aFileSystem
^ ((self loadSquotContentsReferencesAndSerializersFromLegacySquotFileIn: aFileSystem)
ifNil: [^ {}]) collect: #key
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
metadata-loading-legacy
loadMapperFromLegacySquotContentsReference: aReference fallbackSerializer: aSymbol
| serializer mapper |
serializer := self loadLegacySerializerFromSquotContentsReference: aReference fallback: aSymbol.
mapper := serializer asMapperFromReference: aReference.
mapper ifNil: [self inform:
('Warning: skipping unsupported serializer {1} at {2}.'
format: {serializer name. SquotPathUtilities asString: aReference path})].
^ mapper
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
metadata-loading
loadLegacyMappersFromFileSystem: aFileSystem
metadata-loading-legacy
loadMappersFromLegacyMappersFileIn: aFileSystem
| reference |
reference := self legacyMappersFileReferenceIn: aFileSystem.
reference exists ifFalse: [^ nil].
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
metadata-loading-legacy
loadMappersFromLegacySquotFileIn: aFileSystem
^ ((self loadSquotContentsReferencesAndSerializersFromLegacySquotFileIn: aFileSystem)
ifNil: [^ nil])
collect: [:referenceToSerializer |
self
loadMapperFromLegacySquotContentsReference: referenceToSerializer key
fallbackSerializer: referenceToSerializer value]
thenSelect: #notNil
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
metadata-loading-legacy
loadSquotContentsReferencesAndSerializersFromLegacySquotFileIn: aFileSystem
| reference loadOrder |
reference := self legacySquotFileReferenceIn: aFileSystem.
reference exists ifFalse: [^ nil].
loadOrder := reference readStreamDo: [:stream | STON fromStream: stream].
^ loadOrder associations collect: [:pathToSerializer | | path |
path := (SquotPathUtilities fromString: pathToSerializer key) / self legacySquotContentsFileBaseName.
(aFileSystem referenceTo: path) -> pathToSerializer value]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
accessing
mappedPaths
^ {self metadataFilePath. self legacyMappersFilePath}
^ {self metadataFilePath. self legacyMappersFilePath. self legacySquotFilePath}
18 changes: 14 additions & 4 deletions src/Squot.package/SquotMetadataMapper.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,31 @@
"changeSetsFromFSCommit:toImage:" : "mad 6/12/2024 13:59",
"changeSetsFromImage:toFSCommit:" : "mad 6/12/2024 14:00",
"changeSetsFromMetadata:toMetadata:old:common:new:in:" : "mad 10/2/2024 20:25",
"hasAnyFile:" : "mad 6/12/2024 13:37",
"hasAnyFile:" : "mad 10/4/2024 14:42",
"hasLegacyMappersFile:" : "mad 6/12/2024 13:36",
"hasLegacySquotFile:" : "mad 10/4/2024 14:42",
"hasMetadataFile:" : "mad 6/11/2024 18:34",
"legacyMappersFilePath" : "mad 6/11/2024 19:52",
"legacyMappersFileReferenceIn:" : "mad 6/11/2024 19:52",
"loadFallbackMappersFromFileSystem:" : "mad 8/24/2024 17:04",
"legacySquotContentsFileBaseName" : "mad 10/4/2024 15:32",
"legacySquotFilePath" : "mad 10/4/2024 14:28",
"legacySquotFileReferenceIn:" : "mad 10/4/2024 14:28",
"loadFallbackMappersFromFileSystem:" : "mad 10/4/2024 14:57",
"loadFallbackMetadataFromFileSystem:in:" : "mad 8/27/2024 21:08",
"loadLegacyMappersFromFileSystem:" : "mad 8/24/2024 16:58",
"loadLegacySerializerFromSquotContentsReference:fallback:" : "mad 10/4/2024 14:36",
"loadLegacySerializerNameFromSquotContentsReference:" : "mad 10/4/2024 14:37",
"loadLegacySquotContentsFileReferencesIn:" : "mad 10/4/2024 14:55",
"loadMapperFromLegacySquotContentsReference:fallbackSerializer:" : "mad 10/4/2024 14:57",
"loadMappersFromFileSystem:" : "mad 8/24/2024 17:06",
"loadMappersFromLegacyMappersFileIn:" : "mad 10/4/2024 14:53",
"loadMappersFromLegacySquotFileIn:" : "mad 10/4/2024 14:58",
"loadMetadataFileFromFileSystem:" : "mad 8/24/2024 16:56",
"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",
"mappedPaths" : "mad 8/24/2024 16:39",
"loadSquotContentsReferencesAndSerializersFromLegacySquotFileIn:" : "mad 10/4/2024 15:32",
"mappedPaths" : "mad 10/4/2024 16:04",
"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 Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mapper-importing
asMapperFromReference: aReference
^ nil

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"asMapperIn:at:" : "mad 3/19/2024 22:37",
"asMapperFromReference:" : "mad 10/4/2024 14:59",
"copySettingsFrom:to:" : "jr 5/27/2022 23:15",
"rewritePath:for:" : "jr 1/25/2017 17:21",
"writingBelow:" : "jr 3/8/2017 17:15" },
Expand Down
Loading

0 comments on commit 24cff90

Please sign in to comment.