From b5f086a63a656f3c63071e326b4334bd353d275e Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sat, 17 Jul 2021 22:04:36 +0200 Subject: [PATCH 01/43] Fix: merge error when there was a conflict in the class definitions MCPatchOperation cannot be compared with MCConflict, but since MCConflict does not override =, it can be compared with MCPatchOperations. It will use identity comparison. Fixes #325 --- .../instance/topNodesForMerge..st | 2 +- .../SquotPackageDiffNodesFactory.class/methodProperties.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Squot.package/SquotPackageDiffNodesFactory.class/instance/topNodesForMerge..st b/src/Squot.package/SquotPackageDiffNodesFactory.class/instance/topNodesForMerge..st index f9bb53d79..34fb12882 100644 --- a/src/Squot.package/SquotPackageDiffNodesFactory.class/instance/topNodesForMerge..st +++ b/src/Squot.package/SquotPackageDiffNodesFactory.class/instance/topNodesForMerge..st @@ -8,7 +8,7 @@ topNodesForMerge: aSquotPackageMerge classOperation := eachGroup detect: [:each | each definition isClassDefinition] ifNone: []. classOperation ifNil: [eachGroup] - ifNotNil: [{classOperation}, (eachGroup copyWithout: classOperation)]]. + ifNotNil: [{classOperation}, (eachGroup reject: [:each | classOperation = each "The other way around does not work because if classOperation is a MCConflict, it cannot be compared from an MCPatchOperation"])]]. "Show classes before Organization and Scripts." topNodes := (((groups associations select: [:each | each value first definition squotBelongsToClass]) collect: [:eachClassAndOperations | diff --git a/src/Squot.package/SquotPackageDiffNodesFactory.class/methodProperties.json b/src/Squot.package/SquotPackageDiffNodesFactory.class/methodProperties.json index f32c823d9..a94d1b638 100644 --- a/src/Squot.package/SquotPackageDiffNodesFactory.class/methodProperties.json +++ b/src/Squot.package/SquotPackageDiffNodesFactory.class/methodProperties.json @@ -6,4 +6,4 @@ "diffNodeForClass:operationsAndConflicts:modifying:" : "jr 11/29/2020 21:36", "nodeFor:from:" : "jr 11/29/2020 21:36", "topNodesForDiff:" : "jr 11/29/2020 20:28", - "topNodesForMerge:" : "jr 11/29/2020 21:36" } } + "topNodesForMerge:" : "jr 7/17/2021 19:54" } } From 03e257162c0ec07e72a595163c7a393d4c105092 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sat, 17 Jul 2021 22:22:09 +0200 Subject: [PATCH 02/43] Implement and fix object removals --- .../instance/removeObjectNamed..st | 4 ++++ .../SquotMutableObjectGraph.class/methodProperties.json | 3 ++- .../instance/mergeObject.with.basedOn..st | 2 +- .../SquotObjectGraphMerge.class/methodProperties.json | 2 +- .../instance/mirrorOf.reachedVia.from..st | 4 ++-- .../SquotObjectGraphMirror.class/methodProperties.json | 2 +- .../instance/applyToShadowNamed.inGraph..st | 5 +++++ .../SquotObjectRemoval.class/instance/object.st | 3 +++ .../SquotObjectRemoval.class/instance/squotApplyTo..st | 4 ++++ .../instance/squotChangeAsStringOrText.st | 3 +++ .../SquotObjectRemoval.class/methodProperties.json | 6 +++++- .../SquotPatcher.class/instance/apply.toLoadedGraph..st | 2 +- src/Squot.package/SquotPatcher.class/methodProperties.json | 2 +- 13 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 src/Squot.package/SquotMutableObjectGraph.class/instance/removeObjectNamed..st create mode 100644 src/Squot.package/SquotObjectRemoval.class/instance/applyToShadowNamed.inGraph..st create mode 100644 src/Squot.package/SquotObjectRemoval.class/instance/object.st create mode 100644 src/Squot.package/SquotObjectRemoval.class/instance/squotApplyTo..st create mode 100644 src/Squot.package/SquotObjectRemoval.class/instance/squotChangeAsStringOrText.st diff --git a/src/Squot.package/SquotMutableObjectGraph.class/instance/removeObjectNamed..st b/src/Squot.package/SquotMutableObjectGraph.class/instance/removeObjectNamed..st new file mode 100644 index 000000000..3290e8148 --- /dev/null +++ b/src/Squot.package/SquotMutableObjectGraph.class/instance/removeObjectNamed..st @@ -0,0 +1,4 @@ +removing +removeObjectNamed: name + objectNames removeKey: (objects removeKey: name ifAbsent: []) ifAbsent: []. + objectNames removeKey: (shadows removeKey: name ifAbsent: []) ifAbsent: []. \ No newline at end of file diff --git a/src/Squot.package/SquotMutableObjectGraph.class/methodProperties.json b/src/Squot.package/SquotMutableObjectGraph.class/methodProperties.json index 935e5c31e..b53a4ea66 100644 --- a/src/Squot.package/SquotMutableObjectGraph.class/methodProperties.json +++ b/src/Squot.package/SquotMutableObjectGraph.class/methodProperties.json @@ -12,4 +12,5 @@ "ifNecessaryAssignNameToShadow:" : "jr 4/8/2018 00:37", "mutableCopy" : "jr 7/30/2017 02:58", "nameOf:ifAbsentAssign:" : "jr 9/25/2019 20:29", - "refreshStartShadow" : "jr 4/7/2019 20:57" } } + "refreshStartShadow" : "jr 4/7/2019 20:57", + "removeObjectNamed:" : "jr 7/17/2021 21:05" } } diff --git a/src/Squot.package/SquotObjectGraphMerge.class/instance/mergeObject.with.basedOn..st b/src/Squot.package/SquotObjectGraphMerge.class/instance/mergeObject.with.basedOn..st index 293295e56..61db21f33 100644 --- a/src/Squot.package/SquotObjectGraphMerge.class/instance/mergeObject.with.basedOn..st +++ b/src/Squot.package/SquotObjectGraphMerge.class/instance/mergeObject.with.basedOn..st @@ -21,7 +21,7 @@ mergeObject: workingObject with: incomingObject basedOn: baseObject ifNotNil: ["incoming removal" workingObject = baseObject - ifTrue: [containerModifications at: name put: (SquotObjectRemoval of: working)] + ifTrue: [containerModifications at: name put: (SquotObjectRemoval of: workingObject)] ifFalse: [containerConflicts at: name put: (SquotObjectReferenceConflict key: name base: baseObject working: workingObject incoming: nil)]]] ifNotNil: ["merge editions" diff --git a/src/Squot.package/SquotObjectGraphMerge.class/methodProperties.json b/src/Squot.package/SquotObjectGraphMerge.class/methodProperties.json index 63b61fa54..13c6c4e3d 100644 --- a/src/Squot.package/SquotObjectGraphMerge.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphMerge.class/methodProperties.json @@ -12,7 +12,7 @@ "initializeSquotDiffNodes:with:" : "jr 11/1/2020 18:46", "keyOf:ifAbsent:" : "jr 8/4/2019 00:18", "mergeAt:" : "jr 9/23/2019 22:13", - "mergeObject:with:basedOn:" : "jr 12/23/2020 22:41", + "mergeObject:with:basedOn:" : "jr 7/17/2021 20:55", "mergeOfStartObject" : "jr 12/24/2020 00:24", "mergeStartReferencesToStart:" : "jr 12/24/2020 00:25", "modifications" : "jr 7/30/2019 01:25", diff --git a/src/Squot.package/SquotObjectGraphMirror.class/instance/mirrorOf.reachedVia.from..st b/src/Squot.package/SquotObjectGraphMirror.class/instance/mirrorOf.reachedVia.from..st index c6a073afc..81af63556 100644 --- a/src/Squot.package/SquotObjectGraphMirror.class/instance/mirrorOf.reachedVia.from..st +++ b/src/Squot.package/SquotObjectGraphMirror.class/instance/mirrorOf.reachedVia.from..st @@ -7,9 +7,9 @@ mirrorOf: anObject reachedVia: aReference from: aGraphDiffOrGraph at: anObject ifAbsent: [(self search: aGraphDiffOrGraph for: anObject) ifNil: [(notFound := Warning new messageText: 'Object not found in graph') signal. - "Assume that it is the new object from a replacement" + "Assume that it is the new object from a replacement, or that it is an old object that has to be removed." self defaultMirrorOf: anObject]]] on: Warning do: - [:w | (w == notFound and: [aReference objectDiff class = SquotObjectReplacement]) + [:w | (w == notFound and: [aReference objectDiff class = SquotObjectReplacement or: [aReference objectDiff class = SquotObjectRemoval]]) ifTrue: [w resume] ifFalse: [w pass]] \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json b/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json index 21aa26302..38c6cd670 100644 --- a/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json @@ -4,7 +4,7 @@ "instance" : { "capture:with:" : "jr 6/17/2021 00:38", "defaultMirrorOf:" : "jr 7/4/2021 19:40", - "mirrorOf:reachedVia:from:" : "jr 7/4/2021 19:50", + "mirrorOf:reachedVia:from:" : "jr 7/17/2021 21:11", "referencesFrom:" : "jr 6/27/2021 22:20", "search:for:" : "jr 7/4/2021 19:41", "shouldObjectHaveNameAssigned:" : "jr 6/20/2021 18:52" } } diff --git a/src/Squot.package/SquotObjectRemoval.class/instance/applyToShadowNamed.inGraph..st b/src/Squot.package/SquotObjectRemoval.class/instance/applyToShadowNamed.inGraph..st new file mode 100644 index 000000000..af898d808 --- /dev/null +++ b/src/Squot.package/SquotObjectRemoval.class/instance/applyToShadowNamed.inGraph..st @@ -0,0 +1,5 @@ +Squot-diff-patching +applyToShadowNamed: name inGraph: anObjectGraph + self assert: (anObjectGraph shadowNamed: name) = object. + anObjectGraph removeObjectNamed: name. + ^ nil \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRemoval.class/instance/object.st b/src/Squot.package/SquotObjectRemoval.class/instance/object.st new file mode 100644 index 000000000..ab44a2bb9 --- /dev/null +++ b/src/Squot.package/SquotObjectRemoval.class/instance/object.st @@ -0,0 +1,3 @@ +accessing +object + ^ object \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRemoval.class/instance/squotApplyTo..st b/src/Squot.package/SquotObjectRemoval.class/instance/squotApplyTo..st new file mode 100644 index 000000000..8dfe0ab20 --- /dev/null +++ b/src/Squot.package/SquotObjectRemoval.class/instance/squotApplyTo..st @@ -0,0 +1,4 @@ +Squot-diff-patching +squotApplyTo: aShadow + "aShadow shall be removed from the object graph. But that does not mean that the object must be changed. Leave it to the garbage collector." + self isThisEverCalled. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRemoval.class/instance/squotChangeAsStringOrText.st b/src/Squot.package/SquotObjectRemoval.class/instance/squotChangeAsStringOrText.st new file mode 100644 index 000000000..4884b0aa8 --- /dev/null +++ b/src/Squot.package/SquotObjectRemoval.class/instance/squotChangeAsStringOrText.st @@ -0,0 +1,3 @@ +converting +squotChangeAsStringOrText + ^ 'Removed object: ', object printString \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRemoval.class/methodProperties.json b/src/Squot.package/SquotObjectRemoval.class/methodProperties.json index 7e86e1496..da6581595 100644 --- a/src/Squot.package/SquotObjectRemoval.class/methodProperties.json +++ b/src/Squot.package/SquotObjectRemoval.class/methodProperties.json @@ -2,4 +2,8 @@ "class" : { "of:" : "jr 12/7/2020 21:48" }, "instance" : { - "setObject:" : "jr 12/7/2020 21:58" } } + "applyToShadowNamed:inGraph:" : "jr 7/17/2021 21:06", + "object" : "jr 7/17/2021 20:59", + "setObject:" : "jr 12/7/2020 21:58", + "squotApplyTo:" : "jr 7/17/2021 21:06", + "squotChangeAsStringOrText" : "jr 7/17/2021 20:58" } } diff --git a/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st b/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st index 5e440fc5b..5fa06da02 100644 --- a/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st +++ b/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st @@ -55,7 +55,7 @@ apply: aGraphDiff toLoadedGraph: anObjectGraph (mirror shouldObjectHaveNameAssigned: object) ifTrue: [name - ifNil: [self error: 'Object has no name but it should have'] + ifNil: ["Object should normally have a name, but maybe it is just materialized to be removed from a collection. Then it does not need to get a name in the registry or the new graph."] ifNotNil: [objectRegistry assign: name to: object]]. name ifNotNil: [anObjectGraph assign: name to: object]. "Update references to object." diff --git a/src/Squot.package/SquotPatcher.class/methodProperties.json b/src/Squot.package/SquotPatcher.class/methodProperties.json index c33a33983..8e877bada 100644 --- a/src/Squot.package/SquotPatcher.class/methodProperties.json +++ b/src/Squot.package/SquotPatcher.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "apply:toLoadedGraph:" : "jr 7/4/2021 22:55", + "apply:toLoadedGraph:" : "jr 7/17/2021 21:15", "applying:fill:reachedVia:into:reflectedIn:ifDeferredUntilActivated:ifNotTreatedYet:" : "jr 6/27/2021 23:15", "fill:reachedVia:into:reflectedIn:ifDeferredUntilActivated:ifUnavailable:" : "jr 6/13/2021 17:35", "fillInReferencesOf:reflectedIn:from:reflectedIn:unavailableReferencesDo:" : "jr 6/13/2021 17:35", From 138b6c985f37b5408c5d2f89b19b5e03c56bd3e7 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sat, 17 Jul 2021 22:27:43 +0200 Subject: [PATCH 03/43] Fix: merged artifacts erroneously appeared as unloaded Make it possible that the SquotLoadedArtifact is the working artifact in a SquotArtifactMerge. To that end, extract the call to #updateRightArtifacts from #buildPatch and rather call it explicitly in cases where the right side is not given. Curiously, something about this or the previous commit about SquotObjectRemoval seems to have fixed the inconsistent object graphs for file-based repositories. But not for the SquotInMemoryRepository. --- .../instance/save.st | 2 +- .../methodProperties.json | 2 +- .../instance/applyDiffToWorkingCopy..st | 1 + .../methodProperties.json | 2 +- .../instance/selectedPatch.st | 4 +++- .../SquotChangesChooser.class/methodProperties.json | 2 +- .../instance/patchAddingArtifactAt..st | 2 +- .../instance/patchChangingUnloadedArtifactAt..st | 1 + .../instance/patchRemovingArtifactAt..st | 1 + .../instance/patchWithLoadOrderChange.st | 1 + .../instance/patchWithLoadOrderChangeRegression1.st | 2 +- .../instance/patchWithTwoChangedArtifacts.st | 1 + .../methodProperties.json | 12 ++++++------ .../instance/prepareSave.st | 2 +- .../methodProperties.json | 2 +- .../instance/testApplyPatch.st | 1 + .../SquotImageStoreTest.class/methodProperties.json | 2 +- .../instance/expectedFailures.st | 6 ++++++ .../methodProperties.json | 1 + .../instance/mergeWith.basedOn..st | 5 ++++- .../SquotLiveArtifact.class/methodProperties.json | 2 +- .../instance/privateResolvedPatch.st | 4 +++- .../SquotMerge.class/methodProperties.json | 2 +- .../SquotPatch.class/class/noChangesTo..st | 2 +- .../SquotPatch.class/methodProperties.json | 2 +- .../SquotPatchBuilder.class/instance/buildPatch.st | 6 +++++- .../SquotPatchBuilder.class/methodProperties.json | 2 +- ...tCorrectLoadOrderAfterExcludedArtifactAddition.st | 2 +- ...stCorrectLoadOrderAfterExcludedArtifactRemoval.st | 2 +- ...ludedArtifactRemovalAndSimultaneousOrderChange.st | 2 +- ...adOrderAfterExcludedArtifactRemovalAtBeginning.st | 2 +- ...dedArtifactAdditionAndSimultaneousOrderChange2.st | 1 + .../methodProperties.json | 10 +++++----- .../instance/hasSameStartObjectAs..st | 7 +++---- .../SquotShadowGraph.class/methodProperties.json | 2 +- .../SquotWorkingCopy.class/instance/loadArtifact..st | 1 + .../loadArtifactInteractively.ifCanceled..st | 1 + .../SquotWorkingCopy.class/methodProperties.json | 4 ++-- .../instance/mergeDiffWith.basedOn..st | 5 +++++ .../instance/mergeWith.basedOn..st | 2 +- .../methodProperties.json | 3 ++- .../instance/expectedFailures.st | 3 +-- .../instance/testAdditionNotLoaded.st | 2 +- .../testRemovedUnsavedArtifactStaysRemoved.st | 1 + .../SquotWorkingCopyTest.class/methodProperties.json | 6 +++--- 45 files changed, 80 insertions(+), 48 deletions(-) create mode 100644 src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st create mode 100644 src/Squot.package/SquotWorkingCopyArtifact.class/instance/mergeDiffWith.basedOn..st diff --git a/src/Squit.package/SquitInteractivePullFromUpstream.class/instance/save.st b/src/Squit.package/SquitInteractivePullFromUpstream.class/instance/save.st index aa1509566..ccc82ec37 100644 --- a/src/Squit.package/SquitInteractivePullFromUpstream.class/instance/save.st +++ b/src/Squit.package/SquitInteractivePullFromUpstream.class/instance/save.st @@ -7,6 +7,6 @@ save (self workingCopy newInteractiveSaveOperation title: 'Save the merge of ', localHistorian upstreamTrackingHistorian shortName; message: 'Merge branch ''', (localHistorian repository historianNamed: localHistorian upstreamHistorianName) shortName, ''' of ', localHistorian upstreamRemote url, ' into ', localHistorian shortName; - patch: savePatch buildPatch; + patch: (savePatch updateRightArtifacts; buildPatch); applyToWorkingCopy)] on: BrokenPromise "cancelled" do: [:e | e ifNotError: [^ nil]]. \ No newline at end of file diff --git a/src/Squit.package/SquitInteractivePullFromUpstream.class/methodProperties.json b/src/Squit.package/SquitInteractivePullFromUpstream.class/methodProperties.json index 02fa994b9..c4deda855 100644 --- a/src/Squit.package/SquitInteractivePullFromUpstream.class/methodProperties.json +++ b/src/Squit.package/SquitInteractivePullFromUpstream.class/methodProperties.json @@ -5,4 +5,4 @@ "fetchFromUpstream" : "jr 8/2/2020 11:33", "merge" : "jr 11/29/2020 23:50", "pull" : "jr 11/29/2020 23:56", - "save" : "jr 11/6/2020 22:40" } } + "save" : "jr 7/17/2021 20:37" } } diff --git a/src/Squot.package/SquotArtifactDiffTest.class/instance/applyDiffToWorkingCopy..st b/src/Squot.package/SquotArtifactDiffTest.class/instance/applyDiffToWorkingCopy..st index 55485e92c..790d1a9e9 100644 --- a/src/Squot.package/SquotArtifactDiffTest.class/instance/applyDiffToWorkingCopy..st +++ b/src/Squot.package/SquotArtifactDiffTest.class/instance/applyDiffToWorkingCopy..st @@ -4,4 +4,5 @@ applyDiffToWorkingCopy: anArtifactDiff applyPatch: (workingCopy newPatchBuilder addDiff: anArtifactDiff; + updateRightArtifacts; buildPatch). \ No newline at end of file diff --git a/src/Squot.package/SquotArtifactDiffTest.class/methodProperties.json b/src/Squot.package/SquotArtifactDiffTest.class/methodProperties.json index c321d1ec1..395ce1bb5 100644 --- a/src/Squot.package/SquotArtifactDiffTest.class/methodProperties.json +++ b/src/Squot.package/SquotArtifactDiffTest.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "applyDiffToWorkingCopy:" : "jr 11/7/2020 23:21", + "applyDiffToWorkingCopy:" : "jr 7/17/2021 20:37", "createWorkingCopyWithObjectAt:" : "jr 11/7/2020 23:16", "testAdditionsAreLoadedByDefault" : "jr 11/7/2020 23:22", "testAdditionsCanBeUnloaded" : "jr 11/7/2020 23:22", diff --git a/src/Squot.package/SquotChangesChooser.class/instance/selectedPatch.st b/src/Squot.package/SquotChangesChooser.class/instance/selectedPatch.st index d9256cf24..cb3406690 100644 --- a/src/Squot.package/SquotChangesChooser.class/instance/selectedPatch.st +++ b/src/Squot.package/SquotChangesChooser.class/instance/selectedPatch.st @@ -1,4 +1,6 @@ results selectedPatch self accepted ifFalse: [^ self error: 'Should not ask for patch if selection was aborted']. - ^ editedPatch buildPatch \ No newline at end of file + ^ editedPatch + updateRightArtifacts; + buildPatch \ No newline at end of file diff --git a/src/Squot.package/SquotChangesChooser.class/methodProperties.json b/src/Squot.package/SquotChangesChooser.class/methodProperties.json index 662154134..7188b0d67 100644 --- a/src/Squot.package/SquotChangesChooser.class/methodProperties.json +++ b/src/Squot.package/SquotChangesChooser.class/methodProperties.json @@ -63,7 +63,7 @@ "selectedDiffNodeIsIncluded" : "jr 9/25/2020 18:28", "selectedNode" : "jr 9/25/2020 18:28", "selectedNodePath:" : "jr 9/26/2020 14:03", - "selectedPatch" : "jr 9/25/2020 18:28", + "selectedPatch" : "jr 7/17/2021 20:30", "toggleLoadSelectedNode" : "jr 11/18/2020 15:03", "unignoreSelectedNode" : "jr 9/25/2020 18:28", "updateRootNodesAfterLoadOrderChange" : "jr 11/3/2020 22:04", diff --git a/src/Squot.package/SquotChangesChooserTest.class/instance/patchAddingArtifactAt..st b/src/Squot.package/SquotChangesChooserTest.class/instance/patchAddingArtifactAt..st index 1a422f12f..68480dcff 100644 --- a/src/Squot.package/SquotChangesChooserTest.class/instance/patchAddingArtifactAt..st +++ b/src/Squot.package/SquotChangesChooserTest.class/instance/patchAddingArtifactAt..st @@ -2,4 +2,4 @@ test objects patchAddingArtifactAt: path | artifact | artifact := SquotArtifact new path: path; content: SquotArtifactContentMock new. - ^ SquotPatch builder addDiff: (SquotArtifactAddition of: artifact); buildPatch. \ No newline at end of file + ^ SquotPatch builder addDiff: (SquotArtifactAddition of: artifact); updateRightArtifacts; buildPatch. \ No newline at end of file diff --git a/src/Squot.package/SquotChangesChooserTest.class/instance/patchChangingUnloadedArtifactAt..st b/src/Squot.package/SquotChangesChooserTest.class/instance/patchChangingUnloadedArtifactAt..st index cfdd3d543..9a3ce8dc6 100644 --- a/src/Squot.package/SquotChangesChooserTest.class/instance/patchChangingUnloadedArtifactAt..st +++ b/src/Squot.package/SquotChangesChooserTest.class/instance/patchChangingUnloadedArtifactAt..st @@ -9,4 +9,5 @@ patchChangingUnloadedArtifactAt: path newPatchBuilder) addDiff: (SquotArtifactModification left: artifact right: changed "Note: not sending setLoadedInWorkingCopy!"); + updateRightArtifacts; buildPatch \ No newline at end of file diff --git a/src/Squot.package/SquotChangesChooserTest.class/instance/patchRemovingArtifactAt..st b/src/Squot.package/SquotChangesChooserTest.class/instance/patchRemovingArtifactAt..st index a594ef958..4a4c7f481 100644 --- a/src/Squot.package/SquotChangesChooserTest.class/instance/patchRemovingArtifactAt..st +++ b/src/Squot.package/SquotChangesChooserTest.class/instance/patchRemovingArtifactAt..st @@ -4,4 +4,5 @@ patchRemovingArtifactAt: path artifact := SquotArtifact new path: path; content: SquotArtifactContentMock new. ^ (SquotSnapshot builder add: artifact; newPatchBuilder) addDiff: (SquotArtifactRemoval of: artifact); + updateRightArtifacts; buildPatch \ No newline at end of file diff --git a/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithLoadOrderChange.st b/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithLoadOrderChange.st index 92d6aa48a..1954bff22 100644 --- a/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithLoadOrderChange.st +++ b/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithLoadOrderChange.st @@ -9,6 +9,7 @@ patchWithLoadOrderChange addDiff: (SquotArtifactDiffMock path: '1'); addDiff: (SquotArtifactDiffMock path: '2'); newLoadOrder: #('2' '1'); + updateRightArtifacts; buildPatch. self assert: patch diffs size = 2; assert: (patch loadOrderDiff applyTo: #('1' '2')) = #('2' '1'). diff --git a/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithLoadOrderChangeRegression1.st b/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithLoadOrderChangeRegression1.st index d885d15cf..b9bdb8b99 100644 --- a/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithLoadOrderChangeRegression1.st +++ b/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithLoadOrderChangeRegression1.st @@ -8,7 +8,7 @@ patchWithLoadOrderChangeRegression1 base artifactsDo: [:each | patchBuilder addDiff: (SquotArtifactDiffMock path: each path)]. newLoadOrder := #('16' '13' '3' '7' '4' '2' '5' '6' '15' '12' '14' '9' '11' '10' '8' '1'). patchBuilder newLoadOrder: newLoadOrder. - patch := patchBuilder buildPatch. + patch := patchBuilder updateRightArtifacts; buildPatch. self assert: (patch loadOrderDiff applyTo: ((1 to: 16) collect: #asString)) = newLoadOrder. self assert: patch patchedLoadOrder = newLoadOrder. ^ patch \ No newline at end of file diff --git a/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithTwoChangedArtifacts.st b/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithTwoChangedArtifacts.st index c2af901cc..541def74d 100644 --- a/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithTwoChangedArtifacts.st +++ b/src/Squot.package/SquotChangesChooserTest.class/instance/patchWithTwoChangedArtifacts.st @@ -7,4 +7,5 @@ patchWithTwoChangedArtifacts addDiff: (SquotArtifactDiffMock path: '1'); addDiff: (SquotArtifactDiffMock path: '2'); newLoadOrder: #('1' '2'); + updateRightArtifacts; buildPatch. \ No newline at end of file diff --git a/src/Squot.package/SquotChangesChooserTest.class/methodProperties.json b/src/Squot.package/SquotChangesChooserTest.class/methodProperties.json index 90dff35e3..7b4058e94 100644 --- a/src/Squot.package/SquotChangesChooserTest.class/methodProperties.json +++ b/src/Squot.package/SquotChangesChooserTest.class/methodProperties.json @@ -7,14 +7,14 @@ "includesDiffAt:in:" : "jr 8/15/2019 01:21", "loadOrderHasChanges" : "jr 11/3/2020 16:44", "newToolOn:" : "jr 9/25/2020 19:12", - "patchAddingArtifactAt:" : "jr 11/7/2020 10:55", + "patchAddingArtifactAt:" : "jr 7/17/2021 20:41", "patchChangingArtifactAt:" : "jr 11/18/2020 22:31", - "patchChangingUnloadedArtifactAt:" : "jr 11/19/2020 13:33", + "patchChangingUnloadedArtifactAt:" : "jr 7/17/2021 20:41", "patchModifyingMethodTimestampInArtifactAt:" : "jr 5/14/2021 16:14", - "patchRemovingArtifactAt:" : "jr 11/7/2020 11:03", - "patchWithLoadOrderChange" : "jr 8/15/2019 03:15", - "patchWithLoadOrderChangeRegression1" : "jr 8/15/2019 03:21", - "patchWithTwoChangedArtifacts" : "jr 2/9/2020 03:46", + "patchRemovingArtifactAt:" : "jr 7/17/2021 20:41", + "patchWithLoadOrderChange" : "jr 7/17/2021 20:41", + "patchWithLoadOrderChangeRegression1" : "jr 7/17/2021 20:42", + "patchWithTwoChangedArtifacts" : "jr 7/17/2021 20:42", "patchWithUnloadedArtifactAt:" : "jr 11/18/2020 20:59", "patchedLoadOrderAfter:" : "jr 8/15/2019 01:07", "performUiInteractionTestsOnNode:withPath:inTree:" : "jr 11/18/2020 19:57", diff --git a/src/Squot.package/SquotCherryPickOperation.class/instance/prepareSave.st b/src/Squot.package/SquotCherryPickOperation.class/instance/prepareSave.st index 4a267813a..fdbfe1667 100644 --- a/src/Squot.package/SquotCherryPickOperation.class/instance/prepareSave.st +++ b/src/Squot.package/SquotCherryPickOperation.class/instance/prepareSave.st @@ -6,7 +6,7 @@ prepareSave loadedPatch diffsDo: [:each | each hasChanges ifTrue: [patchBuilder addDiff: each]]. save := self privateNewSave message: (message ifNil: [self defaultMessage]); - patch: patchBuilder buildPatch; + patch: (patchBuilder updateRightArtifacts; buildPatch); author: pickedVersion author; timestamp: pickedVersion timestamp; unitOfWork: self unitOfWork; diff --git a/src/Squot.package/SquotCherryPickOperation.class/methodProperties.json b/src/Squot.package/SquotCherryPickOperation.class/methodProperties.json index 9ba5e6869..00cc64d13 100644 --- a/src/Squot.package/SquotCherryPickOperation.class/methodProperties.json +++ b/src/Squot.package/SquotCherryPickOperation.class/methodProperties.json @@ -13,7 +13,7 @@ "pickedVersion" : "jr 1/4/2020 19:19", "pickedVersion:" : "jr 4/17/2020 12:26", "prepareMerge" : "jr 9/21/2020 23:56", - "prepareSave" : "jr 11/22/2020 17:45", + "prepareSave" : "jr 7/17/2021 20:31", "privateNewMerge" : "jr 1/19/2020 01:43", "privateNewSave" : "jr 1/26/2020 21:47", "relevantParentOfPickedVersion" : "jr 1/4/2020 19:19", diff --git a/src/Squot.package/SquotImageStoreTest.class/instance/testApplyPatch.st b/src/Squot.package/SquotImageStoreTest.class/instance/testApplyPatch.st index f6f8b8afe..dc6f7d60a 100644 --- a/src/Squot.package/SquotImageStoreTest.class/instance/testApplyPatch.st +++ b/src/Squot.package/SquotImageStoreTest.class/instance/testApplyPatch.st @@ -49,6 +49,7 @@ testApplyPatch asSquotArtifactForPackage: packageInfo. patch := snapshotBefore newPatchBuilder addDiff: (packageArtifactBeforePatch diffAgainst: packageArtifactAfterPatch); + updateRightArtifacts; buildPatch. self suppressChangeNotificationsDuring: [imageStore restoreToSnapshot: snapshotBefore]. diff --git a/src/Squot.package/SquotImageStoreTest.class/methodProperties.json b/src/Squot.package/SquotImageStoreTest.class/methodProperties.json index d166eb0b9..fd1d7f744 100644 --- a/src/Squot.package/SquotImageStoreTest.class/methodProperties.json +++ b/src/Squot.package/SquotImageStoreTest.class/methodProperties.json @@ -12,7 +12,7 @@ "tearDown" : "jr 9/20/2019 20:17", "testAddNewObjectsFromArtifact" : "jr 8/18/2017 13:01", "testAddingObjectsAddsThemToTheLoadOrder" : "jr 8/18/2018 15:59", - "testApplyPatch" : "jr 11/6/2020 19:55", + "testApplyPatch" : "jr 7/17/2021 20:42", "testFiles" : "jr 3/8/2017 17:49", "testIgnoredInstanceVariables" : "jr 7/20/2017 13:08", "testMetadataModification" : "jr 12/14/2020 22:57", diff --git a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st new file mode 100644 index 000000000..bdb7f1a0c --- /dev/null +++ b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st @@ -0,0 +1,6 @@ +failures +expectedFailures + | bugs | + bugs := #(testTrackingText "Because patched object graphs are inconsistent: the list of object names does not use the same instances as the referenced objects."). + bugs flag: #todo. "Fix them" + ^ super expectedFailures, bugs \ No newline at end of file diff --git a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json index 217feabd2..8e52995f8 100644 --- a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json +++ b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json @@ -2,6 +2,7 @@ "class" : { }, "instance" : { + "expectedFailures" : "jr 7/17/2021 21:57", "newRepository" : "jr 2/4/2017 01:58", "testImmutabilityOfSnapshots" : "jr 1/26/2020 22:58", "testVersionsDoNotContainWorkingCopyArtifacts" : "jr 11/18/2020 21:35" } } diff --git a/src/Squot.package/SquotLiveArtifact.class/instance/mergeWith.basedOn..st b/src/Squot.package/SquotLiveArtifact.class/instance/mergeWith.basedOn..st index 8b87d2dc3..831169f2a 100644 --- a/src/Squot.package/SquotLiveArtifact.class/instance/mergeWith.basedOn..st +++ b/src/Squot.package/SquotLiveArtifact.class/instance/mergeWith.basedOn..st @@ -1,3 +1,6 @@ merging mergeWith: otherArtifact basedOn: baseArtifact - ^ self snapshot mergeWith: otherArtifact basedOn: baseArtifact \ No newline at end of file + ^ SquotArtifactMerge into: self merge: otherArtifact basedOn: baseArtifact + willBeLoaded: true + graphMerge: (self content squotDiffAgainst: otherArtifact content withBase: baseArtifact content) + metadataMerge: (self storeInfo squotMergeWith: otherArtifact storeInfo basedOn: baseArtifact storeInfo) \ No newline at end of file diff --git a/src/Squot.package/SquotLiveArtifact.class/methodProperties.json b/src/Squot.package/SquotLiveArtifact.class/methodProperties.json index b48b45b2a..6a606bfe5 100644 --- a/src/Squot.package/SquotLiveArtifact.class/methodProperties.json +++ b/src/Squot.package/SquotLiveArtifact.class/methodProperties.json @@ -12,7 +12,7 @@ "hash" : "jr 11/22/2020 18:05", "liveStoreInfo" : "jr 5/4/2019 02:25", "materializeWith:replacing:" : "jr 12/7/2019 22:26", - "mergeWith:basedOn:" : "jr 12/23/2020 21:50", + "mergeWith:basedOn:" : "jr 7/17/2021 19:59", "object" : "jr 12/9/2020 22:47", "objectGraph" : "jr 12/8/2019 21:26", "on:at:in:" : "jr 10/11/2020 23:47", diff --git a/src/Squot.package/SquotMerge.class/instance/privateResolvedPatch.st b/src/Squot.package/SquotMerge.class/instance/privateResolvedPatch.st index a0844f880..4cee95f84 100644 --- a/src/Squot.package/SquotMerge.class/instance/privateResolvedPatch.st +++ b/src/Squot.package/SquotMerge.class/instance/privateResolvedPatch.st @@ -18,4 +18,6 @@ privateResolvedPatch (elementMerges select: [:each | each mayAffectArtifact]) do: [:each | builder addDiff: each resolvedPatch]. builder newLoadOrder: (loadOrderMerge resolvedPatch applyTo: working loadOrder). - ^ builder buildPatch \ No newline at end of file + ^ builder + updateRightArtifacts; + buildPatch \ No newline at end of file diff --git a/src/Squot.package/SquotMerge.class/methodProperties.json b/src/Squot.package/SquotMerge.class/methodProperties.json index 51f134d17..d47fa2508 100644 --- a/src/Squot.package/SquotMerge.class/methodProperties.json +++ b/src/Squot.package/SquotMerge.class/methodProperties.json @@ -11,4 +11,4 @@ "mergeAt:" : "jr 8/3/2019 21:24", "newLoadOrder" : "jr 8/15/2019 13:57", "newLoadOrder:" : "jr 11/3/2020 17:08", - "privateResolvedPatch" : "jr 11/6/2020 23:23" } } + "privateResolvedPatch" : "jr 7/17/2021 20:32" } } diff --git a/src/Squot.package/SquotPatch.class/class/noChangesTo..st b/src/Squot.package/SquotPatch.class/class/noChangesTo..st index 0df3eb26f..de8424063 100644 --- a/src/Squot.package/SquotPatch.class/class/noChangesTo..st +++ b/src/Squot.package/SquotPatch.class/class/noChangesTo..st @@ -1,3 +1,3 @@ instance creation noChangesTo: anObjectContainer - ^ self builder startingFrom: anObjectContainer; buildPatch \ No newline at end of file + ^ self builder startingFrom: anObjectContainer; updateRightArtifacts; buildPatch \ No newline at end of file diff --git a/src/Squot.package/SquotPatch.class/methodProperties.json b/src/Squot.package/SquotPatch.class/methodProperties.json index f8cd41a2e..1b7bc6bcb 100644 --- a/src/Squot.package/SquotPatch.class/methodProperties.json +++ b/src/Squot.package/SquotPatch.class/methodProperties.json @@ -1,7 +1,7 @@ { "class" : { "builder" : "jr 9/16/2018 14:36", - "noChangesTo:" : "jr 6/9/2019 02:02" }, + "noChangesTo:" : "jr 7/17/2021 20:33" }, "instance" : { "applyTo:" : "jr 1/3/2021 21:19", "applyTo:displayingProgress:" : "jr 1/2/2021 17:40", diff --git a/src/Squot.package/SquotPatchBuilder.class/instance/buildPatch.st b/src/Squot.package/SquotPatchBuilder.class/instance/buildPatch.st index 9642e2b9e..2d339633e 100644 --- a/src/Squot.package/SquotPatchBuilder.class/instance/buildPatch.st +++ b/src/Squot.package/SquotPatchBuilder.class/instance/buildPatch.st @@ -1,7 +1,11 @@ accessing buildPatch base ifNil: [base := SquotSnapshot empty]. - self updateRightArtifacts. + self loadOrderMerge resetAppliedDiffs. + diffs do: [:each | self loadOrderMerge applyDiff: each. "Applies removals and additions"]. + self loadOrderMerge + detectConflicts; + chooseIncoming. ^ SquotPatch new initializeFrom: base to: patched withDiffs: (diffs select: [:each | each mayAffectArtifact]); loadOrderDiff: (self loadOrderMerge resolvedPatch ifNil: [self error: 'Load order conflicts not resolved']); diff --git a/src/Squot.package/SquotPatchBuilder.class/methodProperties.json b/src/Squot.package/SquotPatchBuilder.class/methodProperties.json index c899060a8..591dcf109 100644 --- a/src/Squot.package/SquotPatchBuilder.class/methodProperties.json +++ b/src/Squot.package/SquotPatchBuilder.class/methodProperties.json @@ -5,7 +5,7 @@ "addArtifact:" : "jr 11/7/2020 19:31", "addDiff:" : "jr 11/21/2020 01:01", "addLoadOrderDiffTreeTo:" : "jr 11/7/2020 11:46", - "buildPatch" : "jr 11/6/2020 23:23", + "buildPatch" : "jr 7/17/2021 20:51", "computeDifferences" : "jr 11/7/2020 11:36", "computeDiffsForNewArtifacts" : "jr 9/13/2020 19:29", "computeDiffsFromLeftToRight" : "jr 11/6/2020 23:05", diff --git a/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactAddition.st b/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactAddition.st index e84b60506..bc9f597f5 100644 --- a/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactAddition.st +++ b/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactAddition.st @@ -10,5 +10,5 @@ testCorrectLoadOrderAfterExcludedArtifactAddition buildSnapshot. builder := (patched patchRelativeToBase: original) createNewBuilder. builder resetAt: '2'. - editedPatch := builder buildPatch. + editedPatch := builder updateRightArtifacts; buildPatch. self assert: #('1') equals: editedPatch patchedLoadOrder. \ No newline at end of file diff --git a/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemoval.st b/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemoval.st index 062e26fd6..40a419466 100644 --- a/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemoval.st +++ b/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemoval.st @@ -10,5 +10,5 @@ testCorrectLoadOrderAfterExcludedArtifactRemoval buildSnapshot. builder := (patched patchRelativeToBase: original) createNewBuilder. builder resetAt: '2'. - editedPatch := builder buildPatch. + editedPatch := builder updateRightArtifacts; buildPatch. self assert: #('1' '2') equals: editedPatch patchedLoadOrder. \ No newline at end of file diff --git a/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemovalAndSimultaneousOrderChange.st b/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemovalAndSimultaneousOrderChange.st index db469425b..6517a0368 100644 --- a/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemovalAndSimultaneousOrderChange.st +++ b/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemovalAndSimultaneousOrderChange.st @@ -12,5 +12,5 @@ testCorrectLoadOrderAfterExcludedArtifactRemovalAndSimultaneousOrderChange buildSnapshot. builder := (patched patchRelativeToBase: original) createNewBuilder. builder resetAt: '2'. - editedPatch := builder buildPatch. + editedPatch := builder updateRightArtifacts; buildPatch. self assert: #('3' '1' '2') equals: editedPatch patchedLoadOrder. \ No newline at end of file diff --git a/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemovalAtBeginning.st b/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemovalAtBeginning.st index 13ac891b3..d82ec0112 100644 --- a/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemovalAtBeginning.st +++ b/src/Squot.package/SquotPatchBuilderTest.class/instance/testCorrectLoadOrderAfterExcludedArtifactRemovalAtBeginning.st @@ -10,5 +10,5 @@ testCorrectLoadOrderAfterExcludedArtifactRemovalAtBeginning buildSnapshot. builder := (patched patchRelativeToBase: original) createNewBuilder. builder resetAt: '1'. - editedPatch := builder buildPatch. + editedPatch := builder updateRightArtifacts; buildPatch. self assert: #('1' '2') equals: editedPatch patchedLoadOrder. \ No newline at end of file diff --git a/src/Squot.package/SquotPatchBuilderTest.class/instance/testLoadOrderAfterIncludedArtifactAdditionAndSimultaneousOrderChange2.st b/src/Squot.package/SquotPatchBuilderTest.class/instance/testLoadOrderAfterIncludedArtifactAdditionAndSimultaneousOrderChange2.st index 456f84880..c36111f0d 100644 --- a/src/Squot.package/SquotPatchBuilderTest.class/instance/testLoadOrderAfterIncludedArtifactAdditionAndSimultaneousOrderChange2.st +++ b/src/Squot.package/SquotPatchBuilderTest.class/instance/testLoadOrderAfterIncludedArtifactAdditionAndSimultaneousOrderChange2.st @@ -14,6 +14,7 @@ testLoadOrderAfterIncludedArtifactAdditionAndSimultaneousOrderChange2 startingFrom: original; addDiff: (SquotArtifactAddition of: (patched artifactAt: '2')); newLoadOrder: #('3' '2' '1'); + updateRightArtifacts; buildPatch. self assert: #('3' '2' '1') equals: (editedPatch loadOrderDiff applyTo: #('1' '3')); assert: #('3' '2' '1') equals: editedPatch patchedLoadOrder. \ No newline at end of file diff --git a/src/Squot.package/SquotPatchBuilderTest.class/methodProperties.json b/src/Squot.package/SquotPatchBuilderTest.class/methodProperties.json index 273880ad0..65f0ef4d4 100644 --- a/src/Squot.package/SquotPatchBuilderTest.class/methodProperties.json +++ b/src/Squot.package/SquotPatchBuilderTest.class/methodProperties.json @@ -2,9 +2,9 @@ "class" : { }, "instance" : { - "testCorrectLoadOrderAfterExcludedArtifactAddition" : "jr 5/9/2020 00:08", - "testCorrectLoadOrderAfterExcludedArtifactRemoval" : "jr 5/9/2020 00:09", - "testCorrectLoadOrderAfterExcludedArtifactRemovalAndSimultaneousOrderChange" : "jr 5/9/2020 00:13", - "testCorrectLoadOrderAfterExcludedArtifactRemovalAtBeginning" : "jr 5/9/2020 00:13", + "testCorrectLoadOrderAfterExcludedArtifactAddition" : "jr 7/17/2021 20:41", + "testCorrectLoadOrderAfterExcludedArtifactRemoval" : "jr 7/17/2021 20:42", + "testCorrectLoadOrderAfterExcludedArtifactRemovalAndSimultaneousOrderChange" : "jr 7/17/2021 20:42", + "testCorrectLoadOrderAfterExcludedArtifactRemovalAtBeginning" : "jr 7/17/2021 20:42", "testLoadOrderAfterIncludedArtifactAdditionAndSimultaneousOrderChange" : "jr 11/3/2020 18:15", - "testLoadOrderAfterIncludedArtifactAdditionAndSimultaneousOrderChange2" : "jr 11/3/2020 18:18" } } + "testLoadOrderAfterIncludedArtifactAdditionAndSimultaneousOrderChange2" : "jr 7/17/2021 20:43" } } diff --git a/src/Squot.package/SquotShadowGraph.class/instance/hasSameStartObjectAs..st b/src/Squot.package/SquotShadowGraph.class/instance/hasSameStartObjectAs..st index b8cac05d9..93802b812 100644 --- a/src/Squot.package/SquotShadowGraph.class/instance/hasSameStartObjectAs..st +++ b/src/Squot.package/SquotShadowGraph.class/instance/hasSameStartObjectAs..st @@ -2,7 +2,6 @@ testing hasSameStartObjectAs: aShadowGraph "Answer whether the other graph and I have the same start object (although it may be a different edition of it)." - ^ (self startName isNil or: [aShadowGraph startName = self startName]) - and: [self startName notNil - or: [aShadowGraph startName isNil - and: [self startShadow = aShadowGraph startShadow]]] \ No newline at end of file + ^ self startName + ifNil: [aShadowGraph startName isNil and: [self startShadow = aShadowGraph startShadow]] + ifNotNil: [aShadowGraph startName = self startName] \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraph.class/methodProperties.json b/src/Squot.package/SquotShadowGraph.class/methodProperties.json index a9f9b4a57..ecc1f8030 100644 --- a/src/Squot.package/SquotShadowGraph.class/methodProperties.json +++ b/src/Squot.package/SquotShadowGraph.class/methodProperties.json @@ -13,7 +13,7 @@ "delegateRegistry:" : "jr 7/21/2017 01:30", "errorNotFound:" : "jr 7/30/2017 01:19", "evictObjectNames" : "jr 8/17/2017 22:15", - "hasSameStartObjectAs:" : "jr 9/2/2019 20:04", + "hasSameStartObjectAs:" : "jr 7/17/2021 19:47", "includes:" : "jr 7/26/2019 23:08", "includesObjectNamed:" : "jr 9/23/2019 19:00", "initialize" : "jr 8/17/2017 22:18", diff --git a/src/Squot.package/SquotWorkingCopy.class/instance/loadArtifact..st b/src/Squot.package/SquotWorkingCopy.class/instance/loadArtifact..st index 6c4060a39..fdc989c65 100644 --- a/src/Squot.package/SquotWorkingCopy.class/instance/loadArtifact..st +++ b/src/Squot.package/SquotWorkingCopy.class/instance/loadArtifact..st @@ -4,5 +4,6 @@ loadArtifact: anArtifact | patch | patch := self newPatchBuilder updateArtifactTo: anArtifact; + updateRightArtifacts; buildPatch. self applyPatch: patch \ No newline at end of file diff --git a/src/Squot.package/SquotWorkingCopy.class/instance/loadArtifactInteractively.ifCanceled..st b/src/Squot.package/SquotWorkingCopy.class/instance/loadArtifactInteractively.ifCanceled..st index 1f463c30d..b5f66d515 100644 --- a/src/Squot.package/SquotWorkingCopy.class/instance/loadArtifactInteractively.ifCanceled..st +++ b/src/Squot.package/SquotWorkingCopy.class/instance/loadArtifactInteractively.ifCanceled..st @@ -5,5 +5,6 @@ loadArtifactInteractively: anArtifact ifCanceled: cancelBlock self addGlobalObjectsToStore: (SquotSnapshot builder add: anArtifact; buildSnapshot). patch := self newPatchBuilder updateArtifactTo: anArtifact; + updateRightArtifacts; buildPatch. ^ self loadPatchInteractively: patch ifCanceled: [cancelBlock value] \ No newline at end of file diff --git a/src/Squot.package/SquotWorkingCopy.class/methodProperties.json b/src/Squot.package/SquotWorkingCopy.class/methodProperties.json index b9cd036a4..e49b5170e 100644 --- a/src/Squot.package/SquotWorkingCopy.class/methodProperties.json +++ b/src/Squot.package/SquotWorkingCopy.class/methodProperties.json @@ -44,8 +44,8 @@ "inform:" : "jr 7/24/2020 11:34", "initialize" : "jr 9/26/2020 17:05", "lazySnapshot" : "jr 11/20/2020 23:02", - "loadArtifact:" : "jr 10/4/2020 22:59", - "loadArtifactInteractively:ifCanceled:" : "jr 5/4/2019 02:34", + "loadArtifact:" : "jr 7/17/2021 20:43", + "loadArtifactInteractively:ifCanceled:" : "jr 7/17/2021 20:34", "loadOrder" : "jr 10/4/2020 22:10", "loadOrder:" : "jr 10/19/2020 00:00", "loadPatchInteractively:ifCanceled:" : "jr 10/4/2020 21:07", diff --git a/src/Squot.package/SquotWorkingCopyArtifact.class/instance/mergeDiffWith.basedOn..st b/src/Squot.package/SquotWorkingCopyArtifact.class/instance/mergeDiffWith.basedOn..st new file mode 100644 index 000000000..2af720c78 --- /dev/null +++ b/src/Squot.package/SquotWorkingCopyArtifact.class/instance/mergeDiffWith.basedOn..st @@ -0,0 +1,5 @@ +merging +mergeDiffWith: otherArtifact basedOn: baseArtifact + "New name suggestions: + mergeWith: otherArtifact basedOn: baseArtifact" + ^ self mergeWith: otherArtifact basedOn: baseArtifact \ No newline at end of file diff --git a/src/Squot.package/SquotWorkingCopyArtifact.class/instance/mergeWith.basedOn..st b/src/Squot.package/SquotWorkingCopyArtifact.class/instance/mergeWith.basedOn..st index db636d456..d0107e2ee 100644 --- a/src/Squot.package/SquotWorkingCopyArtifact.class/instance/mergeWith.basedOn..st +++ b/src/Squot.package/SquotWorkingCopyArtifact.class/instance/mergeWith.basedOn..st @@ -2,5 +2,5 @@ merging mergeWith: incomingArtifact basedOn: baseArtifact | merge | merge := artifact mergeWith: incomingArtifact basedOn: baseArtifact. - self applyLoadStatusTo: merge. + merge working: self. ^ merge \ No newline at end of file diff --git a/src/Squot.package/SquotWorkingCopyArtifact.class/methodProperties.json b/src/Squot.package/SquotWorkingCopyArtifact.class/methodProperties.json index 871faa2c2..0ebd6d460 100644 --- a/src/Squot.package/SquotWorkingCopyArtifact.class/methodProperties.json +++ b/src/Squot.package/SquotWorkingCopyArtifact.class/methodProperties.json @@ -12,7 +12,8 @@ "doesNotUnderstand:" : "jr 9/26/2020 18:04", "hash" : "jr 11/6/2020 23:13", "isLoaded" : "jr 9/26/2020 21:01", - "mergeWith:basedOn:" : "jr 12/23/2020 22:05", + "mergeDiffWith:basedOn:" : "jr 7/17/2021 22:12", + "mergeWith:basedOn:" : "jr 7/17/2021 22:16", "mergeWithoutBaseWith:" : "jr 11/22/2020 22:34", "serializer:" : "jr 9/26/2020 18:29", "setArtifact:workingCopy:" : "jr 9/26/2020 18:09", diff --git a/src/Squot.package/SquotWorkingCopyTest.class/instance/expectedFailures.st b/src/Squot.package/SquotWorkingCopyTest.class/instance/expectedFailures.st index 3d50f23f2..113ca0412 100644 --- a/src/Squot.package/SquotWorkingCopyTest.class/instance/expectedFailures.st +++ b/src/Squot.package/SquotWorkingCopyTest.class/instance/expectedFailures.st @@ -1,7 +1,6 @@ failures expectedFailures | bugs | - bugs := #(testTrackingText "Because patched object graphs are inconsistent: the list of object names does not use the same instances as the referenced objects." - testTrackingWorkspaceMorph "See above, and merging of objects is incomplete (e. g. support for value objects)"). + bugs := #(testTrackingWorkspaceMorph "Merging of objects is incomplete (e. g. support for value objects)"). bugs flag: #todo. "Fix them" ^ bugs \ No newline at end of file diff --git a/src/Squot.package/SquotWorkingCopyTest.class/instance/testAdditionNotLoaded.st b/src/Squot.package/SquotWorkingCopyTest.class/instance/testAdditionNotLoaded.st index 4ed739b84..5798a4269 100644 --- a/src/Squot.package/SquotWorkingCopyTest.class/instance/testAdditionNotLoaded.st +++ b/src/Squot.package/SquotWorkingCopyTest.class/instance/testAdditionNotLoaded.st @@ -5,7 +5,7 @@ testAdditionNotLoaded snapshot := SquotImageStore new add: text at: 'text.txt'; captureSnapshot. patchBuilder := (snapshot patchRelativeToBase: workingCopy) createNewBuilder. (patchBuilder diffAt: 'text.txt') toggleWhetherToLoad. - patch := patchBuilder buildPatch. + patch := patchBuilder updateRightArtifacts; buildPatch. self deny: (workingCopy includesObjectAt: 'text.txt'); deny: (workingCopy loadOrder includes: 'text.txt'). "when" diff --git a/src/Squot.package/SquotWorkingCopyTest.class/instance/testRemovedUnsavedArtifactStaysRemoved.st b/src/Squot.package/SquotWorkingCopyTest.class/instance/testRemovedUnsavedArtifactStaysRemoved.st index b11d17d55..ac84d84cd 100644 --- a/src/Squot.package/SquotWorkingCopyTest.class/instance/testRemovedUnsavedArtifactStaysRemoved.st +++ b/src/Squot.package/SquotWorkingCopyTest.class/instance/testRemovedUnsavedArtifactStaysRemoved.st @@ -14,6 +14,7 @@ testRemovedUnsavedArtifactStaysRemoved patch: (workingCopy baseVersion newPatchBuilder addDiff: ((workingCopy patchRelativeToBase: workingCopy baseVersion) diffAt: 'other path'); + updateRightArtifacts; buildPatch); "Diff at 'obj' not included!" message: 'Add at other path, but don''t remove at old path'; applyToWorkingCopy]. diff --git a/src/Squot.package/SquotWorkingCopyTest.class/methodProperties.json b/src/Squot.package/SquotWorkingCopyTest.class/methodProperties.json index 0b7a15977..ef521f24f 100644 --- a/src/Squot.package/SquotWorkingCopyTest.class/methodProperties.json +++ b/src/Squot.package/SquotWorkingCopyTest.class/methodProperties.json @@ -7,7 +7,7 @@ "changeLogSuppressor" : "jr 4/29/2018 16:50", "classFactory" : "jr 10/1/2017 01:44", "denyChangesInWorkingCopy" : "jr 1/1/2021 22:07", - "expectedFailures" : "jr 1/2/2021 00:52", + "expectedFailures" : "jr 7/17/2021 21:58", "newRepository" : "jr 1/26/2017 17:15", "newStore" : "jr 1/29/2017 22:20", "newWorkingCopy" : "jr 1/26/2017 17:05", @@ -17,7 +17,7 @@ "targetClass" : "jr 1/26/2017 17:21", "tearDown" : "jr 9/20/2019 20:30", "testAddMultipleObjectsSuccessively" : "jr 10/19/2020 20:51", - "testAdditionNotLoaded" : "jr 10/4/2020 22:06", + "testAdditionNotLoaded" : "jr 7/17/2021 20:43", "testBaseSnapshotEqualsBaseVersionSnapshot" : "jr 1/3/2021 17:40", "testCherryPickDoesNotSaveUnrelatedChanges" : "jr 10/24/2020 17:28", "testCherryPickOfOrphanedVersion" : "jr 10/11/2020 23:07", @@ -51,7 +51,7 @@ "testReaddedObjectAfterMergeInIncomingLoadOrderPosition" : "jr 10/24/2020 18:10", "testReaddedObjectAfterMergeInSameLoadOrderPosition" : "jr 10/24/2020 18:13", "testRemovePackage" : "jr 1/26/2020 23:54", - "testRemovedUnsavedArtifactStaysRemoved" : "jr 10/19/2020 20:45", + "testRemovedUnsavedArtifactStaysRemoved" : "jr 7/17/2021 20:43", "testRestoreClass" : "jr 8/11/2020 23:40", "testRestorePackage" : "jr 3/2/2020 23:24", "testSaveTimestampIsNow" : "jr 8/25/2020 19:13", From 708fd76c02b826c58d315d10608e58473547b119 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 18 Jul 2021 00:15:28 +0200 Subject: [PATCH 04/43] Let mirrors deal with the original class for the shadow More specifically, let SquotObjectMirror deal with it since it is only applicable to SquotObjectShadow. --- .../instance/capture.with..st | 7 ------ .../instance/initializeSnapshot.of.with..st | 3 +++ .../methodProperties.json | 2 +- ...e.with..st => capture.with.ifReplaced..st} | 2 +- .../methodProperties.json | 2 +- .../instance/capture.with..st | 8 ------- .../methodProperties.json | 1 - .../instance/capture.with..st | 3 --- .../instance/capture.with.ifReplaced..st | 3 +++ .../methodProperties.json | 2 +- .../instance/assumeOriginalClassOf..st | 3 +++ .../methodProperties.json | 1 + ...e.with..st => capture.with.ifReplaced..st} | 4 ++-- .../SquotMirror.class/methodProperties.json | 2 +- .../instance/capture.reflectedIn..st | 24 +++++-------------- .../methodProperties.json | 2 +- .../instance/capture.with..st | 9 ------- .../methodProperties.json | 1 - .../instance/capture.with..st | 8 ------- .../instance/capture.with.ifReplaced..st | 18 ++++++++++++++ .../methodProperties.json | 2 +- .../instance/capture.with.ifReplaced..st} | 2 +- .../methodProperties.json | 2 +- .../instance/capture.with..st | 3 --- .../instance/capture.with.ifReplaced..st | 3 +++ .../methodProperties.json | 2 +- ...e.with..st => capture.with.ifReplaced..st} | 2 +- .../methodProperties.json | 2 +- .../instance/capture.with.ifReplaced..st} | 2 +- .../methodProperties.json | 2 +- .../instance/capture.with..st | 7 ------ .../instance/capture.with.ifReplaced..st | 7 ++++++ .../instance/initializeSnapshot.of.with..st | 3 +++ .../methodProperties.json | 3 ++- ...e.with..st => capture.with.ifReplaced..st} | 2 +- .../methodProperties.json | 2 +- 36 files changed, 67 insertions(+), 84 deletions(-) delete mode 100644 src/Squot.package/SquotBitsMirror.class/instance/capture.with..st create mode 100644 src/Squot.package/SquotBitsMirror.class/instance/initializeSnapshot.of.with..st rename src/Squot.package/SquotClassMirror.class/instance/{capture.with..st => capture.with.ifReplaced..st} (86%) delete mode 100644 src/Squot.package/SquotCompiledCodeMirror.class/instance/capture.with..st delete mode 100644 src/Squot.package/SquotDiskProxyMirror.class/instance/capture.with..st create mode 100644 src/Squot.package/SquotDiskProxyMirror.class/instance/capture.with.ifReplaced..st create mode 100644 src/Squot.package/SquotDiskProxyShadow.class/instance/assumeOriginalClassOf..st rename src/Squot.package/SquotMirror.class/instance/{capture.with..st => capture.with.ifReplaced..st} (68%) delete mode 100644 src/Squot.package/SquotObjectGraphMirror.class/instance/capture.with..st delete mode 100644 src/Squot.package/SquotObjectMirror.class/instance/capture.with..st create mode 100644 src/Squot.package/SquotObjectMirror.class/instance/capture.with.ifReplaced..st rename src/Squot.package/{SquotPackageShadowMirror.class/instance/capture.with..st => SquotObjectShadowMirror.class/instance/capture.with.ifReplaced..st} (61%) delete mode 100644 src/Squot.package/SquotOpaqueValueMirror.class/instance/capture.with..st create mode 100644 src/Squot.package/SquotOpaqueValueMirror.class/instance/capture.with.ifReplaced..st rename src/Squot.package/SquotPackageMirror.class/instance/{capture.with..st => capture.with.ifReplaced..st} (91%) rename src/Squot.package/{SquotObjectShadowMirror.class/instance/capture.with..st => SquotPackageShadowMirror.class/instance/capture.with.ifReplaced..st} (61%) delete mode 100644 src/Squot.package/SquotStringMirror.class/instance/capture.with..st create mode 100644 src/Squot.package/SquotStringMirror.class/instance/capture.with.ifReplaced..st create mode 100644 src/Squot.package/SquotStringMirror.class/instance/initializeSnapshot.of.with..st rename src/Squot.package/SquotSystemSingletonMirror.class/instance/{capture.with..st => capture.with.ifReplaced..st} (76%) diff --git a/src/Squot.package/SquotBitsMirror.class/instance/capture.with..st b/src/Squot.package/SquotBitsMirror.class/instance/capture.with..st deleted file mode 100644 index bc5aa92ac..000000000 --- a/src/Squot.package/SquotBitsMirror.class/instance/capture.with..st +++ /dev/null @@ -1,7 +0,0 @@ -capturing -capture: anObject with: aSquotObjectCapturer - | newShadow | - newShadow := self newShadowObject. - aSquotObjectCapturer rememberAsShadowOfCapturedObject: newShadow. - newShadow copyBitsFrom: anObject. - ^ newShadow \ No newline at end of file diff --git a/src/Squot.package/SquotBitsMirror.class/instance/initializeSnapshot.of.with..st b/src/Squot.package/SquotBitsMirror.class/instance/initializeSnapshot.of.with..st new file mode 100644 index 000000000..098da743d --- /dev/null +++ b/src/Squot.package/SquotBitsMirror.class/instance/initializeSnapshot.of.with..st @@ -0,0 +1,3 @@ +capturing +initializeSnapshot: aSquotObjectShadow of: anObject with: aSquotObjectCapturer + aSquotObjectShadow copyBitsFrom: anObject. \ No newline at end of file diff --git a/src/Squot.package/SquotBitsMirror.class/methodProperties.json b/src/Squot.package/SquotBitsMirror.class/methodProperties.json index dbb161195..797849d33 100644 --- a/src/Squot.package/SquotBitsMirror.class/methodProperties.json +++ b/src/Squot.package/SquotBitsMirror.class/methodProperties.json @@ -2,5 +2,5 @@ "class" : { }, "instance" : { - "capture:with:" : "jr 4/8/2021 21:31", + "initializeSnapshot:of:with:" : "jr 7/17/2021 23:56", "shadowFactory" : "jr 4/8/2021 20:52" } } diff --git a/src/Squot.package/SquotClassMirror.class/instance/capture.with..st b/src/Squot.package/SquotClassMirror.class/instance/capture.with.ifReplaced..st similarity index 86% rename from src/Squot.package/SquotClassMirror.class/instance/capture.with..st rename to src/Squot.package/SquotClassMirror.class/instance/capture.with.ifReplaced..st index 71114d769..ef91d13da 100644 --- a/src/Squot.package/SquotClassMirror.class/instance/capture.with..st +++ b/src/Squot.package/SquotClassMirror.class/instance/capture.with.ifReplaced..st @@ -1,5 +1,5 @@ capturing -capture: aClass with: aSquotObjectCapturer +capture: aClass with: aSquotObjectCapturer ifReplaced: aBlock aClass isMeta ifTrue: [self error: 'Should capture class, not metaclass']. ^ SquotClassShadow forPackageNamed: aClass category diff --git a/src/Squot.package/SquotClassMirror.class/methodProperties.json b/src/Squot.package/SquotClassMirror.class/methodProperties.json index 2d8cd243d..ec42643d5 100644 --- a/src/Squot.package/SquotClassMirror.class/methodProperties.json +++ b/src/Squot.package/SquotClassMirror.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { "class:" : "jr 1/10/2021 22:04" }, "instance" : { - "capture:with:" : "jr 4/8/2021 00:04", + "capture:with:ifReplaced:" : "jr 7/17/2021 23:56", "replacementFor:using:" : "jr 4/8/2021 22:30", "setReflectedClass:" : "jr 1/10/2021 22:05", "shouldObjectHaveNameAssigned:" : "jr 6/26/2021 22:27" } } diff --git a/src/Squot.package/SquotCompiledCodeMirror.class/instance/capture.with..st b/src/Squot.package/SquotCompiledCodeMirror.class/instance/capture.with..st deleted file mode 100644 index 3c44c5257..000000000 --- a/src/Squot.package/SquotCompiledCodeMirror.class/instance/capture.with..st +++ /dev/null @@ -1,8 +0,0 @@ -capturing -capture: anObject with: aSquotObjectCapturer - "Skip check for isBits." - | newShadow | - newShadow := self newShadowObject. - aSquotObjectCapturer rememberAsShadowOfCapturedObject: newShadow. - self initializeSnapshot: newShadow of: anObject with: aSquotObjectCapturer. - ^ newShadow \ No newline at end of file diff --git a/src/Squot.package/SquotCompiledCodeMirror.class/methodProperties.json b/src/Squot.package/SquotCompiledCodeMirror.class/methodProperties.json index 987cb0646..2233a5aa4 100644 --- a/src/Squot.package/SquotCompiledCodeMirror.class/methodProperties.json +++ b/src/Squot.package/SquotCompiledCodeMirror.class/methodProperties.json @@ -2,7 +2,6 @@ "class" : { }, "instance" : { - "capture:with:" : "jr 4/8/2021 20:51", "referencesFrom:" : "jr 4/7/2021 23:31", "reflectHeader:of:" : "jr 4/7/2021 23:17", "reflectHeader:of:put:" : "jr 4/7/2021 23:17", diff --git a/src/Squot.package/SquotDiskProxyMirror.class/instance/capture.with..st b/src/Squot.package/SquotDiskProxyMirror.class/instance/capture.with..st deleted file mode 100644 index b9aeb4f47..000000000 --- a/src/Squot.package/SquotDiskProxyMirror.class/instance/capture.with..st +++ /dev/null @@ -1,3 +0,0 @@ -capturing -capture: aDiskProxy with: aSquotObjectCapturer - ^ SquotDiskProxyShadow for: aDiskProxy \ No newline at end of file diff --git a/src/Squot.package/SquotDiskProxyMirror.class/instance/capture.with.ifReplaced..st b/src/Squot.package/SquotDiskProxyMirror.class/instance/capture.with.ifReplaced..st new file mode 100644 index 000000000..3cbaa68bf --- /dev/null +++ b/src/Squot.package/SquotDiskProxyMirror.class/instance/capture.with.ifReplaced..st @@ -0,0 +1,3 @@ +capturing +capture: aDiskProxy with: aSquotObjectCapturer ifReplaced: aBlock + ^ SquotDiskProxyShadow for: aDiskProxy \ No newline at end of file diff --git a/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json b/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json index 4676e810f..0f4524d20 100644 --- a/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json +++ b/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json @@ -2,5 +2,5 @@ "class" : { }, "instance" : { - "capture:with:" : "jr 4/8/2021 22:10", + "capture:with:ifReplaced:" : "jr 7/17/2021 23:57", "shouldObjectHaveNameAssigned:" : "jr 4/8/2021 22:05" } } diff --git a/src/Squot.package/SquotDiskProxyShadow.class/instance/assumeOriginalClassOf..st b/src/Squot.package/SquotDiskProxyShadow.class/instance/assumeOriginalClassOf..st new file mode 100644 index 000000000..a2af90bae --- /dev/null +++ b/src/Squot.package/SquotDiskProxyShadow.class/instance/assumeOriginalClassOf..st @@ -0,0 +1,3 @@ +initialize-release +assumeOriginalClassOf: anObject + "Do not need this." \ No newline at end of file diff --git a/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json b/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json index ab249945f..1232ba4ff 100644 --- a/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json +++ b/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json @@ -4,6 +4,7 @@ "squotMirror" : "jr 4/11/2021 18:32" }, "instance" : { "=" : "jr 4/8/2021 22:25", + "assumeOriginalClassOf:" : "jr 7/18/2021 00:07", "hash" : "jr 4/8/2021 22:22", "proxy" : "jr 4/8/2021 22:25", "sameIn:withName:ifAbsent:" : "jr 8/31/2019 20:43", diff --git a/src/Squot.package/SquotMirror.class/instance/capture.with..st b/src/Squot.package/SquotMirror.class/instance/capture.with.ifReplaced..st similarity index 68% rename from src/Squot.package/SquotMirror.class/instance/capture.with..st rename to src/Squot.package/SquotMirror.class/instance/capture.with.ifReplaced..st index 3c846be46..ac6817f5f 100644 --- a/src/Squot.package/SquotMirror.class/instance/capture.with..st +++ b/src/Squot.package/SquotMirror.class/instance/capture.with.ifReplaced..st @@ -1,6 +1,6 @@ capturing -capture: anObject with: aSquotObjectCapturer - "Answer a snapshot of the object." +capture: anObject with: aSquotObjectCapturer ifReplaced: aBlock + "Answer a snapshot of the object. If it is supposed to be replaced by a proxy, evaluate aBlock with the proxy before creating the snapshot of the proxy." "For objects that might have cyclic references, do not attempt to capture the whole object subgraph! Instead enumerate the references, only create the new shadow object and prepare it, then announce the references to the capturer with: aSquotObjectCapturer capture: referencedObject asValueOf: aReference from: anObject reflectedIn: aMirror intoValueOf: shadowsReference from: shadowOfAnObject reflectedIn: aShadowMirror" diff --git a/src/Squot.package/SquotMirror.class/methodProperties.json b/src/Squot.package/SquotMirror.class/methodProperties.json index 1c4246fa7..f045371cf 100644 --- a/src/Squot.package/SquotMirror.class/methodProperties.json +++ b/src/Squot.package/SquotMirror.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "capture:with:" : "jr 4/8/2021 21:03", + "capture:with:ifReplaced:" : "jr 7/17/2021 23:52", "mirrorForReplacement:" : "jr 4/8/2021 20:30", "mirrorOf:reachedVia:from:" : "jr 4/11/2021 20:56", "referencesFrom:" : "jr 12/16/2020 00:17", diff --git a/src/Squot.package/SquotObjectCapturer.class/instance/capture.reflectedIn..st b/src/Squot.package/SquotObjectCapturer.class/instance/capture.reflectedIn..st index af15e9ac9..cb9d5c3fc 100644 --- a/src/Squot.package/SquotObjectCapturer.class/instance/capture.reflectedIn..st +++ b/src/Squot.package/SquotObjectCapturer.class/instance/capture.reflectedIn..st @@ -1,29 +1,17 @@ private capture: aDecoratedObject reflectedIn: aMirror - | undecorated object replacement mirror shadow | + | undecorated object shadow | undecorated := aDecoratedObject undecorated. (convertedObjects includesKey: undecorated) ifTrue: [^ self]. capturedObject := undecorated. capturedObjectWithReferrer := aDecoratedObject. - mirror := aMirror. - object := replacedObjects at: undecorated ifAbsent: [aDecoratedObject]. - replacement := mirror replacementFor: object undecorated using: self. - replacement ~~ object undecorated ifTrue: - [object := replacement. - undecorated := object undecorated. - mirror := mirror mirrorForReplacement: undecorated. + object := replacedObjects at: undecorated ifAbsent: [undecorated]. + shadow := aMirror capture: object with: self ifReplaced: + [:proxy | (aMirror shouldObjectHaveNameAssigned: capturedObject) ifTrue: [objectGraph "Keep the identifier." answer: (objectGraph nameOf: capturedObject) - whenAskedForTheNameOf: undecorated]]. - (convertedObjects includesKey: object undecorated) ifTrue: [^ self]. - shadow := mirror capture: object with: self. - undecorated ~~ capturedObject ifTrue: - [self flag: #todo. "This should be the business of the mirror." - [shadow assumeOriginalClassOf: capturedObject] - on: MessageNotUnderstood do: - [:e | (e message selector == #assumeOriginalClassOf: and: [e receiver == shadow]) - ifTrue: [e return] - ifFalse: [e pass]]]. + whenAskedForTheNameOf: proxy undecorated]. + (convertedObjects includesKey: proxy undecorated) ifTrue: [^ self]]. self rememberAsShadowOfCapturedObject: shadow. "Safeguard against mirrors that do not register the shadow already." objectGraph addShadow: shadow of: capturedObject. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectCapturer.class/methodProperties.json b/src/Squot.package/SquotObjectCapturer.class/methodProperties.json index 3a75f158b..bec629ab4 100644 --- a/src/Squot.package/SquotObjectCapturer.class/methodProperties.json +++ b/src/Squot.package/SquotObjectCapturer.class/methodProperties.json @@ -6,7 +6,7 @@ "capture:as:" : "jr 4/8/2021 12:53", "capture:asValueOf:from:reflectedIn:intoValueOf:from:reflectedIn:" : "jr 7/17/2021 01:29", "capture:asValueOfSlot:" : "jr 4/8/2021 13:09", - "capture:reflectedIn:" : "jr 4/8/2021 21:28", + "capture:reflectedIn:" : "jr 7/18/2021 00:14", "captureBits:" : "jr 4/8/2021 13:11", "captureGraph:" : "jr 7/30/2017 14:10", "capturePrimitiveValue:" : "jr 4/8/2021 13:11", diff --git a/src/Squot.package/SquotObjectGraphMirror.class/instance/capture.with..st b/src/Squot.package/SquotObjectGraphMirror.class/instance/capture.with..st deleted file mode 100644 index 2df0750f8..000000000 --- a/src/Squot.package/SquotObjectGraphMirror.class/instance/capture.with..st +++ /dev/null @@ -1,9 +0,0 @@ -capturing -capture: anObject with: aSquotObjectCapturer - "Answer a snapshot of the object." - - "For objects that might have cyclic references, do not attempt to capture the whole object subgraph! Instead enumerate the references, only create the new shadow object and prepare it, then announce the references to the capturer with: - aSquotObjectCapturer capture: referencedObject asValueOf: aReference from: anObject reflectedIn: aMirror - intoValueOf: shadowsReference from: shadowOfAnObject reflectedIn: aShadowMirror" - - self shouldBeImplemented. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json b/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json index 38c6cd670..cada86579 100644 --- a/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json @@ -2,7 +2,6 @@ "class" : { "initialize" : "jr 6/27/2021 23:08" }, "instance" : { - "capture:with:" : "jr 6/17/2021 00:38", "defaultMirrorOf:" : "jr 7/4/2021 19:40", "mirrorOf:reachedVia:from:" : "jr 7/17/2021 21:11", "referencesFrom:" : "jr 6/27/2021 22:20", diff --git a/src/Squot.package/SquotObjectMirror.class/instance/capture.with..st b/src/Squot.package/SquotObjectMirror.class/instance/capture.with..st deleted file mode 100644 index 3236d6862..000000000 --- a/src/Squot.package/SquotObjectMirror.class/instance/capture.with..st +++ /dev/null @@ -1,8 +0,0 @@ -capturing -capture: anObject with: aSquotObjectCapturer - "Use aCapturer to answer a conserved form of me that is suitable to be stored in Snapshots." - | newShadow | - newShadow := self newShadowObject. - aSquotObjectCapturer rememberAsShadowOfCapturedObject: newShadow. - self initializeSnapshot: newShadow of: anObject with: aSquotObjectCapturer. - ^ newShadow \ No newline at end of file diff --git a/src/Squot.package/SquotObjectMirror.class/instance/capture.with.ifReplaced..st b/src/Squot.package/SquotObjectMirror.class/instance/capture.with.ifReplaced..st new file mode 100644 index 000000000..23f8a6ba5 --- /dev/null +++ b/src/Squot.package/SquotObjectMirror.class/instance/capture.with.ifReplaced..st @@ -0,0 +1,18 @@ +capturing +capture: anObject with: aSquotObjectCapturer ifReplaced: aBlock + "Use aCapturer to answer a conserved form of me that is suitable to be stored in Snapshots." + | newShadow proxy | + proxy := self replacementFor: anObject using: aSquotObjectCapturer. + proxy undecorated == anObject + ifTrue: + [newShadow := self newShadowObject. + aSquotObjectCapturer rememberAsShadowOfCapturedObject: newShadow. + self initializeSnapshot: newShadow of: anObject with: aSquotObjectCapturer] + ifFalse: + [aBlock value: proxy. + newShadow := (self mirrorForReplacement: proxy undecorated) + capture: proxy undecorated + with: aSquotObjectCapturer + ifReplaced: aBlock. + newShadow assumeOriginalClassOf: anObject]. + ^ newShadow \ No newline at end of file diff --git a/src/Squot.package/SquotObjectMirror.class/methodProperties.json b/src/Squot.package/SquotObjectMirror.class/methodProperties.json index 0b3c01f60..2dc33f197 100644 --- a/src/Squot.package/SquotObjectMirror.class/methodProperties.json +++ b/src/Squot.package/SquotObjectMirror.class/methodProperties.json @@ -3,7 +3,7 @@ "class:" : "jr 12/15/2020 23:32" }, "instance" : { "=" : "jr 12/15/2020 23:33", - "capture:with:" : "jr 4/8/2021 21:16", + "capture:with:ifReplaced:" : "jr 7/17/2021 23:51", "hash" : "jr 12/15/2020 23:33", "initializeSnapshot:of:with:" : "jr 4/8/2021 21:23", "newShadowObject" : "jr 4/3/2021 20:59", diff --git a/src/Squot.package/SquotPackageShadowMirror.class/instance/capture.with..st b/src/Squot.package/SquotObjectShadowMirror.class/instance/capture.with.ifReplaced..st similarity index 61% rename from src/Squot.package/SquotPackageShadowMirror.class/instance/capture.with..st rename to src/Squot.package/SquotObjectShadowMirror.class/instance/capture.with.ifReplaced..st index 1060ec6bb..1df56409b 100644 --- a/src/Squot.package/SquotPackageShadowMirror.class/instance/capture.with..st +++ b/src/Squot.package/SquotObjectShadowMirror.class/instance/capture.with.ifReplaced..st @@ -1,3 +1,3 @@ capturing -capture: anObject with: aSquotObjectCapturer +capture: anObject with: aSquotObjectCapturer ifReplaced: aBlock self shouldNotImplement. "Shadows should not be captured again. They are snapshots already." \ No newline at end of file diff --git a/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json b/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json index 5438821fb..8c9925870 100644 --- a/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json +++ b/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json @@ -3,7 +3,7 @@ "class:" : "jr 12/15/2020 23:32" }, "instance" : { "=" : "jr 12/15/2020 23:33", - "capture:with:" : "jr 1/16/2021 11:30", + "capture:with:ifReplaced:" : "jr 7/17/2021 23:58", "captureReferences:from:reflectedIn:into:with:" : "jr 4/8/2021 21:23", "hash" : "jr 12/15/2020 23:33", "newShadowObject" : "jr 4/3/2021 21:00", diff --git a/src/Squot.package/SquotOpaqueValueMirror.class/instance/capture.with..st b/src/Squot.package/SquotOpaqueValueMirror.class/instance/capture.with..st deleted file mode 100644 index c2891dc34..000000000 --- a/src/Squot.package/SquotOpaqueValueMirror.class/instance/capture.with..st +++ /dev/null @@ -1,3 +0,0 @@ -capturing -capture: anObject with: aSquotObjectCapturer - ^ SquotPrimitiveValue for: anObject \ No newline at end of file diff --git a/src/Squot.package/SquotOpaqueValueMirror.class/instance/capture.with.ifReplaced..st b/src/Squot.package/SquotOpaqueValueMirror.class/instance/capture.with.ifReplaced..st new file mode 100644 index 000000000..480490656 --- /dev/null +++ b/src/Squot.package/SquotOpaqueValueMirror.class/instance/capture.with.ifReplaced..st @@ -0,0 +1,3 @@ +capturing +capture: anObject with: aSquotObjectCapturer ifReplaced: aBlock + ^ SquotPrimitiveValue for: anObject \ No newline at end of file diff --git a/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json b/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json index b4ff53b20..7190e1dc3 100644 --- a/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json +++ b/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json @@ -3,7 +3,7 @@ }, "instance" : { "=" : "jr 4/8/2021 20:17", - "capture:with:" : "jr 4/8/2021 21:06", + "capture:with:ifReplaced:" : "jr 7/17/2021 23:58", "hash" : "jr 4/8/2021 20:16", "referencesFrom:" : "jr 4/8/2021 20:14", "shouldObjectHaveNameAssigned:" : "jr 4/8/2021 20:15" } } diff --git a/src/Squot.package/SquotPackageMirror.class/instance/capture.with..st b/src/Squot.package/SquotPackageMirror.class/instance/capture.with.ifReplaced..st similarity index 91% rename from src/Squot.package/SquotPackageMirror.class/instance/capture.with..st rename to src/Squot.package/SquotPackageMirror.class/instance/capture.with.ifReplaced..st index 1c975d24b..1cdd266bb 100644 --- a/src/Squot.package/SquotPackageMirror.class/instance/capture.with..st +++ b/src/Squot.package/SquotPackageMirror.class/instance/capture.with.ifReplaced..st @@ -1,5 +1,5 @@ capturing -capture: aPackageInfo with: aSquotObjectCapturer +capture: aPackageInfo with: aSquotObjectCapturer ifReplaced: aBlock | environment mcEnvironment snapshot | aSquotObjectCapturer flag: #unusedArgument. environment := self environmentInMetadata: SquotCurrentMetadata value. diff --git a/src/Squot.package/SquotPackageMirror.class/methodProperties.json b/src/Squot.package/SquotPackageMirror.class/methodProperties.json index 06e8df5af..a53fa5694 100644 --- a/src/Squot.package/SquotPackageMirror.class/methodProperties.json +++ b/src/Squot.package/SquotPackageMirror.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "capture:with:" : "jr 4/7/2021 22:42", + "capture:with:ifReplaced:" : "jr 7/17/2021 23:59", "environmentInMetadata:" : "jr 4/7/2021 22:40", "newShadowObject" : "jr 4/7/2021 22:41", "referencesFrom:" : "jr 6/27/2021 23:24", diff --git a/src/Squot.package/SquotObjectShadowMirror.class/instance/capture.with..st b/src/Squot.package/SquotPackageShadowMirror.class/instance/capture.with.ifReplaced..st similarity index 61% rename from src/Squot.package/SquotObjectShadowMirror.class/instance/capture.with..st rename to src/Squot.package/SquotPackageShadowMirror.class/instance/capture.with.ifReplaced..st index 1060ec6bb..1df56409b 100644 --- a/src/Squot.package/SquotObjectShadowMirror.class/instance/capture.with..st +++ b/src/Squot.package/SquotPackageShadowMirror.class/instance/capture.with.ifReplaced..st @@ -1,3 +1,3 @@ capturing -capture: anObject with: aSquotObjectCapturer +capture: anObject with: aSquotObjectCapturer ifReplaced: aBlock self shouldNotImplement. "Shadows should not be captured again. They are snapshots already." \ No newline at end of file diff --git a/src/Squot.package/SquotPackageShadowMirror.class/methodProperties.json b/src/Squot.package/SquotPackageShadowMirror.class/methodProperties.json index 99ae13500..cd1c0ae42 100644 --- a/src/Squot.package/SquotPackageShadowMirror.class/methodProperties.json +++ b/src/Squot.package/SquotPackageShadowMirror.class/methodProperties.json @@ -2,6 +2,6 @@ "class" : { }, "instance" : { - "capture:with:" : "jr 6/16/2021 22:27", + "capture:with:ifReplaced:" : "jr 7/17/2021 23:59", "referencesFrom:" : "jr 6/16/2021 22:27", "shouldObjectHaveNameAssigned:" : "jr 6/16/2021 22:28" } } diff --git a/src/Squot.package/SquotStringMirror.class/instance/capture.with..st b/src/Squot.package/SquotStringMirror.class/instance/capture.with..st deleted file mode 100644 index 195e67944..000000000 --- a/src/Squot.package/SquotStringMirror.class/instance/capture.with..st +++ /dev/null @@ -1,7 +0,0 @@ -capturing -capture: aString with: aSquotObjectCapturer - | newShadow | - newShadow := self newShadowObject. - aSquotObjectCapturer rememberAsShadowOfCapturedObject: newShadow. - newShadow value: (aString copy flag: #todo). "Using copies of the string means that those string snapshots are still recognized as real strings by the meta object protocol.". - ^ newShadow \ No newline at end of file diff --git a/src/Squot.package/SquotStringMirror.class/instance/capture.with.ifReplaced..st b/src/Squot.package/SquotStringMirror.class/instance/capture.with.ifReplaced..st new file mode 100644 index 000000000..30756925a --- /dev/null +++ b/src/Squot.package/SquotStringMirror.class/instance/capture.with.ifReplaced..st @@ -0,0 +1,7 @@ +capturing +capture: aString with: aSquotObjectCapturer ifReplaced: aBlock + | newShadow | + newShadow := self newShadowObject. + aSquotObjectCapturer rememberAsShadowOfCapturedObject: newShadow. + self initializeSnapshot: newShadow of: aString with: aSquotObjectCapturer. + ^ newShadow \ No newline at end of file diff --git a/src/Squot.package/SquotStringMirror.class/instance/initializeSnapshot.of.with..st b/src/Squot.package/SquotStringMirror.class/instance/initializeSnapshot.of.with..st new file mode 100644 index 000000000..82ce71bdf --- /dev/null +++ b/src/Squot.package/SquotStringMirror.class/instance/initializeSnapshot.of.with..st @@ -0,0 +1,3 @@ +capturing +initializeSnapshot: aSquotObjectShadow of: aString with: aSquotObjectCapturer + aSquotObjectShadow value: (aString copy flag: #todo). "Using copies of the string means that those string snapshots are still recognized as real strings by the meta object protocol.". \ No newline at end of file diff --git a/src/Squot.package/SquotStringMirror.class/methodProperties.json b/src/Squot.package/SquotStringMirror.class/methodProperties.json index 00c8dda80..b3695bed4 100644 --- a/src/Squot.package/SquotStringMirror.class/methodProperties.json +++ b/src/Squot.package/SquotStringMirror.class/methodProperties.json @@ -3,8 +3,9 @@ "class:" : "jr 12/15/2020 23:32" }, "instance" : { "=" : "jr 12/15/2020 23:33", - "capture:with:" : "jr 4/8/2021 21:07", + "capture:with:ifReplaced:" : "jr 7/18/2021 00:05", "hash" : "jr 12/15/2020 23:33", + "initializeSnapshot:of:with:" : "jr 7/18/2021 00:00", "newShadowObject" : "jr 4/7/2021 20:42", "referencesFrom:" : "jr 12/16/2020 01:51", "reflectIndexableField:in:" : "jr 12/16/2020 00:04", diff --git a/src/Squot.package/SquotSystemSingletonMirror.class/instance/capture.with..st b/src/Squot.package/SquotSystemSingletonMirror.class/instance/capture.with.ifReplaced..st similarity index 76% rename from src/Squot.package/SquotSystemSingletonMirror.class/instance/capture.with..st rename to src/Squot.package/SquotSystemSingletonMirror.class/instance/capture.with.ifReplaced..st index dd0c5d00b..07277e820 100644 --- a/src/Squot.package/SquotSystemSingletonMirror.class/instance/capture.with..st +++ b/src/Squot.package/SquotSystemSingletonMirror.class/instance/capture.with.ifReplaced..st @@ -1,4 +1,4 @@ capturing -capture: singleton with: aSquotObjectCapturer +capture: singleton with: aSquotObjectCapturer ifReplaced: aBlock self flag: #todo. "Check whether immediate objects and global singletons such as true, false, nil should not just stand in for themselves instead of wrapping them." ^ SquotPrimitiveValue for: singleton \ No newline at end of file diff --git a/src/Squot.package/SquotSystemSingletonMirror.class/methodProperties.json b/src/Squot.package/SquotSystemSingletonMirror.class/methodProperties.json index f0650b0ad..24ff99279 100644 --- a/src/Squot.package/SquotSystemSingletonMirror.class/methodProperties.json +++ b/src/Squot.package/SquotSystemSingletonMirror.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { "class:" : "jr 1/17/2021 22:27" }, "instance" : { - "capture:with:" : "jr 4/8/2021 21:08", + "capture:with:ifReplaced:" : "jr 7/18/2021 00:00", "referencesFrom:" : "jr 6/13/2021 21:28", "setClass:" : "jr 12/15/2020 23:33", "shouldObjectHaveNameAssigned:" : "jr 1/17/2021 22:29" } } From 7f023a9e1cbe7537393b95923adca90a7d5d4b78 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 18 Jul 2021 00:20:26 +0200 Subject: [PATCH 05/43] Remove replaced methods from the materializer The equivalent methods of SquotPatcher are used instead. --- ...ndOrCreateAndRematerialize.reflectedIn..st | 10 --- .../instance/reactivate..st | 23 ------ .../instance/rematerialize.reflectedIn..st | 77 ------------------- .../instance/sourceNameOf.ifPresent..st | 1 + .../instance/wasReactivated..st | 3 - .../methodProperties.json | 8 +- 6 files changed, 3 insertions(+), 119 deletions(-) delete mode 100644 src/Squot.package/SquotShadowMaterializer.class/instance/findOrCreateAndRematerialize.reflectedIn..st delete mode 100644 src/Squot.package/SquotShadowMaterializer.class/instance/reactivate..st delete mode 100644 src/Squot.package/SquotShadowMaterializer.class/instance/rematerialize.reflectedIn..st delete mode 100644 src/Squot.package/SquotShadowMaterializer.class/instance/wasReactivated..st diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/findOrCreateAndRematerialize.reflectedIn..st b/src/Squot.package/SquotShadowMaterializer.class/instance/findOrCreateAndRematerialize.reflectedIn..st deleted file mode 100644 index 31a172838..000000000 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/findOrCreateAndRematerialize.reflectedIn..st +++ /dev/null @@ -1,10 +0,0 @@ -converting -findOrCreateAndRematerialize: aShadow reflectedIn: aMirror - | existing materialized | - self sourceNameOf: aShadow ifPresent: [:name | - existing := objectRegistry objectNamed: name ifAbsent: []. - (existing notNil and: [existing squotShouldKeepIdentity]) - ifTrue: [materialized := existing]]. - materialized ifNil: [materialized := aShadow squotMaterializeWith: self]. - "The references of anObject are not yet filled in here. Also the object does not get activated yet." - ^ materialized \ No newline at end of file diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/reactivate..st b/src/Squot.package/SquotShadowMaterializer.class/instance/reactivate..st deleted file mode 100644 index 9ad11b027..000000000 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/reactivate..st +++ /dev/null @@ -1,23 +0,0 @@ -private -reactivate: anObject - | materializedObject | - materializedObject := anObject squotReactivateWith: self. - "Update all known references to the reactivated object where its hash matters. Reactivate each object that needs no more references to be filled in." - (pendingReferencesForHash removeKey: (convertedObjects keyAtValue: anObject) ifAbsent: [#()]) do: - [:eachTuple | | referrer mirror reference materializedReference remaining | - referrer := eachTuple first. mirror := eachTuple second. reference := eachTuple third. - remaining := remainingReferences at: referrer. - materializedReference := reference asMaterializedReference. - materializedReference reflect: referrer in: mirror put: materializedObject. - remaining remove: reference. - remaining ifEmpty: - ["Reactivate object if all references are filled in now." - remainingReferences removeKey: referrer. - self reactivate: referrer]]. - self haltIf: (anObject ~~ materializedObject "Safeguard against dangerous become operations." - and: ["anObject was not freshly created during this materialization" (true flag: #todo "formerly thisContext sender method ~~ (SquotObjectShadow >> #squotMaterializeWith:)") - and: [anObject class isWeak not]]). - anObject ~~ materializedObject ifTrue: - "For example if anObject is a DiskProxy." - [anObject becomeForward: materializedObject copyHash: false]. - ^ anObject \ No newline at end of file diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/rematerialize.reflectedIn..st b/src/Squot.package/SquotShadowMaterializer.class/instance/rematerialize.reflectedIn..st deleted file mode 100644 index 70bc660ce..000000000 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/rematerialize.reflectedIn..st +++ /dev/null @@ -1,77 +0,0 @@ -public converting -rematerialize: aShadow reflectedIn: aMirror - | materialized name materializedMirror remaining firstReferrer | - convertedObjects at: aShadow undecorated ifPresent: [:it | ^ it]. - self assert: (aShadow hasSquotShadowName not or: [sourceGraph includesObjectNamed: aShadow name]) - description: 'Source graph does not contain shadow. Where does it come from?'. - "Create instance or look up existing one." - materialized := self findOrCreateAndRematerialize: aShadow reflectedIn: aMirror. - convertedObjects at: aShadow undecorated put: materialized. - "Determine correct mirror to use for the materialized object." - pendingReferences at: aShadow undecorated - ifPresent: - [:pending | | referrer mirror reference materializedReference | - referrer := pending first first. mirror := pending first second. reference := pending first third. - materializedReference := reference asMaterializedReference. - firstReferrer := {referrer. mirror. materializedReference}] - ifAbsent: [firstReferrer := nil]. - materializedMirror := - firstReferrer - ifNil: [materialized class squotMirror] - ifNotNil: - [ | referrerMirror materializedReferrer reference | - materializedReferrer := firstReferrer first. - referrerMirror := firstReferrer second. - reference := firstReferrer third. - referrerMirror mirrorOf: materialized reachedVia: reference from: materializedReferrer]. - "Fill in all references of the new object whose values have already been materialized. Remember the other references to update them later." - remaining := OrderedCollection new. - (aMirror referencesFrom: aShadow) do: - [:eachReference | | value | value := eachReference reflect: aShadow in: aMirror. - convertedObjects at: value undecorated - ifPresent: - [:materializedValue | - (eachReference isHashRelevant and: [(self wasReactivated: materializedValue) not]) - ifTrue: ["Fill in later" - remaining add: eachReference. - (pendingReferencesForHash at: value undecorated ifAbsentPut: [OrderedCollection new]) - add: {materialized. materializedMirror. eachReference}] - ifFalse: [eachReference asMaterializedReference reflect: materialized in: materializedMirror put: materializedValue]] - ifAbsent: - [walk add: value -> (aMirror mirrorOf: (eachReference reflect: aShadow in: aMirror) undecorated reachedVia: eachReference from: aShadow) reachedVia: eachReference. - remaining add: eachReference. - eachReference isHashRelevant - ifTrue: - [(pendingReferencesForHash at: value undecorated ifAbsentPut: [OrderedCollection new]) - add: {materialized. materializedMirror. eachReference}] - ifFalse: - [(pendingReferences at: value undecorated ifAbsentPut: [OrderedCollection new]) - add: {materialized. materializedMirror. eachReference}]]]. - remaining - ifEmpty: - ["Reactivate object if all references are filled in already." - self reactivate: materialized] - ifNotEmpty: [remainingReferences at: materialized put: remaining]. - "Update all known references to the new object where its hash does not matter. Reactivate each object that needs no more references to be filled in." - (pendingReferences removeKey: aShadow undecorated ifAbsent: [#()]) do: - [:eachTuple | | referrer mirror reference materializedReference | - referrer := eachTuple first. mirror := eachTuple second. reference := eachTuple third. - remaining := remainingReferences at: referrer. - materializedReference := reference asMaterializedReference. - materializedReference reflect: referrer in: mirror put: materialized. - remaining remove: reference. - remaining ifEmpty: - ["Reactivate object if all references are filled in now." - remainingReferences removeKey: referrer. - self reactivate: referrer]]. - "Assign identifier if any." - name := sourceGraph nameOf: aShadow undecorated ifAbsent: []. - (name isNil and: [aShadow hasSquotShadowName]) - ifTrue: [name := aShadow name]. - (materializedMirror shouldObjectHaveNameAssigned: materialized) - ifTrue: - [name - ifNil: [self error: 'Object has no name but it should have'] - ifNotNil: [objectRegistry nameOf: materialized ifAbsentAssign: [name]]]. - name ifNotNil: [targetGraph assign: name to: materialized]. - ^ materialized \ No newline at end of file diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/sourceNameOf.ifPresent..st b/src/Squot.package/SquotShadowMaterializer.class/instance/sourceNameOf.ifPresent..st index 2e0b8e1ca..9174f9317 100644 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/sourceNameOf.ifPresent..st +++ b/src/Squot.package/SquotShadowMaterializer.class/instance/sourceNameOf.ifPresent..st @@ -1,6 +1,7 @@ converting sourceNameOf: aShadow ifPresent: unaryBlock | name | + self deprecated. sourceGraph ifNotNil: [name := sourceGraph nameOf: aShadow undecorated ifAbsent: []. name ifNotNil: [^ unaryBlock value: name]]. diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/wasReactivated..st b/src/Squot.package/SquotShadowMaterializer.class/instance/wasReactivated..st deleted file mode 100644 index 732fdc5c4..000000000 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/wasReactivated..st +++ /dev/null @@ -1,3 +0,0 @@ -private -wasReactivated: anObject - ^ (remainingReferences includesKey: anObject) not \ No newline at end of file diff --git a/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json b/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json index 248522da4..8cfa2539e 100644 --- a/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json +++ b/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json @@ -3,20 +3,16 @@ }, "instance" : { "findOrCreateAndRematerialize:" : "jr 7/17/2021 02:06", - "findOrCreateAndRematerialize:reflectedIn:" : "jr 4/10/2021 12:30", "initialize" : "jr 7/30/2017 22:04", "materialize:in:" : "jr 4/10/2021 11:58", "objectGraph" : "jr 7/30/2017 02:18", - "reactivate:" : "jr 4/17/2021 19:02", "registry" : "jr 7/29/2017 18:15", "registry:" : "jr 7/6/2017 15:29", "rematerialize:" : "jr 7/17/2021 02:06", - "rematerialize:reflectedIn:" : "jr 6/11/2021 21:41", "rematerializeGraph:" : "jr 7/10/2021 13:42", "rematerializeGraph:into:" : "jr 7/17/2021 02:11", "sourceGraph" : "jr 7/30/2017 02:20", "sourceGraph:" : "jr 7/30/2017 02:20", - "sourceNameOf:ifPresent:" : "jr 8/13/2017 20:58", + "sourceNameOf:ifPresent:" : "jr 7/18/2021 00:19", "targetGraph" : "jr 7/30/2017 02:15", - "targetGraph:" : "jr 7/30/2017 02:15", - "wasReactivated:" : "jr 4/17/2021 18:29" } } + "targetGraph:" : "jr 7/30/2017 02:15" } } From 3c534bd6b56a6dc4b2960f2ddcd79eaf01267756 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 18 Jul 2021 00:23:51 +0200 Subject: [PATCH 06/43] Mark unused method as deprecated --- .../SquotBitsObjectShadow.class/instance/materializeAs.with..st | 1 + .../SquotBitsObjectShadow.class/methodProperties.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Squot.package/SquotBitsObjectShadow.class/instance/materializeAs.with..st b/src/Squot.package/SquotBitsObjectShadow.class/instance/materializeAs.with..st index bb95787be..aac80c461 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/instance/materializeAs.with..st +++ b/src/Squot.package/SquotBitsObjectShadow.class/instance/materializeAs.with..st @@ -1,6 +1,7 @@ materializing materializeAs: anObject with: aMaterializer | size | + self deprecated. size := value basicSize. (size == anObject basicSize and: [value class format == anObject class format]) ifFalse: [^ self squotMaterializeWith: aMaterializer]. diff --git a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json index a776ec267..b21a1295b 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json +++ b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json @@ -6,7 +6,7 @@ "applySequenceDiff:with:" : "jr 6/27/2017 16:59", "copyBitsFrom:" : "jr 4/8/2021 20:55", "initializeFrom:with:" : "jr 1/11/2021 00:08", - "materializeAs:with:" : "jr 3/30/2020 22:11", + "materializeAs:with:" : "jr 7/18/2021 00:22", "privateApplySequenceDiff:" : "jr 9/24/2019 00:24", "privateApplySequenceDiff:with:" : "jr 10/24/2017 23:42", "sameIn:withName:ifAbsent:" : "jr 9/6/2019 22:33", From f0a813826bafa41968815804e8e90844ae37f64b Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 18 Jul 2021 00:59:01 +0200 Subject: [PATCH 07/43] Clean up long object graph patching method --- ...quotReflectOn.in.ifNewValue.ifOldValue..st | 3 -- .../squotValueShadowFrom.reflectedIn..st | 3 ++ .../methodProperties.json | 4 +- ...quotReflectOn.in.ifNewValue.ifOldValue..st | 5 -- .../squotValueShadowFrom.reflectedIn..st | 5 ++ .../methodProperties.json | 4 +- .../instance/apply.toLoadedGraph..st | 51 ++++--------------- ...eflectedIn.from.ifDeferred.nextDiffsDo..st | 27 ++++++++++ ...DeferredUntilActivated.ifNotTreatedYet..st | 10 ++-- ...fAnyTo.reflectedIn.in.materializedFrom..st | 10 ++++ .../SquotPatcher.class/methodProperties.json | 6 ++- ...quotReflectOn.in.ifNewValue.ifOldValue..st | 3 -- .../squotValueShadowFrom.reflectedIn..st | 3 ++ .../methodProperties.json | 4 +- ...quotReflectOn.in.ifNewValue.ifOldValue..st | 5 -- .../squotValueShadowFrom.reflectedIn..st | 5 ++ .../methodProperties.json | 4 +- ...quotReflectOn.in.ifNewValue.ifOldValue..st | 4 -- .../squotValueShadowFrom.reflectedIn..st | 4 ++ .../methodProperties.json | 4 +- 20 files changed, 85 insertions(+), 79 deletions(-) delete mode 100644 src/Squot.package/SquotDifferentReferenceTarget.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st create mode 100644 src/Squot.package/SquotDifferentReferenceTarget.class/instance/squotValueShadowFrom.reflectedIn..st delete mode 100644 src/Squot.package/SquotObjectGraphDiffKickoffReference.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st create mode 100644 src/Squot.package/SquotObjectGraphDiffKickoffReference.class/instance/squotValueShadowFrom.reflectedIn..st create mode 100644 src/Squot.package/SquotPatcher.class/instance/applyReferenceDiff.to.reflectedIn.new.reflectedIn.old.reflectedIn.from.ifDeferred.nextDiffsDo..st create mode 100644 src/Squot.package/SquotPatcher.class/instance/assignIdentifierIfAnyTo.reflectedIn.in.materializedFrom..st delete mode 100644 src/Squot.package/SquotReferenceAddition.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st create mode 100644 src/Squot.package/SquotReferenceAddition.class/instance/squotValueShadowFrom.reflectedIn..st delete mode 100644 src/Squot.package/SquotReferenceDiff.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st create mode 100644 src/Squot.package/SquotReferenceDiff.class/instance/squotValueShadowFrom.reflectedIn..st delete mode 100644 src/Squot.package/SquotReferenceRemoval.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st create mode 100644 src/Squot.package/SquotReferenceRemoval.class/instance/squotValueShadowFrom.reflectedIn..st diff --git a/src/Squot.package/SquotDifferentReferenceTarget.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st b/src/Squot.package/SquotDifferentReferenceTarget.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st deleted file mode 100644 index 4bcc6d2a3..000000000 --- a/src/Squot.package/SquotDifferentReferenceTarget.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st +++ /dev/null @@ -1,3 +0,0 @@ -patching -squotReflectOn: anObject in: aMirror ifNewValue: newBlock ifOldValue: oldBlock - ^ newBlock value: rightTarget \ No newline at end of file diff --git a/src/Squot.package/SquotDifferentReferenceTarget.class/instance/squotValueShadowFrom.reflectedIn..st b/src/Squot.package/SquotDifferentReferenceTarget.class/instance/squotValueShadowFrom.reflectedIn..st new file mode 100644 index 000000000..9edbfc90c --- /dev/null +++ b/src/Squot.package/SquotDifferentReferenceTarget.class/instance/squotValueShadowFrom.reflectedIn..st @@ -0,0 +1,3 @@ +patching +squotValueShadowFrom: anObject reflectedIn: aMirror + ^ rightTarget \ No newline at end of file diff --git a/src/Squot.package/SquotDifferentReferenceTarget.class/methodProperties.json b/src/Squot.package/SquotDifferentReferenceTarget.class/methodProperties.json index 225cce66c..46c66caa1 100644 --- a/src/Squot.package/SquotDifferentReferenceTarget.class/methodProperties.json +++ b/src/Squot.package/SquotDifferentReferenceTarget.class/methodProperties.json @@ -4,5 +4,5 @@ "instance" : { "printOn:" : "jr 6/16/2021 21:19", "setReference:leftOwner:target:rightOwner:target:" : "jr 12/24/2020 01:03", - "squotReflectOn:in:ifNewValue:ifOldValue:" : "jr 6/20/2021 19:13", - "squotReflectOn:in:withValue:" : "jr 6/20/2021 21:01" } } + "squotReflectOn:in:withValue:" : "jr 6/20/2021 21:01", + "squotValueShadowFrom:reflectedIn:" : "jr 7/18/2021 00:37" } } diff --git a/src/Squot.package/SquotObjectGraphDiffKickoffReference.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st b/src/Squot.package/SquotObjectGraphDiffKickoffReference.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st deleted file mode 100644 index 8d56308ba..000000000 --- a/src/Squot.package/SquotObjectGraphDiffKickoffReference.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st +++ /dev/null @@ -1,5 +0,0 @@ -patching -squotReflectOn: anObject in: aMirror ifNewValue: newValueBlock ifOldValue: oldValueBlock - ^ objectDiff isRemoval - ifTrue: [oldValueBlock value: (reference reflect: leftOwner in: leftOwnerMirror)] - ifFalse: [newValueBlock value: (reference reflect: rightOwner in: rightOwnerMirror)] \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphDiffKickoffReference.class/instance/squotValueShadowFrom.reflectedIn..st b/src/Squot.package/SquotObjectGraphDiffKickoffReference.class/instance/squotValueShadowFrom.reflectedIn..st new file mode 100644 index 000000000..49520a047 --- /dev/null +++ b/src/Squot.package/SquotObjectGraphDiffKickoffReference.class/instance/squotValueShadowFrom.reflectedIn..st @@ -0,0 +1,5 @@ +patching +squotValueShadowFrom: aShadow reflectedIn: aMirror + ^ objectDiff isRemoval + ifTrue: [reference reflect: leftOwner in: leftOwnerMirror] + ifFalse: [reference reflect: rightOwner in: rightOwnerMirror] \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphDiffKickoffReference.class/methodProperties.json b/src/Squot.package/SquotObjectGraphDiffKickoffReference.class/methodProperties.json index a16dd72b9..856c9e138 100644 --- a/src/Squot.package/SquotObjectGraphDiffKickoffReference.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphDiffKickoffReference.class/methodProperties.json @@ -14,5 +14,5 @@ "rightOwnerMirror:" : "jr 6/20/2021 17:25", "setReference:leftOwner:leftOwnerMirror:rightOwner:rightOwnerMirror:objectDiff:" : "jr 6/27/2021 22:12", "squotReflectOn:in:" : "jr 6/20/2021 17:11", - "squotReflectOn:in:ifNewValue:ifOldValue:" : "jr 6/20/2021 19:12", - "squotReflectOn:in:withValue:" : "jr 6/20/2021 20:12" } } + "squotReflectOn:in:withValue:" : "jr 6/20/2021 20:12", + "squotValueShadowFrom:reflectedIn:" : "jr 7/18/2021 00:36" } } diff --git a/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st b/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st index 5fa06da02..40823a2fd 100644 --- a/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st +++ b/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st @@ -7,58 +7,25 @@ apply: aGraphDiff toLoadedGraph: anObjectGraph "queue diff for start and updating the start reference" walk := SquotGraphWalk startingFrom: {aGraphDiff asStartDiff. anObjectGraph. SquotObjectGraphMirror new. aGraphDiff right. SquotObjectGraphMirror new. aGraphDiff left. SquotObjectGraphMirror new}. walk doNotTrackReferrers. - "queue all diffs, each diff contains one or more updates to the references of its target object" - "apply all diffs to their objects, updating their references, refreshing the objects when all their references were updated" - "updating a reference might entail materializing new objects, filling in of their references should be queued likewise" [walk atEnd] whileFalse: - [ | next diff object mirror newShadow shadowMirror oldShadow oldShadowMirror remaining name | + [ | next diff object mirror newShadow shadowMirror oldShadow oldShadowMirror remaining | next := walk next. diff := next first. object := next second. mirror := next third. newShadow := next fourth. shadowMirror := next fifth. oldShadow := next sixth. oldShadowMirror := next seventh. object := diff update: object reflectedIn: mirror asMaterializedFrom: newShadow reflectedIn: shadowMirror. "Oftentimes the new object is also the old object (same instance)." self flag: #todo. "But if it is not, we need a new mirror." self take: object asMaterializedFrom: newShadow. remaining := OrderedCollection new. - diff referenceDiffsWithDefaultOwners: {newShadow "because we do not have the original shadow readily available, and in most cases the original one does not matter". newShadow} reflectedIn: shadowMirror do: - [:each | | block | - block := - [:valueShadow | - self applying: each - fill: valueShadow reachedVia: each reference - into: object reflectedIn: mirror - ifDeferredUntilActivated: [remaining add: each reference] - ifNotTreatedYet: - ["Could be new or just not yet patched." - | value isNew valueMirror valueShadowMirror valueName valueDiff | - valueShadowMirror := shadowMirror mirrorOf: valueShadow undecorated reachedVia: each reference from: newShadow undecorated. - isNew := false. - value := self findOrCreateMaterializedInstanceOf: valueShadow reflectedIn: valueShadowMirror ifNew: [:newValue | isNew := true]. - valueMirror := mirror mirrorOf: value reachedVia: each reference from: object. - valueName := aGraphDiff right nameOf: valueShadow undecorated ifAbsent: []. - valueDiff := aGraphDiff diffForObjectNamed: valueName ifAbsent: []. - isNew & valueDiff isNil - ifTrue: [valueDiff := SquotObjectAddition of: valueShadow]. - valueDiff - ifNil: [each squotReflectOn: object in: mirror withValue: value] - ifNotNil: - [| oldValueShadow | - oldValueShadow := (valueName ifNil: [valueShadow] ifNotNil: [aGraphDiff left shadowNamed: valueName ifAbsent: [valueShadow]]) undecorated. - walk add: {valueDiff. value. valueMirror. valueShadow. valueShadowMirror. oldValueShadow. oldShadowMirror mirrorOf: oldValueShadow reachedVia: each reference from: oldShadow} reachedVia: each. - remaining add: each reference]]]. - each squotReflectOn: oldShadow in: oldShadowMirror - ifNewValue: block - ifOldValue: block]. + diff referenceDiffsWithDefaultOwners: {oldShadow. newShadow} reflectedIn: shadowMirror do: + [:each | self applyReferenceDiff: each to: object reflectedIn: mirror + new: newShadow reflectedIn: shadowMirror + old: oldShadow reflectedIn: oldShadowMirror + from: aGraphDiff + ifDeferred: [remaining add: each reference] + nextDiffsDo: [:valueDiff :value :valueMirror :valueShadow :valueShadowMirror :oldValueShadow | walk add: {valueDiff. value. valueMirror. valueShadow. valueShadowMirror. oldValueShadow. oldShadowMirror mirrorOf: oldValueShadow reachedVia: each reference from: oldShadow} reachedVia: each]]. remaining ifEmpty: [self reactivate: object] ifNotEmpty: [pendingOutgoingReferences at: object put: remaining]. - "Assign identifier if any." - name := self sourceNameOf: newShadow ifPresent: [:sourceName | sourceName] ifAbsent: []. - (mirror shouldObjectHaveNameAssigned: object) - ifTrue: - [name - ifNil: ["Object should normally have a name, but maybe it is just materialized to be removed from a collection. Then it does not need to get a name in the registry or the new graph."] - ifNotNil: [objectRegistry assign: name to: object]]. - name ifNotNil: [anObjectGraph assign: name to: object]. - "Update references to object." + self assignIdentifierIfAnyTo: object reflectedIn: mirror in: anObjectGraph materializedFrom: newShadow. self updateReferrersTo: object materializedFrom: newShadow]. pendingOutgoingReferences ifNotEmpty: [self error: 'Objects not fully updated']. ^ anObjectGraph \ No newline at end of file diff --git a/src/Squot.package/SquotPatcher.class/instance/applyReferenceDiff.to.reflectedIn.new.reflectedIn.old.reflectedIn.from.ifDeferred.nextDiffsDo..st b/src/Squot.package/SquotPatcher.class/instance/applyReferenceDiff.to.reflectedIn.new.reflectedIn.old.reflectedIn.from.ifDeferred.nextDiffsDo..st new file mode 100644 index 000000000..5a1f06288 --- /dev/null +++ b/src/Squot.package/SquotPatcher.class/instance/applyReferenceDiff.to.reflectedIn.new.reflectedIn.old.reflectedIn.from.ifDeferred.nextDiffsDo..st @@ -0,0 +1,27 @@ +private +applyReferenceDiff: aReferenceDiff to: anObject reflectedIn: aMirror new: newShadow reflectedIn: newShadowMirror old: oldShadow reflectedIn: oldShadowMirror from: aGraphDiff ifDeferred: deferredBlock nextDiffsDo: walkBlock + | valueShadow | + valueShadow := aReferenceDiff squotValueShadowFrom: oldShadow reflectedIn: oldShadowMirror. + self applying: aReferenceDiff + fill: valueShadow reachedVia: aReferenceDiff reference + into: anObject reflectedIn: aMirror + ifDeferredUntilActivated: [deferredBlock value] + ifNotTreatedYet: + ["Could be new or just not yet patched." + | value isNew valueMirror valueShadowMirror valueName valueDiff | + valueShadowMirror := newShadowMirror mirrorOf: valueShadow undecorated reachedVia: aReferenceDiff reference from: newShadow undecorated. + isNew := false. + value := self findOrCreateMaterializedInstanceOf: valueShadow reflectedIn: valueShadowMirror ifNew: [:newValue | isNew := true]. + "To update a reference might entail to materialize new objects. Filling in of their references must be queued as well." + valueMirror := aMirror mirrorOf: value reachedVia: aReferenceDiff reference from: anObject. + valueName := aGraphDiff right nameOf: valueShadow undecorated ifAbsent: []. + valueDiff := aGraphDiff diffForObjectNamed: valueName ifAbsent: []. + isNew & valueDiff isNil + ifTrue: [valueDiff := SquotObjectAddition of: valueShadow]. + valueDiff + ifNil: [aReferenceDiff squotReflectOn: anObject in: aMirror withValue: value] + ifNotNil: + [| oldValueShadow | + oldValueShadow := (valueName ifNil: [valueShadow] ifNotNil: [aGraphDiff left shadowNamed: valueName ifAbsent: [valueShadow]]) undecorated. + walkBlock valueWithArguments: {valueDiff. value. valueMirror. valueShadow. valueShadowMirror. oldValueShadow}. + deferredBlock value]]. \ No newline at end of file diff --git a/src/Squot.package/SquotPatcher.class/instance/applying.fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifNotTreatedYet..st b/src/Squot.package/SquotPatcher.class/instance/applying.fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifNotTreatedYet..st index 11b93a284..0effcb9be 100644 --- a/src/Squot.package/SquotPatcher.class/instance/applying.fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifNotTreatedYet..st +++ b/src/Squot.package/SquotPatcher.class/instance/applying.fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifNotTreatedYet..st @@ -1,14 +1,14 @@ public -applying: aReferenceDiff fill: value reachedVia: eachReference into: materialized reflectedIn: materializedMirror ifDeferredUntilActivated: deferredValueBlock ifNotTreatedYet: unavailableValueBlock +applying: aReferenceDiff fill: valueShadow reachedVia: eachReference into: materialized reflectedIn: materializedMirror ifDeferredUntilActivated: deferredValueBlock ifNotTreatedYet: unavailableValueBlock "Answer whether the reference could already be filled in." | wasFilledIn | - treatedObjects at: value undecorated + treatedObjects at: valueShadow undecorated ifPresent: [:materializedValue | (eachReference isHashRelevant and: [(self wasReactivated: materializedValue) not]) ifTrue: ["Fill in later" wasFilledIn := false. deferredValueBlock value. - (pendingIncomingReferencesForHash at: value undecorated ifAbsentPut: [OrderedCollection new]) + (pendingIncomingReferencesForHash at: valueShadow undecorated ifAbsentPut: [OrderedCollection new]) add: {materialized. materializedMirror. eachReference. aReferenceDiff}] ifFalse: [aReferenceDiff squotReflectOn: materialized in: materializedMirror withValue: materializedValue. @@ -18,9 +18,9 @@ applying: aReferenceDiff fill: value reachedVia: eachReference into: materialize unavailableValueBlock value. eachReference isHashRelevant ifTrue: - [(pendingIncomingReferencesForHash at: value undecorated ifAbsentPut: [OrderedCollection new]) + [(pendingIncomingReferencesForHash at: valueShadow undecorated ifAbsentPut: [OrderedCollection new]) add: {materialized. materializedMirror. eachReference. aReferenceDiff}] ifFalse: - [(pendingIncomingReferences at: value undecorated ifAbsentPut: [OrderedCollection new]) + [(pendingIncomingReferences at: valueShadow undecorated ifAbsentPut: [OrderedCollection new]) add: {materialized. materializedMirror. eachReference. aReferenceDiff}]]. ^ wasFilledIn \ No newline at end of file diff --git a/src/Squot.package/SquotPatcher.class/instance/assignIdentifierIfAnyTo.reflectedIn.in.materializedFrom..st b/src/Squot.package/SquotPatcher.class/instance/assignIdentifierIfAnyTo.reflectedIn.in.materializedFrom..st new file mode 100644 index 000000000..370cff0a7 --- /dev/null +++ b/src/Squot.package/SquotPatcher.class/instance/assignIdentifierIfAnyTo.reflectedIn.in.materializedFrom..st @@ -0,0 +1,10 @@ +private +assignIdentifierIfAnyTo: anObject reflectedIn: aMirror in: anObjectGraph materializedFrom: aShadow + | name | + name := self sourceNameOf: aShadow ifPresent: [:sourceName | sourceName] ifAbsent: []. + (aMirror shouldObjectHaveNameAssigned: anObject) + ifTrue: + [name + ifNil: ["Object should normally have a name, but maybe it is just materialized to be removed from a collection. Then it does not need to get a name in the registry or the new graph."] + ifNotNil: [objectRegistry assign: name to: anObject]]. + name ifNotNil: [anObjectGraph assign: name to: anObject]. \ No newline at end of file diff --git a/src/Squot.package/SquotPatcher.class/methodProperties.json b/src/Squot.package/SquotPatcher.class/methodProperties.json index 8e877bada..bfda27a10 100644 --- a/src/Squot.package/SquotPatcher.class/methodProperties.json +++ b/src/Squot.package/SquotPatcher.class/methodProperties.json @@ -2,8 +2,10 @@ "class" : { }, "instance" : { - "apply:toLoadedGraph:" : "jr 7/17/2021 21:15", - "applying:fill:reachedVia:into:reflectedIn:ifDeferredUntilActivated:ifNotTreatedYet:" : "jr 6/27/2021 23:15", + "apply:toLoadedGraph:" : "jr 7/18/2021 00:54", + "applyReferenceDiff:to:reflectedIn:new:reflectedIn:old:reflectedIn:from:ifDeferred:nextDiffsDo:" : "jr 7/18/2021 00:56", + "applying:fill:reachedVia:into:reflectedIn:ifDeferredUntilActivated:ifNotTreatedYet:" : "jr 7/18/2021 00:29", + "assignIdentifierIfAnyTo:reflectedIn:in:materializedFrom:" : "jr 7/18/2021 00:57", "fill:reachedVia:into:reflectedIn:ifDeferredUntilActivated:ifUnavailable:" : "jr 6/13/2021 17:35", "fillInReferencesOf:reflectedIn:from:reflectedIn:unavailableReferencesDo:" : "jr 6/13/2021 17:35", "findOrCreateMaterializedInstanceOf:reflectedIn:ifNew:" : "jr 6/17/2021 23:38", diff --git a/src/Squot.package/SquotReferenceAddition.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st b/src/Squot.package/SquotReferenceAddition.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st deleted file mode 100644 index 39458bc75..000000000 --- a/src/Squot.package/SquotReferenceAddition.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st +++ /dev/null @@ -1,3 +0,0 @@ -patching -squotReflectOn: anObject in: aMirror ifNewValue: newBlock ifOldValue: oldBlock - ^ newBlock value: target \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceAddition.class/instance/squotValueShadowFrom.reflectedIn..st b/src/Squot.package/SquotReferenceAddition.class/instance/squotValueShadowFrom.reflectedIn..st new file mode 100644 index 000000000..0c30ca82c --- /dev/null +++ b/src/Squot.package/SquotReferenceAddition.class/instance/squotValueShadowFrom.reflectedIn..st @@ -0,0 +1,3 @@ +patching +squotValueShadowFrom: aShadow reflectedIn: aMirror + ^ target \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceAddition.class/methodProperties.json b/src/Squot.package/SquotReferenceAddition.class/methodProperties.json index a12284e9d..5e18a54ca 100644 --- a/src/Squot.package/SquotReferenceAddition.class/methodProperties.json +++ b/src/Squot.package/SquotReferenceAddition.class/methodProperties.json @@ -5,5 +5,5 @@ "printOn:" : "jr 6/16/2021 21:20", "setReference:leftOwner:rightOwner:target:" : "jr 12/24/2020 01:29", "squotReflectOn:in:" : "jr 12/24/2020 01:37", - "squotReflectOn:in:ifNewValue:ifOldValue:" : "jr 6/20/2021 19:12", - "squotReflectOn:in:withValue:" : "jr 6/20/2021 19:16" } } + "squotReflectOn:in:withValue:" : "jr 6/20/2021 19:16", + "squotValueShadowFrom:reflectedIn:" : "jr 7/18/2021 00:36" } } diff --git a/src/Squot.package/SquotReferenceDiff.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st b/src/Squot.package/SquotReferenceDiff.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st deleted file mode 100644 index e0b59d381..000000000 --- a/src/Squot.package/SquotReferenceDiff.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st +++ /dev/null @@ -1,5 +0,0 @@ -patching -squotReflectOn: anObject in: aMirror ifNewValue: newBlock ifOldValue: oldBlock - "If I have a new value for the reference, evaluate newBlock with it. - If I do not have a new value, but only an old value for the reference, evaluate oldBlock with it." - self subclassResponsibility. \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceDiff.class/instance/squotValueShadowFrom.reflectedIn..st b/src/Squot.package/SquotReferenceDiff.class/instance/squotValueShadowFrom.reflectedIn..st new file mode 100644 index 000000000..09cda5462 --- /dev/null +++ b/src/Squot.package/SquotReferenceDiff.class/instance/squotValueShadowFrom.reflectedIn..st @@ -0,0 +1,5 @@ +patching +squotValueShadowFrom: anObject reflectedIn: aMirror + "Answer the new value for the reference. + If I do not have a new value, but only an old value for the reference, answer that instead." + self subclassResponsibility. \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceDiff.class/methodProperties.json b/src/Squot.package/SquotReferenceDiff.class/methodProperties.json index 3812b7ebc..12cb789cb 100644 --- a/src/Squot.package/SquotReferenceDiff.class/methodProperties.json +++ b/src/Squot.package/SquotReferenceDiff.class/methodProperties.json @@ -8,5 +8,5 @@ "reference" : "jr 6/13/2021 21:51", "setReference:leftOwner:rightOwner:" : "jr 12/24/2020 01:01", "squotReflectOn:in:" : "jr 12/24/2020 01:26", - "squotReflectOn:in:ifNewValue:ifOldValue:" : "jr 6/27/2021 23:26", - "squotReflectOn:in:withValue:" : "jr 6/20/2021 19:16" } } + "squotReflectOn:in:withValue:" : "jr 6/20/2021 19:16", + "squotValueShadowFrom:reflectedIn:" : "jr 7/18/2021 00:36" } } diff --git a/src/Squot.package/SquotReferenceRemoval.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st b/src/Squot.package/SquotReferenceRemoval.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st deleted file mode 100644 index ece8e015a..000000000 --- a/src/Squot.package/SquotReferenceRemoval.class/instance/squotReflectOn.in.ifNewValue.ifOldValue..st +++ /dev/null @@ -1,4 +0,0 @@ -patching -squotReflectOn: aShadow in: aMirror ifNewValue: newBlock ifOldValue: oldBlock - "I have only an old value." - ^ oldBlock value: (reference reflect: aShadow in: aMirror) \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceRemoval.class/instance/squotValueShadowFrom.reflectedIn..st b/src/Squot.package/SquotReferenceRemoval.class/instance/squotValueShadowFrom.reflectedIn..st new file mode 100644 index 000000000..c225d27fd --- /dev/null +++ b/src/Squot.package/SquotReferenceRemoval.class/instance/squotValueShadowFrom.reflectedIn..st @@ -0,0 +1,4 @@ +patching +squotValueShadowFrom: aShadow reflectedIn: aMirror + "I have only an old value." + ^ reference reflect: aShadow in: aMirror \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceRemoval.class/methodProperties.json b/src/Squot.package/SquotReferenceRemoval.class/methodProperties.json index 3da92a568..a2ec2568e 100644 --- a/src/Squot.package/SquotReferenceRemoval.class/methodProperties.json +++ b/src/Squot.package/SquotReferenceRemoval.class/methodProperties.json @@ -5,5 +5,5 @@ "printOn:" : "jr 6/16/2021 21:19", "setReference:leftOwner:rightObject:" : "jr 6/20/2021 21:56", "squotReflectOn:in:" : "jr 12/24/2020 01:33", - "squotReflectOn:in:ifNewValue:ifOldValue:" : "jr 6/20/2021 21:40", - "squotReflectOn:in:withValue:" : "jr 6/20/2021 21:36" } } + "squotReflectOn:in:withValue:" : "jr 6/20/2021 21:36", + "squotValueShadowFrom:reflectedIn:" : "jr 7/18/2021 00:36" } } From 3d2932d321e9640a4f0b43ea0f219df8bb9f0ff1 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 18 Jul 2021 01:06:36 +0200 Subject: [PATCH 08/43] Remove deprecated patching methods --- .../instance/materializeAs.with..st | 16 ---------------- .../methodProperties.json | 1 - .../instance/materializeAs.with..st | 3 --- .../methodProperties.json | 2 +- .../instance/materializeItemsIn.with..st | 9 --------- .../methodProperties.json | 1 - .../instance/materializeIn.with..st | 4 ---- .../methodProperties.json | 1 - .../instance/materializeAs.with..st | 7 ------- .../instance/materializeItemsIn.with..st | 5 ----- ...lizedInstance.st => squotMaterializeWith..st} | 2 +- .../methodProperties.json | 6 ++---- .../instance/materializeIn.with..st | 4 ---- .../methodProperties.json | 1 - .../instance/materializeIn.with..st | 5 ----- .../SquotInstVarSlot.class/methodProperties.json | 1 - .../instance/applyToObjectNamed.inGraph.with..st | 5 ----- .../methodProperties.json | 1 - .../instance/squotApplyToLoaded.with..st | 8 -------- .../SquotObjectDiff.class/methodProperties.json | 1 - .../instance/squotApplyToLoaded.with..st | 10 ---------- .../methodProperties.json | 1 - .../instance/squotApplyToLoaded.with..st | 4 ---- .../methodProperties.json | 1 - .../instance/createMaterializedInstance.st | 6 ------ .../instance/materializeAs.with..st | 10 ---------- .../instance/squotMaterializeWith..st | 8 ++++---- .../methodProperties.json | 4 +--- .../instance/squotApplyToLoaded.with..st | 4 ---- .../SquotPackageDiff.class/methodProperties.json | 1 - .../instance/materialize.in..st | 4 ---- .../SquotPatcher.class/methodProperties.json | 1 - .../instance/materializeAs.with..st | 3 --- .../methodProperties.json | 1 - .../instance/findOrCreateAndRematerialize..st | 9 --------- .../instance/materialize.in..st | 4 ---- .../instance/rematerialize..st | 15 --------------- .../instance/sourceNameOf.ifPresent..st | 9 --------- .../methodProperties.json | 4 ---- .../instance/materializeIn.with..st | 4 ---- .../methodProperties.json | 1 - .../instance/squotApplyToLoaded.with..st | 6 ------ .../TSquotDiff.trait/methodProperties.json | 1 - 43 files changed, 9 insertions(+), 185 deletions(-) delete mode 100644 src/Squot.package/SquotBitsObjectShadow.class/instance/materializeAs.with..st delete mode 100644 src/Squot.package/SquotCompiledCodeShadow.class/instance/materializeAs.with..st delete mode 100644 src/Squot.package/SquotDictionaryShadow.class/instance/materializeItemsIn.with..st delete mode 100644 src/Squot.package/SquotDictionarySlot.class/instance/materializeIn.with..st delete mode 100644 src/Squot.package/SquotHashedCollectionShadow.class/instance/materializeAs.with..st delete mode 100644 src/Squot.package/SquotHashedCollectionShadow.class/instance/materializeItemsIn.with..st rename src/Squot.package/SquotHashedCollectionShadow.class/instance/{createMaterializedInstance.st => squotMaterializeWith..st} (59%) delete mode 100644 src/Squot.package/SquotHashedCollectionSlot.class/instance/materializeIn.with..st delete mode 100644 src/Squot.package/SquotInstVarSlot.class/instance/materializeIn.with..st delete mode 100644 src/Squot.package/SquotObjectAddition.class/instance/applyToObjectNamed.inGraph.with..st delete mode 100644 src/Squot.package/SquotObjectDiff.class/instance/squotApplyToLoaded.with..st delete mode 100644 src/Squot.package/SquotObjectGraphDiff.class/instance/squotApplyToLoaded.with..st delete mode 100644 src/Squot.package/SquotObjectReplacement.class/instance/squotApplyToLoaded.with..st delete mode 100644 src/Squot.package/SquotObjectShadow.class/instance/createMaterializedInstance.st delete mode 100644 src/Squot.package/SquotObjectShadow.class/instance/materializeAs.with..st delete mode 100644 src/Squot.package/SquotPackageDiff.class/instance/squotApplyToLoaded.with..st delete mode 100644 src/Squot.package/SquotPatcher.class/instance/materialize.in..st delete mode 100644 src/Squot.package/SquotPrimitiveValue.class/instance/materializeAs.with..st delete mode 100644 src/Squot.package/SquotShadowMaterializer.class/instance/findOrCreateAndRematerialize..st delete mode 100644 src/Squot.package/SquotShadowMaterializer.class/instance/materialize.in..st delete mode 100644 src/Squot.package/SquotShadowMaterializer.class/instance/rematerialize..st delete mode 100644 src/Squot.package/SquotShadowMaterializer.class/instance/sourceNameOf.ifPresent..st delete mode 100644 src/Squot.package/SquotVariablePartSlot.class/instance/materializeIn.with..st delete mode 100644 src/Squot.package/TSquotDiff.trait/instance/squotApplyToLoaded.with..st diff --git a/src/Squot.package/SquotBitsObjectShadow.class/instance/materializeAs.with..st b/src/Squot.package/SquotBitsObjectShadow.class/instance/materializeAs.with..st deleted file mode 100644 index aac80c461..000000000 --- a/src/Squot.package/SquotBitsObjectShadow.class/instance/materializeAs.with..st +++ /dev/null @@ -1,16 +0,0 @@ -materializing -materializeAs: anObject with: aMaterializer - | size | - self deprecated. - size := value basicSize. - (size == anObject basicSize and: [value class format == anObject class format]) - ifFalse: [^ self squotMaterializeWith: aMaterializer]. - [(anObject respondsTo: #replaceFrom:to:with:startingAt:) - ifTrue: [anObject replaceFrom: 1 to: size with: value startingAt: 1] - ifFalse: [1 to: size do: [:i | anObject basicAt: i put: (value basicAt: i)]]] - on: ModificationForbidden do: - [:exception | "possibly a source code literal" - value = anObject - ifTrue: [exception return: anObject] - ifFalse: [self flag: #todo. "but what?" exception pass]]. - ^ anObject \ No newline at end of file diff --git a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json index b21a1295b..e5f70cf16 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json +++ b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json @@ -6,7 +6,6 @@ "applySequenceDiff:with:" : "jr 6/27/2017 16:59", "copyBitsFrom:" : "jr 4/8/2021 20:55", "initializeFrom:with:" : "jr 1/11/2021 00:08", - "materializeAs:with:" : "jr 7/18/2021 00:22", "privateApplySequenceDiff:" : "jr 9/24/2019 00:24", "privateApplySequenceDiff:with:" : "jr 10/24/2017 23:42", "sameIn:withName:ifAbsent:" : "jr 9/6/2019 22:33", diff --git a/src/Squot.package/SquotCompiledCodeShadow.class/instance/materializeAs.with..st b/src/Squot.package/SquotCompiledCodeShadow.class/instance/materializeAs.with..st deleted file mode 100644 index d6a00c353..000000000 --- a/src/Squot.package/SquotCompiledCodeShadow.class/instance/materializeAs.with..st +++ /dev/null @@ -1,3 +0,0 @@ -rematerializing -materializeAs: anObject with: aMaterializer - self notYetImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotCompiledCodeShadow.class/methodProperties.json b/src/Squot.package/SquotCompiledCodeShadow.class/methodProperties.json index d198a69b2..96241adeb 100644 --- a/src/Squot.package/SquotCompiledCodeShadow.class/methodProperties.json +++ b/src/Squot.package/SquotCompiledCodeShadow.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { "squotMirror" : "jr 4/7/2021 23:24" }, "instance" : { - "materializeAs:with:" : "jr 6/20/2017 00:21" } } + } } diff --git a/src/Squot.package/SquotDictionaryShadow.class/instance/materializeItemsIn.with..st b/src/Squot.package/SquotDictionaryShadow.class/instance/materializeItemsIn.with..st deleted file mode 100644 index 92c34331f..000000000 --- a/src/Squot.package/SquotDictionaryShadow.class/instance/materializeItemsIn.with..st +++ /dev/null @@ -1,9 +0,0 @@ -as yet unclassified -materializeItemsIn: aDictionary with: aMaterializer - | materializedAssociations | - self deprecated. - materializedAssociations := Array streamContents: [:stream | - itemSlots do: [:each | stream nextPut: - (each materializeIn: aDictionary with: aMaterializer)]]. - (aDictionary associations copyWithoutAll: materializedAssociations) - do: [:each | aDictionary removeKey: each key]. \ No newline at end of file diff --git a/src/Squot.package/SquotDictionaryShadow.class/methodProperties.json b/src/Squot.package/SquotDictionaryShadow.class/methodProperties.json index 3ceafe6cb..87934bde2 100644 --- a/src/Squot.package/SquotDictionaryShadow.class/methodProperties.json +++ b/src/Squot.package/SquotDictionaryShadow.class/methodProperties.json @@ -8,5 +8,4 @@ "diffClass" : "jr 6/12/2017 13:05", "explorerItemFor:" : "jr 12/30/2019 01:02", "initializeHashedItems:with:" : "jr 4/7/2021 21:06", - "materializeItemsIn:with:" : "jr 7/17/2021 02:04", "removeAssociation:" : "jr 7/29/2017 22:25" } } diff --git a/src/Squot.package/SquotDictionarySlot.class/instance/materializeIn.with..st b/src/Squot.package/SquotDictionarySlot.class/instance/materializeIn.with..st deleted file mode 100644 index 7cf86cf2d..000000000 --- a/src/Squot.package/SquotDictionarySlot.class/instance/materializeIn.with..st +++ /dev/null @@ -1,4 +0,0 @@ -Squot-materializing -materializeIn: aDictionary with: aMaterializer - self deprecated. - ^ aDictionary add: (aMaterializer rematerialize: self association) \ No newline at end of file diff --git a/src/Squot.package/SquotDictionarySlot.class/methodProperties.json b/src/Squot.package/SquotDictionarySlot.class/methodProperties.json index d4643fcc2..1eae7b787 100644 --- a/src/Squot.package/SquotDictionarySlot.class/methodProperties.json +++ b/src/Squot.package/SquotDictionarySlot.class/methodProperties.json @@ -9,7 +9,6 @@ "diffToBaseDictionarySlot:" : "jr 9/18/2019 20:35", "keyShadow" : "jr 2/23/2020 20:13", "lookupIn:" : "jr 7/16/2017 15:37", - "materializeIn:with:" : "jr 7/17/2021 02:04", "newNameFragment" : "jr 7/30/2017 00:42", "removeFrom:" : "jr 9/25/2019 20:24", "removeFrom:with:" : "jr 7/29/2017 22:24", diff --git a/src/Squot.package/SquotHashedCollectionShadow.class/instance/materializeAs.with..st b/src/Squot.package/SquotHashedCollectionShadow.class/instance/materializeAs.with..st deleted file mode 100644 index 2266e1c9b..000000000 --- a/src/Squot.package/SquotHashedCollectionShadow.class/instance/materializeAs.with..st +++ /dev/null @@ -1,7 +0,0 @@ -rematerializing -materializeAs: aHashedCollection with: aMaterializer - | collection | - self deprecated. - collection := super materializeAs: aHashedCollection with: aMaterializer. - self materializeItemsIn: aHashedCollection with: aMaterializer. - ^ collection \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionShadow.class/instance/materializeItemsIn.with..st b/src/Squot.package/SquotHashedCollectionShadow.class/instance/materializeItemsIn.with..st deleted file mode 100644 index 34fe02e3f..000000000 --- a/src/Squot.package/SquotHashedCollectionShadow.class/instance/materializeItemsIn.with..st +++ /dev/null @@ -1,5 +0,0 @@ -rematerializing -materializeItemsIn: aHashedCollection with: aMaterializer - self deprecated. - aHashedCollection removeAll. - itemSlots do: [:each | each materializeIn: aHashedCollection with: aMaterializer]. \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionShadow.class/instance/createMaterializedInstance.st b/src/Squot.package/SquotHashedCollectionShadow.class/instance/squotMaterializeWith..st similarity index 59% rename from src/Squot.package/SquotHashedCollectionShadow.class/instance/createMaterializedInstance.st rename to src/Squot.package/SquotHashedCollectionShadow.class/instance/squotMaterializeWith..st index 3ab900a3e..8ee366787 100644 --- a/src/Squot.package/SquotHashedCollectionShadow.class/instance/createMaterializedInstance.st +++ b/src/Squot.package/SquotHashedCollectionShadow.class/instance/squotMaterializeWith..st @@ -1,3 +1,3 @@ rematerializing -createMaterializedInstance +squotMaterializeWith: aMaterializer ^ originalClass new: itemSlots size \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionShadow.class/methodProperties.json b/src/Squot.package/SquotHashedCollectionShadow.class/methodProperties.json index e2e830a7b..2b14c403e 100644 --- a/src/Squot.package/SquotHashedCollectionShadow.class/methodProperties.json +++ b/src/Squot.package/SquotHashedCollectionShadow.class/methodProperties.json @@ -5,7 +5,6 @@ "addItemSlot:" : "jr 7/29/2017 22:54", "atElement:" : "jr 4/10/2021 16:50", "atElement:put:" : "jr 4/7/2021 22:25", - "createMaterializedInstance" : "jr 6/22/2017 00:13", "diffClass" : "jr 6/22/2017 13:07", "diffItems:" : "jr 9/18/2019 20:22", "diffItems:with:" : "jr 4/29/2018 20:45", @@ -19,7 +18,6 @@ "initializeHashedItems:with:" : "jr 4/8/2021 14:18", "itemSlotForValue:" : "jr 7/16/2017 15:38", "itemSlots" : "jr 6/22/2017 00:14", - "materializeAs:with:" : "jr 7/17/2021 02:04", - "materializeItemsIn:with:" : "jr 7/17/2021 02:04", "references" : "jr 4/10/2021 16:43", - "removeItemSlot:" : "jr 7/29/2017 22:55" } } + "removeItemSlot:" : "jr 7/29/2017 22:55", + "squotMaterializeWith:" : "jr 7/18/2021 01:05" } } diff --git a/src/Squot.package/SquotHashedCollectionSlot.class/instance/materializeIn.with..st b/src/Squot.package/SquotHashedCollectionSlot.class/instance/materializeIn.with..st deleted file mode 100644 index 4b52ba6fb..000000000 --- a/src/Squot.package/SquotHashedCollectionSlot.class/instance/materializeIn.with..st +++ /dev/null @@ -1,4 +0,0 @@ -Squot-materializing -materializeIn: aHashedCollection with: aMaterializer - self deprecated. - aHashedCollection add: (aMaterializer rematerialize: self value). \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionSlot.class/methodProperties.json b/src/Squot.package/SquotHashedCollectionSlot.class/methodProperties.json index 086abb4ef..888a9643a 100644 --- a/src/Squot.package/SquotHashedCollectionSlot.class/methodProperties.json +++ b/src/Squot.package/SquotHashedCollectionSlot.class/methodProperties.json @@ -7,7 +7,6 @@ "asReference" : "jr 4/10/2021 12:26", "diffToBaseHashedCollectionSlot:" : "jr 9/18/2019 20:35", "lookupIn:" : "jr 7/16/2017 15:37", - "materializeIn:with:" : "jr 7/17/2021 02:04", "newNameFragment" : "jr 7/30/2017 00:41", "removeFrom:" : "jr 9/25/2019 20:24", "removeFrom:with:" : "jr 7/29/2017 22:55", diff --git a/src/Squot.package/SquotInstVarSlot.class/instance/materializeIn.with..st b/src/Squot.package/SquotInstVarSlot.class/instance/materializeIn.with..st deleted file mode 100644 index 7318358b9..000000000 --- a/src/Squot.package/SquotInstVarSlot.class/instance/materializeIn.with..st +++ /dev/null @@ -1,5 +0,0 @@ -Squot-materializing -materializeIn: anObject with: aMaterializer - self deprecated. - anObject instVarNamed: self key put: (aMaterializer rematerialize: self value). - anObject changed: self key asSymbol. \ No newline at end of file diff --git a/src/Squot.package/SquotInstVarSlot.class/methodProperties.json b/src/Squot.package/SquotInstVarSlot.class/methodProperties.json index e3a6b8911..37fef40b0 100644 --- a/src/Squot.package/SquotInstVarSlot.class/methodProperties.json +++ b/src/Squot.package/SquotInstVarSlot.class/methodProperties.json @@ -8,7 +8,6 @@ "diffToBaseInstVar:" : "jr 9/16/2019 21:31", "instVarName" : "jr 6/17/2017 20:02", "lookupIn:" : "jr 7/16/2017 15:33", - "materializeIn:with:" : "jr 7/17/2021 02:04", "removeFrom:" : "jr 9/25/2019 20:24", "removeFrom:with:" : "jr 9/9/2017 14:20", "squotDiffAgainst:" : "jr 9/16/2019 21:30" } } diff --git a/src/Squot.package/SquotObjectAddition.class/instance/applyToObjectNamed.inGraph.with..st b/src/Squot.package/SquotObjectAddition.class/instance/applyToObjectNamed.inGraph.with..st deleted file mode 100644 index 32b7fe27c..000000000 --- a/src/Squot.package/SquotObjectAddition.class/instance/applyToObjectNamed.inGraph.with..st +++ /dev/null @@ -1,5 +0,0 @@ -patching -applyToObjectNamed: name inGraph: anObjectGraph with: aPatcher - self deprecated. - self checkName: name. - ^ aPatcher rematerialize: (addedObject withSquotObjectName: name) \ No newline at end of file diff --git a/src/Squot.package/SquotObjectAddition.class/methodProperties.json b/src/Squot.package/SquotObjectAddition.class/methodProperties.json index 92d1cd0e7..7a42272aa 100644 --- a/src/Squot.package/SquotObjectAddition.class/methodProperties.json +++ b/src/Squot.package/SquotObjectAddition.class/methodProperties.json @@ -4,7 +4,6 @@ "instance" : { "addedObject" : "jr 9/7/2019 12:03", "addedObject:" : "jr 9/7/2019 12:03", - "applyToObjectNamed:inGraph:with:" : "jr 7/17/2021 02:04", "applyToShadowNamed:inGraph:" : "jr 7/4/2021 17:45", "checkName:" : "jr 9/25/2019 18:54", "object" : "jr 9/7/2019 12:13", diff --git a/src/Squot.package/SquotObjectDiff.class/instance/squotApplyToLoaded.with..st b/src/Squot.package/SquotObjectDiff.class/instance/squotApplyToLoaded.with..st deleted file mode 100644 index b90f6e847..000000000 --- a/src/Squot.package/SquotObjectDiff.class/instance/squotApplyToLoaded.with..st +++ /dev/null @@ -1,8 +0,0 @@ -patching -squotApplyToLoaded: anObject with: aPatcher - | shadow patchedShadow patchedObject | - self deprecated. - shadow := aPatcher shadowOf: anObject. - patchedShadow := aPatcher apply: self to: shadow. - patchedObject := aPatcher materialize: patchedShadow in: anObject. - ^ patchedObject \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiff.class/methodProperties.json b/src/Squot.package/SquotObjectDiff.class/methodProperties.json index 6a4469108..8de2d5149 100644 --- a/src/Squot.package/SquotObjectDiff.class/methodProperties.json +++ b/src/Squot.package/SquotObjectDiff.class/methodProperties.json @@ -21,6 +21,5 @@ "squotApplyTo:" : "jr 9/23/2019 23:48", "squotApplyTo:with:" : "jr 7/27/2019 10:05", "squotApplyToLoaded:" : "jr 7/17/2021 02:11", - "squotApplyToLoaded:with:" : "jr 7/17/2021 02:05", "squotChangeAsStringOrText" : "jr 10/31/2017 20:50", "squotHasChanges" : "jr 6/17/2017 23:45" } } diff --git a/src/Squot.package/SquotObjectGraphDiff.class/instance/squotApplyToLoaded.with..st b/src/Squot.package/SquotObjectGraphDiff.class/instance/squotApplyToLoaded.with..st deleted file mode 100644 index 8c6a86044..000000000 --- a/src/Squot.package/SquotObjectGraphDiff.class/instance/squotApplyToLoaded.with..st +++ /dev/null @@ -1,10 +0,0 @@ -Squot-diff-patching -squotApplyToLoaded: anObjectGraph with: aPatcher - | diffForStart | - self deprecated. - diffForStart := self startDiff. - anObjectGraph applyDiff: diffForStart toStartObjectWith: aPatcher. - diffs keysAndValuesDo: [:name :diff | diff ~~ diffForStart ifTrue: - [diff applyToObjectNamed: name inGraph: anObjectGraph with: aPatcher]]. - anObjectGraph refreshStartShadow. - ^ anObjectGraph \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphDiff.class/methodProperties.json b/src/Squot.package/SquotObjectGraphDiff.class/methodProperties.json index c657520cb..174dd8e91 100644 --- a/src/Squot.package/SquotObjectGraphDiff.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphDiff.class/methodProperties.json @@ -26,7 +26,6 @@ "roots" : "jr 6/20/2021 23:12", "squotApplyTo:" : "jr 12/13/2020 16:20", "squotApplyToLoaded:" : "jr 7/17/2021 02:11", - "squotApplyToLoaded:with:" : "jr 7/17/2021 02:05", "squotChangeAsStringOrText" : "jr 11/25/2020 21:15", "squotHasChanges" : "jr 6/22/2017 14:03", "startDiff" : "jr 7/21/2017 00:51", diff --git a/src/Squot.package/SquotObjectReplacement.class/instance/squotApplyToLoaded.with..st b/src/Squot.package/SquotObjectReplacement.class/instance/squotApplyToLoaded.with..st deleted file mode 100644 index 23c014e0e..000000000 --- a/src/Squot.package/SquotObjectReplacement.class/instance/squotApplyToLoaded.with..st +++ /dev/null @@ -1,4 +0,0 @@ -patching -squotApplyToLoaded: anObject with: aPatcher - self deprecated. - ^ aPatcher rematerialize: right \ No newline at end of file diff --git a/src/Squot.package/SquotObjectReplacement.class/methodProperties.json b/src/Squot.package/SquotObjectReplacement.class/methodProperties.json index 3a14b489e..4050b31da 100644 --- a/src/Squot.package/SquotObjectReplacement.class/methodProperties.json +++ b/src/Squot.package/SquotObjectReplacement.class/methodProperties.json @@ -17,6 +17,5 @@ "squotApplyTo:" : "jr 6/1/2017 12:44", "squotApplyTo:with:" : "jr 6/12/2017 18:15", "squotApplyToLoaded:" : "jr 6/16/2017 12:06", - "squotApplyToLoaded:with:" : "jr 7/17/2021 02:06", "squotChangeAsStringOrText" : "jr 6/2/2017 15:33", "squotHasChanges" : "jr 6/1/2017 12:44" } } diff --git a/src/Squot.package/SquotObjectShadow.class/instance/createMaterializedInstance.st b/src/Squot.package/SquotObjectShadow.class/instance/createMaterializedInstance.st deleted file mode 100644 index 0d0fab3c1..000000000 --- a/src/Squot.package/SquotObjectShadow.class/instance/createMaterializedInstance.st +++ /dev/null @@ -1,6 +0,0 @@ -rematerializing -createMaterializedInstance - "Answer a fresh object of the same class and with the same size as my original" - ^ capturedClass isVariable - ifTrue: [capturedClass basicNew: self basicSizeOfMaterializedInstance] - ifFalse: [capturedClass basicNew] \ No newline at end of file diff --git a/src/Squot.package/SquotObjectShadow.class/instance/materializeAs.with..st b/src/Squot.package/SquotObjectShadow.class/instance/materializeAs.with..st deleted file mode 100644 index 026095442..000000000 --- a/src/Squot.package/SquotObjectShadow.class/instance/materializeAs.with..st +++ /dev/null @@ -1,10 +0,0 @@ -rematerializing -materializeAs: anObject with: aMaterializer - "Fill anObject like my original" - self deprecated. - anObject class ~= capturedClass ifTrue: - [^ aMaterializer materialize: self in: self createMaterializedInstance]. - anObject basicSize ~= self basicSizeOfMaterializedInstance ifTrue: - [^ aMaterializer materialize: self in: self createMaterializedInstance]. - slots associationsDo: [:each | each materializeIn: anObject with: aMaterializer]. - ^ anObject \ No newline at end of file diff --git a/src/Squot.package/SquotObjectShadow.class/instance/squotMaterializeWith..st b/src/Squot.package/SquotObjectShadow.class/instance/squotMaterializeWith..st index 7beb981a2..f2f44b696 100644 --- a/src/Squot.package/SquotObjectShadow.class/instance/squotMaterializeWith..st +++ b/src/Squot.package/SquotObjectShadow.class/instance/squotMaterializeWith..st @@ -1,6 +1,6 @@ rematerializing squotMaterializeWith: aMaterializer - "Answer the object restored from me. Double dispatch path" - | object | - object := self createMaterializedInstance. - ^ aMaterializer materialize: self in: object \ No newline at end of file + "Answer a fresh object of the same class and with the same size as my original" + ^ capturedClass isVariable + ifTrue: [capturedClass basicNew: self basicSizeOfMaterializedInstance] + ifFalse: [capturedClass basicNew] \ No newline at end of file diff --git a/src/Squot.package/SquotObjectShadow.class/methodProperties.json b/src/Squot.package/SquotObjectShadow.class/methodProperties.json index 99010bfca..01202f28c 100644 --- a/src/Squot.package/SquotObjectShadow.class/methodProperties.json +++ b/src/Squot.package/SquotObjectShadow.class/methodProperties.json @@ -12,7 +12,6 @@ "basicSizeOfMaterializedInstance" : "jr 7/16/2017 22:37", "captureWithSquot:" : "jr 1/11/2021 00:01", "capturedClass" : "jr 7/20/2017 18:01", - "createMaterializedInstance" : "jr 7/20/2017 18:07", "diffClass" : "jr 6/17/2017 22:19", "diffToBaseObjectShadow:" : "jr 9/16/2019 21:09", "explorerContents" : "jr 12/30/2019 00:38", @@ -21,7 +20,6 @@ "initialize" : "jr 8/11/2017 14:59", "initializeFrom:with:" : "jr 1/11/2021 00:08", "instVarSlotNamed:" : "jr 7/16/2017 15:35", - "materializeAs:with:" : "jr 7/17/2021 02:06", "name" : "jr 7/16/2017 19:24", "originalClass" : "jr 6/12/2017 18:45", "postCopy" : "jr 8/11/2017 14:59", @@ -37,7 +35,7 @@ "slots" : "jr 6/17/2017 23:01", "squotDiffAgainst:" : "jr 9/16/2019 21:45", "squotDiffAgainst:with:" : "jr 8/15/2017 19:36", - "squotMaterializeWith:" : "jr 7/17/2017 20:53", + "squotMaterializeWith:" : "jr 7/18/2021 01:04", "squotMergeWith:basedOn:" : "jr 8/29/2019 21:18", "squotOutgoingReferences" : "jr 8/31/2019 19:42", "variablePartSlotWithIndex:" : "jr 7/16/2017 15:36", diff --git a/src/Squot.package/SquotPackageDiff.class/instance/squotApplyToLoaded.with..st b/src/Squot.package/SquotPackageDiff.class/instance/squotApplyToLoaded.with..st deleted file mode 100644 index 5f177bea0..000000000 --- a/src/Squot.package/SquotPackageDiff.class/instance/squotApplyToLoaded.with..st +++ /dev/null @@ -1,4 +0,0 @@ -Squot-diff-patching -squotApplyToLoaded: aPackageInfo with: aPatcher - self deprecated. - ^ self squotApplyToLoaded: aPackageInfo "do not need the help of aPatcher" \ No newline at end of file diff --git a/src/Squot.package/SquotPackageDiff.class/methodProperties.json b/src/Squot.package/SquotPackageDiff.class/methodProperties.json index 53c70d959..19b97f416 100644 --- a/src/Squot.package/SquotPackageDiff.class/methodProperties.json +++ b/src/Squot.package/SquotPackageDiff.class/methodProperties.json @@ -20,7 +20,6 @@ "squotApplyTo:" : "jr 7/22/2017 00:07", "squotApplyTo:with:" : "jr 4/7/2019 21:23", "squotApplyToLoaded:" : "jr 12/23/2019 12:41", - "squotApplyToLoaded:with:" : "jr 7/17/2021 02:06", "squotChangeAsStringOrText" : "jr 5/8/2020 21:51", "squotHasChanges" : "jr 7/22/2017 00:11", "update:reflectedIn:asMaterializedFrom:reflectedIn:" : "jr 6/13/2021 20:18", diff --git a/src/Squot.package/SquotPatcher.class/instance/materialize.in..st b/src/Squot.package/SquotPatcher.class/instance/materialize.in..st deleted file mode 100644 index a4f9c6a41..000000000 --- a/src/Squot.package/SquotPatcher.class/instance/materialize.in..st +++ /dev/null @@ -1,4 +0,0 @@ -private -materialize: aShadow in: anObject - self flag: #deprecated. "References are filled in later now. See findOrCreateMaterializedInstanceOf: aShadow reflectedIn: aMirror". - ^ anObject \ No newline at end of file diff --git a/src/Squot.package/SquotPatcher.class/methodProperties.json b/src/Squot.package/SquotPatcher.class/methodProperties.json index bfda27a10..d7794483d 100644 --- a/src/Squot.package/SquotPatcher.class/methodProperties.json +++ b/src/Squot.package/SquotPatcher.class/methodProperties.json @@ -10,7 +10,6 @@ "fillInReferencesOf:reflectedIn:from:reflectedIn:unavailableReferencesDo:" : "jr 6/13/2021 17:35", "findOrCreateMaterializedInstanceOf:reflectedIn:ifNew:" : "jr 6/17/2021 23:38", "initialize" : "jr 6/13/2021 12:08", - "materialize:in:" : "jr 6/13/2021 22:04", "materializedFrom:ifAbsent:" : "jr 6/13/2021 12:08", "materializedFrom:ifPresent:ifAbsent:" : "jr 6/13/2021 12:08", "reactivate:" : "jr 7/4/2021 18:54", diff --git a/src/Squot.package/SquotPrimitiveValue.class/instance/materializeAs.with..st b/src/Squot.package/SquotPrimitiveValue.class/instance/materializeAs.with..st deleted file mode 100644 index 4da8b2e78..000000000 --- a/src/Squot.package/SquotPrimitiveValue.class/instance/materializeAs.with..st +++ /dev/null @@ -1,3 +0,0 @@ -materializing -materializeAs: anObject with: aMaterializer - ^ value \ No newline at end of file diff --git a/src/Squot.package/SquotPrimitiveValue.class/methodProperties.json b/src/Squot.package/SquotPrimitiveValue.class/methodProperties.json index e3c500c20..afe3d85c1 100644 --- a/src/Squot.package/SquotPrimitiveValue.class/methodProperties.json +++ b/src/Squot.package/SquotPrimitiveValue.class/methodProperties.json @@ -10,7 +10,6 @@ "hasContentsInExplorer" : "jr 12/30/2019 00:47", "hash" : "jr 6/17/2017 22:08", "initializeFrom:with:" : "jr 1/11/2021 00:08", - "materializeAs:with:" : "jr 7/16/2017 22:30", "originalClass" : "jr 6/17/2017 22:15", "printOn:" : "jr 6/16/2017 12:07", "sameIn:withName:ifAbsent:" : "jr 8/31/2019 20:26", diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/findOrCreateAndRematerialize..st b/src/Squot.package/SquotShadowMaterializer.class/instance/findOrCreateAndRematerialize..st deleted file mode 100644 index 4d0bb8e74..000000000 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/findOrCreateAndRematerialize..st +++ /dev/null @@ -1,9 +0,0 @@ -converting -findOrCreateAndRematerialize: aShadow - | existing | - self deprecated. - self sourceNameOf: aShadow ifPresent: [:name | - existing := objectRegistry objectNamed: name ifAbsent: []. - (existing notNil and: [existing squotShouldKeepIdentity]) - ifTrue: [^ self materialize: aShadow in: existing]]. - ^ aShadow squotMaterializeWith: self \ No newline at end of file diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/materialize.in..st b/src/Squot.package/SquotShadowMaterializer.class/instance/materialize.in..st deleted file mode 100644 index 3aee6fb7d..000000000 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/materialize.in..st +++ /dev/null @@ -1,4 +0,0 @@ -converting -materialize: aShadow in: anObject - self flag: #deprecated. "References are filled in later now. See findOrCreateAndRematerialize: aShadow reflectedIn: aMirror". - ^ anObject \ No newline at end of file diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/rematerialize..st b/src/Squot.package/SquotShadowMaterializer.class/instance/rematerialize..st deleted file mode 100644 index 92a28ea53..000000000 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/rematerialize..st +++ /dev/null @@ -1,15 +0,0 @@ -public converting -rematerialize: aShadow - self deprecated. - ^ convertedObjects at: aShadow undecorated - ifAbsentPut: [ | materialized name | - self assert: (aShadow hasSquotShadowName not or: [sourceGraph includesObjectNamed: aShadow name]) - description: 'Source graph does not contain shadow. Where does it come from?'. - materialized := self findOrCreateAndRematerialize: aShadow. - name := sourceGraph nameOf: aShadow undecorated ifAbsent: []. - (name isNil and: [aShadow hasSquotShadowName]) ifTrue: - [name := aShadow name]. - (name isNil and: [materialized shouldHaveNameAssignedBySquot]) ifTrue: - [self error: 'Object has no name but it should have']. - name ifNotNil: [targetGraph assign: name to: materialized]. - materialized] \ No newline at end of file diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/sourceNameOf.ifPresent..st b/src/Squot.package/SquotShadowMaterializer.class/instance/sourceNameOf.ifPresent..st deleted file mode 100644 index 9174f9317..000000000 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/sourceNameOf.ifPresent..st +++ /dev/null @@ -1,9 +0,0 @@ -converting -sourceNameOf: aShadow ifPresent: unaryBlock - | name | - self deprecated. - sourceGraph ifNotNil: - [name := sourceGraph nameOf: aShadow undecorated ifAbsent: []. - name ifNotNil: [^ unaryBlock value: name]]. - aShadow hasSquotShadowName ifTrue: [^ unaryBlock value: aShadow name]. - ^ nil \ No newline at end of file diff --git a/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json b/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json index 8cfa2539e..25b620633 100644 --- a/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json +++ b/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json @@ -2,17 +2,13 @@ "class" : { }, "instance" : { - "findOrCreateAndRematerialize:" : "jr 7/17/2021 02:06", "initialize" : "jr 7/30/2017 22:04", - "materialize:in:" : "jr 4/10/2021 11:58", "objectGraph" : "jr 7/30/2017 02:18", "registry" : "jr 7/29/2017 18:15", "registry:" : "jr 7/6/2017 15:29", - "rematerialize:" : "jr 7/17/2021 02:06", "rematerializeGraph:" : "jr 7/10/2021 13:42", "rematerializeGraph:into:" : "jr 7/17/2021 02:11", "sourceGraph" : "jr 7/30/2017 02:20", "sourceGraph:" : "jr 7/30/2017 02:20", - "sourceNameOf:ifPresent:" : "jr 7/18/2021 00:19", "targetGraph" : "jr 7/30/2017 02:15", "targetGraph:" : "jr 7/30/2017 02:15" } } diff --git a/src/Squot.package/SquotVariablePartSlot.class/instance/materializeIn.with..st b/src/Squot.package/SquotVariablePartSlot.class/instance/materializeIn.with..st deleted file mode 100644 index 9a7c71b5b..000000000 --- a/src/Squot.package/SquotVariablePartSlot.class/instance/materializeIn.with..st +++ /dev/null @@ -1,4 +0,0 @@ -Squot-materializing -materializeIn: anObjectOfVariableClass with: aMaterializer - self deprecated. - anObjectOfVariableClass basicAt: self key put: (aMaterializer rematerialize: self value). \ No newline at end of file diff --git a/src/Squot.package/SquotVariablePartSlot.class/methodProperties.json b/src/Squot.package/SquotVariablePartSlot.class/methodProperties.json index ff9254a44..97c693ad0 100644 --- a/src/Squot.package/SquotVariablePartSlot.class/methodProperties.json +++ b/src/Squot.package/SquotVariablePartSlot.class/methodProperties.json @@ -8,7 +8,6 @@ "diffToBaseIndexedSlot:" : "jr 9/18/2019 20:14", "index" : "jr 6/17/2017 20:02", "lookupIn:" : "jr 7/16/2017 15:34", - "materializeIn:with:" : "jr 7/17/2021 02:06", "removeFrom:" : "jr 9/25/2019 20:20", "removeFrom:with:" : "jr 7/20/2017 22:48", "squotDiffAgainst:" : "jr 9/18/2019 20:12" } } diff --git a/src/Squot.package/TSquotDiff.trait/instance/squotApplyToLoaded.with..st b/src/Squot.package/TSquotDiff.trait/instance/squotApplyToLoaded.with..st deleted file mode 100644 index 6050cf06a..000000000 --- a/src/Squot.package/TSquotDiff.trait/instance/squotApplyToLoaded.with..st +++ /dev/null @@ -1,6 +0,0 @@ -Squot-diff-patching -squotApplyToLoaded: anObject with: aPatcher - "Modify anObject such that it matches what I model and answer the modified object, even if it was modified in-place." - self deprecated. - self shouldBeImplemented. - ^ anObject \ No newline at end of file diff --git a/src/Squot.package/TSquotDiff.trait/methodProperties.json b/src/Squot.package/TSquotDiff.trait/methodProperties.json index 141f9f1de..824ec921d 100644 --- a/src/Squot.package/TSquotDiff.trait/methodProperties.json +++ b/src/Squot.package/TSquotDiff.trait/methodProperties.json @@ -12,6 +12,5 @@ "squotApplyTo:" : "jr 9/25/2019 19:21", "squotApplyTo:with:" : "jr 6/22/2017 14:04", "squotApplyToLoaded:" : "jr 6/7/2017 14:44", - "squotApplyToLoaded:with:" : "jr 7/17/2021 02:06", "squotHasChanges" : "jr 4/9/2017 22:42", "update:reflectedIn:asMaterializedFrom:reflectedIn:" : "jr 6/13/2021 21:53" } } From 91cd8da7c9d0d864d99e2c4c4780b5b75359f140 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 18 Jul 2021 01:10:49 +0200 Subject: [PATCH 09/43] Remove unsent methods and reclassify as private All the reclassified messages are not sent by other classes at this time. --- ...DeferredUntilActivated.ifNotTreatedYet..st | 2 +- ...ifDeferredUntilActivated.ifUnavailable..st | 2 +- ...om.reflectedIn.unavailableReferencesDo..st | 19 ------------------- ...terializedInstanceOf.reflectedIn.ifNew..st | 2 +- .../instance/materializedFrom.ifAbsent..st | 3 --- .../materializedFrom.ifPresent.ifAbsent..st | 3 --- .../instance/take.asMaterializedFrom..st | 2 +- ...ference.from.reflectedIn.for.withValue..st | 2 +- .../updateReferrersTo.materializedFrom..st | 2 +- .../SquotPatcher.class/methodProperties.json | 3 --- 10 files changed, 6 insertions(+), 34 deletions(-) delete mode 100644 src/Squot.package/SquotPatcher.class/instance/fillInReferencesOf.reflectedIn.from.reflectedIn.unavailableReferencesDo..st delete mode 100644 src/Squot.package/SquotPatcher.class/instance/materializedFrom.ifAbsent..st delete mode 100644 src/Squot.package/SquotPatcher.class/instance/materializedFrom.ifPresent.ifAbsent..st diff --git a/src/Squot.package/SquotPatcher.class/instance/applying.fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifNotTreatedYet..st b/src/Squot.package/SquotPatcher.class/instance/applying.fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifNotTreatedYet..st index 0effcb9be..a90653979 100644 --- a/src/Squot.package/SquotPatcher.class/instance/applying.fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifNotTreatedYet..st +++ b/src/Squot.package/SquotPatcher.class/instance/applying.fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifNotTreatedYet..st @@ -1,4 +1,4 @@ -public +private applying: aReferenceDiff fill: valueShadow reachedVia: eachReference into: materialized reflectedIn: materializedMirror ifDeferredUntilActivated: deferredValueBlock ifNotTreatedYet: unavailableValueBlock "Answer whether the reference could already be filled in." | wasFilledIn | diff --git a/src/Squot.package/SquotPatcher.class/instance/fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifUnavailable..st b/src/Squot.package/SquotPatcher.class/instance/fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifUnavailable..st index d6d6f031c..afd7f244f 100644 --- a/src/Squot.package/SquotPatcher.class/instance/fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifUnavailable..st +++ b/src/Squot.package/SquotPatcher.class/instance/fill.reachedVia.into.reflectedIn.ifDeferredUntilActivated.ifUnavailable..st @@ -1,4 +1,4 @@ -public +private fill: value reachedVia: eachReference into: materialized reflectedIn: materializedMirror ifDeferredUntilActivated: deferredValueBlock ifUnavailable: unavailableValueBlock "Answer whether the reference could already be filled in." | wasFilledIn | diff --git a/src/Squot.package/SquotPatcher.class/instance/fillInReferencesOf.reflectedIn.from.reflectedIn.unavailableReferencesDo..st b/src/Squot.package/SquotPatcher.class/instance/fillInReferencesOf.reflectedIn.from.reflectedIn.unavailableReferencesDo..st deleted file mode 100644 index 8b0829d37..000000000 --- a/src/Squot.package/SquotPatcher.class/instance/fillInReferencesOf.reflectedIn.from.reflectedIn.unavailableReferencesDo..st +++ /dev/null @@ -1,19 +0,0 @@ -public -fillInReferencesOf: materialized reflectedIn: materializedMirror from: aShadow reflectedIn: aMirror unavailableReferencesDo: aBlock - "Fill in all references of the new object whose values have already been materialized. Remember the other references to update them later." - | remaining | - remaining := OrderedCollection new. - (aMirror referencesFrom: aShadow) do: - [:eachReference | | value | - value := eachReference reflect: aShadow in: aMirror. - self fill: value reachedVia: eachReference - into: materialized reflectedIn: materializedMirror - ifDeferredUntilActivated: [remaining add: eachReference] - ifUnavailable: - [aBlock cull: eachReference cull: value. - remaining add: eachReference]]. - remaining - ifEmpty: - ["Reactivate object if all references are filled in already." - self reactivate: materialized] - ifNotEmpty: [pendingOutgoingReferences at: materialized put: remaining]. \ No newline at end of file diff --git a/src/Squot.package/SquotPatcher.class/instance/findOrCreateMaterializedInstanceOf.reflectedIn.ifNew..st b/src/Squot.package/SquotPatcher.class/instance/findOrCreateMaterializedInstanceOf.reflectedIn.ifNew..st index e123de464..55223f4cc 100644 --- a/src/Squot.package/SquotPatcher.class/instance/findOrCreateMaterializedInstanceOf.reflectedIn.ifNew..st +++ b/src/Squot.package/SquotPatcher.class/instance/findOrCreateMaterializedInstanceOf.reflectedIn.ifNew..st @@ -1,4 +1,4 @@ -public +private findOrCreateMaterializedInstanceOf: aShadow reflectedIn: aMirror ifNew: aBlock "Answers a live (but not necessarily reactivated) object. Its references may not all be updated in yet." | existing materialized | diff --git a/src/Squot.package/SquotPatcher.class/instance/materializedFrom.ifAbsent..st b/src/Squot.package/SquotPatcher.class/instance/materializedFrom.ifAbsent..st deleted file mode 100644 index 6f2b44b90..000000000 --- a/src/Squot.package/SquotPatcher.class/instance/materializedFrom.ifAbsent..st +++ /dev/null @@ -1,3 +0,0 @@ -public -materializedFrom: aShadow ifAbsent: aBlock - ^ treatedObjects at: aShadow undecorated ifAbsent: aBlock \ No newline at end of file diff --git a/src/Squot.package/SquotPatcher.class/instance/materializedFrom.ifPresent.ifAbsent..st b/src/Squot.package/SquotPatcher.class/instance/materializedFrom.ifPresent.ifAbsent..st deleted file mode 100644 index 869e37782..000000000 --- a/src/Squot.package/SquotPatcher.class/instance/materializedFrom.ifPresent.ifAbsent..st +++ /dev/null @@ -1,3 +0,0 @@ -public -materializedFrom: aShadow ifPresent: presentBlock ifAbsent: absentBlock - ^ treatedObjects at: aShadow undecorated ifPresent: presentBlock ifAbsent: absentBlock \ No newline at end of file diff --git a/src/Squot.package/SquotPatcher.class/instance/take.asMaterializedFrom..st b/src/Squot.package/SquotPatcher.class/instance/take.asMaterializedFrom..st index 7c8955e79..7de8de20f 100644 --- a/src/Squot.package/SquotPatcher.class/instance/take.asMaterializedFrom..st +++ b/src/Squot.package/SquotPatcher.class/instance/take.asMaterializedFrom..st @@ -1,4 +1,4 @@ -public +private take: anObject asMaterializedFrom: aShadow "Recognize anObject as being the materialized form of aShadow." treatedObjects at: aShadow undecorated put: anObject. \ No newline at end of file diff --git a/src/Squot.package/SquotPatcher.class/instance/updateReference.from.reflectedIn.for.withValue..st b/src/Squot.package/SquotPatcher.class/instance/updateReference.from.reflectedIn.for.withValue..st index e33371e2a..50ac5b84f 100644 --- a/src/Squot.package/SquotPatcher.class/instance/updateReference.from.reflectedIn.for.withValue..st +++ b/src/Squot.package/SquotPatcher.class/instance/updateReference.from.reflectedIn.for.withValue..st @@ -1,4 +1,4 @@ -public +private updateReference: reference from: referrer reflectedIn: mirror for: aDiff withValue: materialized "Update all known references to the new object where its hash does not matter. Reactivate each object that needs no more references to be filled in." | remaining | diff --git a/src/Squot.package/SquotPatcher.class/instance/updateReferrersTo.materializedFrom..st b/src/Squot.package/SquotPatcher.class/instance/updateReferrersTo.materializedFrom..st index 94fc0f6f4..b42768f94 100644 --- a/src/Squot.package/SquotPatcher.class/instance/updateReferrersTo.materializedFrom..st +++ b/src/Squot.package/SquotPatcher.class/instance/updateReferrersTo.materializedFrom..st @@ -1,4 +1,4 @@ -public +private updateReferrersTo: materialized materializedFrom: aShadow "Update all known references to the new object where its hash does not matter. Reactivate each object that needs no more references to be filled in." (pendingIncomingReferences removeKey: aShadow undecorated ifAbsent: [#()]) do: diff --git a/src/Squot.package/SquotPatcher.class/methodProperties.json b/src/Squot.package/SquotPatcher.class/methodProperties.json index d7794483d..1905c7617 100644 --- a/src/Squot.package/SquotPatcher.class/methodProperties.json +++ b/src/Squot.package/SquotPatcher.class/methodProperties.json @@ -7,11 +7,8 @@ "applying:fill:reachedVia:into:reflectedIn:ifDeferredUntilActivated:ifNotTreatedYet:" : "jr 7/18/2021 00:29", "assignIdentifierIfAnyTo:reflectedIn:in:materializedFrom:" : "jr 7/18/2021 00:57", "fill:reachedVia:into:reflectedIn:ifDeferredUntilActivated:ifUnavailable:" : "jr 6/13/2021 17:35", - "fillInReferencesOf:reflectedIn:from:reflectedIn:unavailableReferencesDo:" : "jr 6/13/2021 17:35", "findOrCreateMaterializedInstanceOf:reflectedIn:ifNew:" : "jr 6/17/2021 23:38", "initialize" : "jr 6/13/2021 12:08", - "materializedFrom:ifAbsent:" : "jr 6/13/2021 12:08", - "materializedFrom:ifPresent:ifAbsent:" : "jr 6/13/2021 12:08", "reactivate:" : "jr 7/4/2021 18:54", "registry:" : "jr 6/12/2021 17:07", "sourceGraph:" : "jr 6/12/2021 01:37", From 60c23639a0dc7b1735eb6adab963502c3774aa5e Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 15:14:37 +0200 Subject: [PATCH 10/43] Fix: assertion error due to packages getting the same object name --- .../SquotPackageShadow.class/instance/printOn..st | 6 ++++++ .../instance/sameIn.withName.ifAbsent..st | 4 +++- .../SquotPackageShadow.class/methodProperties.json | 3 ++- .../instance/rematerializeGraph..st | 7 ++++++- .../SquotShadowMaterializer.class/methodProperties.json | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 src/Squot.package/SquotPackageShadow.class/instance/printOn..st diff --git a/src/Squot.package/SquotPackageShadow.class/instance/printOn..st b/src/Squot.package/SquotPackageShadow.class/instance/printOn..st new file mode 100644 index 000000000..f6056718f --- /dev/null +++ b/src/Squot.package/SquotPackageShadow.class/instance/printOn..st @@ -0,0 +1,6 @@ +printing +printOn: aStream + super printOn: aStream. + aStream + nextPutAll: ' of '; nextPutAll: packageName; + yourself. \ No newline at end of file diff --git a/src/Squot.package/SquotPackageShadow.class/instance/sameIn.withName.ifAbsent..st b/src/Squot.package/SquotPackageShadow.class/instance/sameIn.withName.ifAbsent..st index 2d1da0934..bea4e6a60 100644 --- a/src/Squot.package/SquotPackageShadow.class/instance/sameIn.withName.ifAbsent..st +++ b/src/Squot.package/SquotPackageShadow.class/instance/sameIn.withName.ifAbsent..st @@ -2,7 +2,9 @@ accessing sameIn: aShadowGraph withName: aName ifAbsent: aBlock | otherEdition | otherEdition := aShadowGraph shadowNamed: aName ifAbsent: [^ aBlock value]. - self assert: otherEdition packageName = packageName. + otherEdition packageName ~= packageName + ifTrue: "Graph contained a different package." + [^ aBlock value]. self assert: aShadowGraph startShadow undecorated = otherEdition description: 'Packages should be the source of a tracked object graph'. ^ otherEdition \ No newline at end of file diff --git a/src/Squot.package/SquotPackageShadow.class/methodProperties.json b/src/Squot.package/SquotPackageShadow.class/methodProperties.json index 71b8308f9..72ba3e7bf 100644 --- a/src/Squot.package/SquotPackageShadow.class/methodProperties.json +++ b/src/Squot.package/SquotPackageShadow.class/methodProperties.json @@ -18,7 +18,8 @@ "mergeSnapshotInto:basedOn:" : "jr 9/25/2019 21:16", "monticelloPatcher" : "jr 9/25/2019 21:30", "packageName" : "jr 9/20/2017 21:06", - "sameIn:withName:ifAbsent:" : "jr 9/18/2019 20:41", + "printOn:" : "jr 7/25/2021 14:23", + "sameIn:withName:ifAbsent:" : "jr 7/25/2021 14:34", "setPackageName:snapshot:tonelProperties:" : "jr 12/4/2020 20:22", "snapshot:" : "jr 6/6/2020 01:11", "squotDiffAgainst:" : "jr 9/25/2019 22:24", diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/rematerializeGraph..st b/src/Squot.package/SquotShadowMaterializer.class/instance/rematerializeGraph..st index 48ec5b51b..0b0324451 100644 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/rematerializeGraph..st +++ b/src/Squot.package/SquotShadowMaterializer.class/instance/rematerializeGraph..st @@ -1,6 +1,6 @@ public converting rematerializeGraph: aShadowGraph - | existingRoot targetGraph | + | existingRoot existingShadow targetGraph | existingRoot := objectRegistry objectNamed: aShadowGraph startName ifAbsent: []. targetGraph := existingRoot @@ -11,5 +11,10 @@ rematerializeGraph: aShadowGraph registry: objectRegistry; captureGraph: existingRoot; objectGraph]. + existingShadow := aShadowGraph startShadow sameIn: targetGraph asIn: aShadowGraph ifAbsent: []. + "If the object looked up by name is not really the same as the object captured in aShadowGraph, start from an empty graph instead. All packages get the SquotShadowGraph anonymousObjectName, and the registry might have several packages, so it is not guaranteed that the correct one is obtained from objectNamed:ifAbsent:." + existingShadow ifNil: [targetGraph := SquotMutableObjectGraph empty + delegateRegistry: objectRegistry; + yourself]. self assert: (targetGraph isKindOf: SquotMutableObjectGraph). ^ self rematerializeGraph: aShadowGraph into: targetGraph \ No newline at end of file diff --git a/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json b/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json index 25b620633..3c3204834 100644 --- a/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json +++ b/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json @@ -6,7 +6,7 @@ "objectGraph" : "jr 7/30/2017 02:18", "registry" : "jr 7/29/2017 18:15", "registry:" : "jr 7/6/2017 15:29", - "rematerializeGraph:" : "jr 7/10/2021 13:42", + "rematerializeGraph:" : "jr 7/25/2021 15:09", "rematerializeGraph:into:" : "jr 7/17/2021 02:11", "sourceGraph" : "jr 7/30/2017 02:20", "sourceGraph:" : "jr 7/30/2017 02:20", From 25eb0135690a6049bb5e6e0cd072e421c2c3f29f Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 15:31:27 +0200 Subject: [PATCH 11/43] Use SquotGraphComparisonWalk in SquotDiffBuilder Like refactored in capturing before, comparison in squotDiffAgainst:with: is no longer supposed to advance the search to the referenced objects by itself. The main method that drives the graph comparison SquotDiffBuilder>>newStartFromLeft:right: is still long and due to be refactored. Refactor the graph comparison walk itself as well to support everything that is needed for comparing arbitrary shadow graphs, not just the tree structures of SquotTrackedObjectMetadata. Remember the removed value in SquotReferenceRemoval to be able to convert back and forth to/from SquotSlotRemoval. The Text tracking test is now also green in the in-memory repository dummy implementation. --- .../instance/asSlotDiffKey.st | 3 + .../instance/asSlotWithValue..st | 6 + .../methodProperties.json | 2 + .../instance/addToBeVisitedLeft.right..st | 2 +- .../instance/addedObject.withName..st | 2 +- .../instance/followReferences.st | 5 - .../instance/newStartFromLeft.right..st | 130 ++++++++++++++++++ .../instance/startFromLeft.right..st | 8 +- .../methodProperties.json | 8 +- .../instance/addLeft.right.reachedVia..st | 12 ++ .../instance/addNewObject.reachedVia..st | 5 + .../instance/checkPathsTo.ifMultiple..st | 3 + .../instance/do..st | 6 +- ...hape.ifFromBoth.ifOnlyLeft.ifOnlyRight..st | 27 ++++ ...fOnlyLeft.ifOnlyRight.ifAlreadyVisited..st | 24 ++-- .../followReferencesOfNewObject.do..st | 9 ++ .../instance/startFrom.and..st | 4 +- .../methodProperties.json | 11 +- .../instance/addReferenceDiff..st | 7 + .../instance/addTransitiveChangeIn..st | 2 + .../instance/diff.against.with..st | 2 +- .../instance/initialize.st | 3 + .../methodProperties.json | 6 +- .../instance/expectedFailures.st | 6 - .../methodProperties.json | 1 - .../instance/asSlotDiffKey.st | 3 + .../instance/asSlotWithValue..st | 3 + .../methodProperties.json | 2 + .../instance/asSlotDiffKey.st | 3 + .../instance/asSlotWithValue..st | 3 + .../methodProperties.json | 2 + .../instance/canHaveReferences..st | 4 + .../instance/is.comparableTo..st | 4 + .../SquotMirror.class/methodProperties.json | 2 + .../instance/addReferenceDiff..st | 3 + .../instance/addTransitiveChangeIn..st | 5 +- .../instance/diff.against.with..st | 4 +- .../diffSlot.withCorrespondingSlotIn.with..st | 1 + .../methodProperties.json | 7 +- .../assertDiffAgainstItselfHasNoChanges..st | 8 +- .../methodProperties.json | 2 +- ...eDiffsWithDefaultOwners.reflectedIn.do..st | 5 +- .../methodProperties.json | 2 +- .../instance/testMoveObjectCloserToStart.st | 11 ++ .../instance/testRectangles.st | 6 +- .../methodProperties.json | 3 +- .../class/diff.objectName..st | 5 + .../instance/setDiff.objectName..st | 4 + .../methodProperties.json | 5 +- .../instance/canHaveReferences..st | 9 ++ .../instance/is.comparableTo..st | 3 + .../methodProperties.json | 2 + .../instance/canHaveReferences.st | 3 + .../instance/isComparableTo..st | 3 +- .../instance/nextMirror..st | 2 +- .../methodProperties.json | 5 +- .../instance/addReferenceDiff..st | 3 + .../methodProperties.json | 1 + .../instance/^equals.st | 2 +- .../instance/canHaveReferences..st | 8 ++ .../instance/is.comparableTo..st | 3 + .../methodProperties.json | 4 +- .../instance/canHaveReferences..st | 3 + .../instance/is.comparableTo..st | 3 + .../methodProperties.json | 2 + .../instance/asSlotDiff.st | 3 + .../methodProperties.json | 1 + .../instance/asSlotDiff.st | 4 + .../methodProperties.json | 1 + .../class/from.reference.rightObject..st | 6 - .../class/of.from.reference.rightObject..st | 6 + .../instance/asSlotDiff.st | 3 + ...Target.reference.leftOwner.rightObject..st | 5 + .../methodProperties.json | 4 +- .../properties.json | 2 +- .../instance/asSlotDiff.st | 3 + .../methodProperties.json | 1 + ...renceDiffWithDefaultOwners.reflectedIn..st | 1 + .../methodProperties.json | 2 +- .../instance/canHaveReferences..st | 3 + .../instance/is.comparableTo..st | 3 + .../methodProperties.json | 2 + .../instance/squotDiffAgainst..st | 20 ++- .../instance/squotMergeWith.basedOn..st | 2 +- .../methodProperties.json | 4 +- .../testCyclesDoNotCauseInifiniteLoops.st | 12 ++ .../methodProperties.json | 1 + .../instance/is.comparableTo..st | 3 + .../methodProperties.json | 1 + .../instance/addReferenceDiff..st | 3 + .../TSquotDiff.trait/methodProperties.json | 1 + 91 files changed, 460 insertions(+), 84 deletions(-) create mode 100644 src/Squot.package/SquotCollectionElement.class/instance/asSlotDiffKey.st create mode 100644 src/Squot.package/SquotCollectionElement.class/instance/asSlotWithValue..st delete mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/followReferences.st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/newStartFromLeft.right..st create mode 100644 src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st create mode 100644 src/Squot.package/SquotGraphComparisonWalk.class/instance/addNewObject.reachedVia..st create mode 100644 src/Squot.package/SquotGraphComparisonWalk.class/instance/checkPathsTo.ifMultiple..st create mode 100644 src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifFromBoth.ifOnlyLeft.ifOnlyRight..st create mode 100644 src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOfNewObject.do..st create mode 100644 src/Squot.package/SquotHashedCollectionDiff.class/instance/addReferenceDiff..st create mode 100644 src/Squot.package/SquotHashedCollectionDiff.class/instance/initialize.st delete mode 100644 src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st create mode 100644 src/Squot.package/SquotIndexableField.class/instance/asSlotDiffKey.st create mode 100644 src/Squot.package/SquotIndexableField.class/instance/asSlotWithValue..st create mode 100644 src/Squot.package/SquotInstanceVariable.class/instance/asSlotDiffKey.st create mode 100644 src/Squot.package/SquotInstanceVariable.class/instance/asSlotWithValue..st create mode 100644 src/Squot.package/SquotMirror.class/instance/canHaveReferences..st create mode 100644 src/Squot.package/SquotMirror.class/instance/is.comparableTo..st create mode 100644 src/Squot.package/SquotObjectDiff.class/instance/addReferenceDiff..st create mode 100644 src/Squot.package/SquotObjectGraphDiffTest.class/instance/testMoveObjectCloserToStart.st create mode 100644 src/Squot.package/SquotObjectGraphReference.class/class/diff.objectName..st create mode 100644 src/Squot.package/SquotObjectGraphReference.class/instance/setDiff.objectName..st create mode 100644 src/Squot.package/SquotObjectMirror.class/instance/canHaveReferences..st create mode 100644 src/Squot.package/SquotObjectMirror.class/instance/is.comparableTo..st create mode 100644 src/Squot.package/SquotObjectReflection.class/instance/canHaveReferences.st create mode 100644 src/Squot.package/SquotObjectReplacement.class/instance/addReferenceDiff..st create mode 100644 src/Squot.package/SquotObjectShadowMirror.class/instance/canHaveReferences..st create mode 100644 src/Squot.package/SquotObjectShadowMirror.class/instance/is.comparableTo..st create mode 100644 src/Squot.package/SquotOpaqueValueMirror.class/instance/canHaveReferences..st create mode 100644 src/Squot.package/SquotOpaqueValueMirror.class/instance/is.comparableTo..st create mode 100644 src/Squot.package/SquotReferenceAddition.class/instance/asSlotDiff.st create mode 100644 src/Squot.package/SquotReferenceDiff.class/instance/asSlotDiff.st delete mode 100644 src/Squot.package/SquotReferenceRemoval.class/class/from.reference.rightObject..st create mode 100644 src/Squot.package/SquotReferenceRemoval.class/class/of.from.reference.rightObject..st create mode 100644 src/Squot.package/SquotReferenceRemoval.class/instance/asSlotDiff.st create mode 100644 src/Squot.package/SquotReferenceRemoval.class/instance/setOldTarget.reference.leftOwner.rightObject..st create mode 100644 src/Squot.package/SquotReferenceTargetExchange.class/instance/asSlotDiff.st create mode 100644 src/Squot.package/SquotStringMirror.class/instance/canHaveReferences..st create mode 100644 src/Squot.package/SquotStringMirror.class/instance/is.comparableTo..st create mode 100644 src/Squot.package/SquotTrackedObjectMetadataDiffTest.class/instance/testCyclesDoNotCauseInifiniteLoops.st create mode 100644 src/Squot.package/SquotTrackedObjectMetadataMirror.class/instance/is.comparableTo..st create mode 100644 src/Squot.package/TSquotDiff.trait/instance/addReferenceDiff..st diff --git a/src/Squot.package/SquotCollectionElement.class/instance/asSlotDiffKey.st b/src/Squot.package/SquotCollectionElement.class/instance/asSlotDiffKey.st new file mode 100644 index 000000000..441f44d3c --- /dev/null +++ b/src/Squot.package/SquotCollectionElement.class/instance/asSlotDiffKey.st @@ -0,0 +1,3 @@ +converting +asSlotDiffKey + ^ self \ No newline at end of file diff --git a/src/Squot.package/SquotCollectionElement.class/instance/asSlotWithValue..st b/src/Squot.package/SquotCollectionElement.class/instance/asSlotWithValue..st new file mode 100644 index 000000000..ae9c27a9a --- /dev/null +++ b/src/Squot.package/SquotCollectionElement.class/instance/asSlotWithValue..st @@ -0,0 +1,6 @@ +converting +asSlotWithValue: anObject + self assert: target = anObject. + ^ anObject originalClass = Association + ifTrue: [SquotDictionarySlot key: self value: anObject] + ifFalse: [SquotHashedCollectionSlot key: self value: anObject] \ No newline at end of file diff --git a/src/Squot.package/SquotCollectionElement.class/methodProperties.json b/src/Squot.package/SquotCollectionElement.class/methodProperties.json index 0a40ef456..672159eb2 100644 --- a/src/Squot.package/SquotCollectionElement.class/methodProperties.json +++ b/src/Squot.package/SquotCollectionElement.class/methodProperties.json @@ -6,6 +6,8 @@ "=" : "jr 4/8/2021 13:32", "asCapturedReference" : "jr 4/17/2021 18:24", "asMaterializedReference" : "jr 4/17/2021 18:19", + "asSlotDiffKey" : "jr 7/18/2021 20:28", + "asSlotWithValue:" : "jr 7/18/2021 21:50", "copyWithTarget:" : "jr 4/17/2021 18:25", "hash" : "jr 4/7/2021 21:34", "initialize" : "jr 4/17/2021 17:30", diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/addToBeVisitedLeft.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/addToBeVisitedLeft.right..st index 328937b95..d0b2a776c 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/addToBeVisitedLeft.right..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/addToBeVisitedLeft.right..st @@ -4,4 +4,4 @@ addToBeVisitedLeft: leftShadow right: rightShadow [:name | shadowNames at: leftShadow undecorated put: name]. (right nameOf: rightShadow undecorated ifAbsent: []) ifNotNil: [:name | shadowNames at: rightShadow undecorated put: name]. - toBeVisited add: leftShadow -> rightShadow. \ No newline at end of file + "toBeVisited add: leftShadow -> rightShadow." \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName..st b/src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName..st index 221a2da60..6b1d376b7 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName..st @@ -1,4 +1,4 @@ diffing low-level addedObject: aShadow withName: name - graphDiff addShadow: aShadow named: name. + name ifNotNil: [graphDiff addShadow: aShadow named: name]. self addToBeVisitedLeft: nil right: aShadow. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/followReferences.st b/src/Squot.package/SquotDiffBuilder.class/instance/followReferences.st deleted file mode 100644 index 1b57a292a..000000000 --- a/src/Squot.package/SquotDiffBuilder.class/instance/followReferences.st +++ /dev/null @@ -1,5 +0,0 @@ -private -followReferences - [toBeVisited isEmpty] whileFalse: - [self follow: toBeVisited removeFirst]. - diffedPair := nil. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/newStartFromLeft.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/newStartFromLeft.right..st new file mode 100644 index 000000000..c862e0da1 --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/newStartFromLeft.right..st @@ -0,0 +1,130 @@ +diffing high-level +newStartFromLeft: leftStartShadow right: rightStartShadow + "Walk the two object graphs and record the differences. Answer the graph diff." + "The first objects always get a name, so that their diff can be found in the graph diff. If the first objects have different identities, a SquotObjectReplacement is recorded as their diff. Otherwise the references of each pair of encountered object are followed and if the values of the references have been reassigned, diffs are created for the referrers and reference diffs are added to them. If references have been added or removed, this is also added to the diff of the referrers. If a diff is created for a pair of objects, a diff is also created for the pair of referrers, noting that the object referred to has been changed somehow." + | walk fallbackName | + self initialize. + graphDiff left: left; right: right. + walk := SquotGraphComparisonWalk startingFrom: leftStartShadow and: rightStartShadow. + fallbackName := ({rightStartShadow. leftStartShadow} detect: #hasSquotShadowName ifNone: []) + ifNotNil: [:shadow | shadow name] + ifNil: [SquotObjectCapturer new rootName]. + self rememberNameOf: leftStartShadow orAssume: [fallbackName]. + self rememberNameOf: rightStartShadow orAssume: [fallbackName]. + (shadowNames at: leftStartShadow undecorated) ~= (shadowNames at: rightStartShadow undecorated) + ifTrue: + ["Start objects have different identities." + | newName diff | + newName := shadowNames at: rightStartShadow undecorated. + diff := self diffFrom: leftStartShadow to: rightStartShadow + ifNew: [SquotObjectReplacement left: leftStartShadow right: rightStartShadow] + andInitialize: []]. + walk do: + [:leftShadow :rightShadow :leftReferrer :rightReferrer :path | | reference | + reference := path ifNotEmpty: [path last]. + diffedPair := leftShadow -> rightShadow. + leftShadow + ifNil: "Walking via a new object that did not exist in the old graph." + [walk followReferencesOfNewObject: rightShadow do: + [:value :newPath | | alreadyVisited | + alreadyVisited := false. + walk checkPathsTo: value ifMultiple: [alreadyVisited := true]. + alreadyVisited ifFalse: + [| existing name | + name := self rememberNameOf: value. + existing := value sameIn: left asIn: right ifAbsent: []. + existing + ifNil: + [self addedObject: value withName: name. + walk addNewObject: value reachedVia: newPath last] + ifNotNil: [walk addLeft: existing right: value reachedVia: newPath last]]]] + ifNotNil: "Comparing two objects with the same identity (except for the start objects which might still have different identities)." + [| diff | + "Give objects with intrinsic state a chance to compute the mutation." + diff := leftShadow squotDiffAgainst: rightShadow with: self. + "For other objects, the evaluation of the references is the important part." + walk followReferencesOf: leftShadow and: rightShadow + ifDifferentShape: + ["Replaced or objects without modeled outgoing references." + "Except for the start objects, this case was already handled when the names of the shadows were different before they were added to the walk. Objects of different kinds must have different identities if they have any identity at all." + | existing name | + self assert: path isEmpty. "May only happen with the start objects." + name := shadowNames at: rightShadow undecorated. + existing := rightShadow sameIn: left asIn: right ifAbsent: []. + existing + ifNil: + [self addedObject: rightShadow withName: name. + "Add to the walk again to get the addition in the graph diff." + walk addNewObject: rightShadow reachedVia: nil] + ifNotNil: + [existing undecorated ~= leftShadow + ifTrue: [walk addLeft: existing right: rightShadow reachedVia: nil]]] + ifFromBoth: + [:leftValue :rightValue :commonPath | | rightName | + self rememberNameOf: leftValue. + rightName := self rememberNameOf: rightValue. + (shadowNames at: leftValue undecorated ifAbsent: [1]) + = (shadowNames at: rightValue undecorated ifAbsent: [2]) + ifTrue: "The reference itself did not change, but we might later find out that the value has some differences." + [| alreadyVisited | + alreadyVisited := false. + walk checkPathsTo: leftValue ifMultiple: [alreadyVisited := true]. + alreadyVisited + ifTrue: + [(objectsWithChanges includes: leftValue undecorated) + ifTrue: [diff addReferenceDiff: + (SquotDifferentReferenceTarget + reference: commonPath last + leftOwner: leftShadow target: leftValue + rightOwner: rightShadow target: rightValue)]] + ifFalse: "left object not visited yet" + [walk addLeft: leftValue right: rightValue reachedVia: commonPath last]] + ifFalse: "Reference was reassigned to a different object or the targets are value objects." + [leftValue = rightValue ifFalse: + [diff addReferenceDiff: + (SquotReferenceTargetExchange + reference: commonPath last + leftOwner: leftShadow target: leftValue + rightOwner: rightShadow target: rightValue)]]. + rightValue sameIn: left asIn: right ifAbsent: + [| alreadyVisited | + alreadyVisited := false. + walk checkPathsTo: rightValue ifMultiple: [alreadyVisited := true]. + alreadyVisited ifFalse: + [self addedObject: rightValue withName: rightName. + walk addNewObject: rightValue reachedVia: commonPath last]]. + (objectsWithChanges includes: leftValue undecorated) ifFalse: + [(referrers at: leftValue undecorated ifAbsentPut: [OrderedCollection new]) + add: leftShadow -> commonPath last. + (referrers at: rightValue undecorated ifAbsentPut: [OrderedCollection new]) + add: rightShadow -> commonPath last]] + ifOnlyLeft: [:removed :oldPath | "Reference was removed" + diff addReferenceDiff: + (SquotReferenceRemoval of: removed + from: leftShadow reference: oldPath last + rightObject: rightShadow)] + ifOnlyRight: [:added :newPath | | alreadyVisited | + "Reference was added. Target might be new too, but not necessarily." + diff addReferenceDiff: + (SquotReferenceAddition + to: leftShadow reference: newPath last target: added + rightOwner: rightShadow). + alreadyVisited := false. + walk checkPathsTo: added ifMultiple: [alreadyVisited := true]. + alreadyVisited ifFalse: + [| existing name | + name := self rememberNameOf: added. + existing := added sameIn: left asIn: right ifAbsent: []. + existing + ifNil: + [self addedObject: added withName: name. + walk addNewObject: added reachedVia: newPath last] + ifNotNil: [walk addLeft: existing right: added reachedVia: newPath last]]]]]. + diffedPair := nil. + (objectDiffs select: [:each | each squotHasChanges]) + keysAndValuesDo: + [:shadow :diff | + graphDiff addDiff: diff forObjectNamed: (left nameOf: shadow). + self noteChanged: shadow]. + graphDiff startObjectName: (shadowNames at: leftStartShadow undecorated). + ^ graphDiff \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st index fa0068202..502ed59db 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st @@ -1,14 +1,18 @@ diffing high-level startFromLeft: leftShadow right: rightShadow - | fallbackName | + | walk fallbackName | + true ifTrue: [^ self newStartFromLeft: leftShadow right: rightShadow]. self initialize. graphDiff left: left; right: right. + walk := SquotGraphComparisonWalk startingFrom: leftShadow and: rightShadow. fallbackName := ({rightShadow. leftShadow} detect: #hasSquotShadowName ifNone: []) ifNotNil: [:shadow | shadow name] ifNil: [SquotObjectCapturer new rootName]. self rememberNameOf: leftShadow orAssume: [fallbackName]. self rememberNameOf: rightShadow orAssume: [fallbackName]. self addToBeVisitedLeft: leftShadow right: rightShadow. - self followReferences. + [toBeVisited isEmpty] whileFalse: + [self follow: toBeVisited removeFirst]. + diffedPair := nil. graphDiff startObjectName: (shadowNames at: leftShadow undecorated). ^ graphDiff \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json index b6e851c3d..efabd4060 100644 --- a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json +++ b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json @@ -2,17 +2,17 @@ "class" : { }, "instance" : { - "addToBeVisitedLeft:right:" : "jr 9/24/2019 15:03", - "addedObject:withName:" : "jr 9/24/2019 14:06", + "addToBeVisitedLeft:right:" : "jr 7/18/2021 20:02", + "addedObject:withName:" : "jr 7/19/2021 00:14", "diffFrom:to:ifNew:andInitialize:" : "jr 6/27/2020 10:27", "follow:" : "jr 9/24/2019 13:54", "followAddedObjectReferences:" : "jr 9/24/2019 14:19", - "followReferences" : "jr 6/22/2017 13:49", "initialize" : "jr 9/30/2017 19:47", "left" : "jr 9/21/2019 21:03", "left:" : "jr 9/21/2019 21:03", "left:right:" : "jr 8/15/2017 19:38", "leftSlot:rightSlot:" : "jr 9/24/2019 14:07", + "newStartFromLeft:right:" : "jr 7/18/2021 22:41", "noteChanged:" : "jr 8/15/2017 19:03", "noteChangedReferrer:via:to:" : "jr 7/27/2017 00:03", "reassignSlot:to:" : "jr 9/16/2019 21:32", @@ -21,4 +21,4 @@ "replacing:with:" : "jr 7/7/2021 23:51", "right" : "jr 9/21/2019 21:03", "right:" : "jr 9/21/2019 21:03", - "startFromLeft:right:" : "jr 9/21/2019 22:36" } } + "startFromLeft:right:" : "jr 7/18/2021 20:03" } } diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st new file mode 100644 index 000000000..74ffd2a09 --- /dev/null +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st @@ -0,0 +1,12 @@ +enumerating +addLeft: nextLeft right: nextRight reachedVia: aReference + "Enqueue the pair of nextLeft and nextRight to the walk." + "The mirror for nextLeft can be missing if nextRight is now closer to the start object than before." + (mirrors includesKey: nextLeft undecorated) ifFalse: + ["Workaround: use the mirror for nextRight. Since both are supposed to be editions of the same object, they should be of the same kind and so it should be no problem to use the same mirror for them." + mirrors at: nextLeft undecorated put: (mirrors at: nextRight undecorated)]. + self assert: (mirrors includesKey: nextLeft undecorated); + assert: (mirrors includesKey: nextRight undecorated). + walk + add: {nextLeft. nextRight} + reachedVia: aReference. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/addNewObject.reachedVia..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/addNewObject.reachedVia..st new file mode 100644 index 000000000..6b4413d35 --- /dev/null +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/addNewObject.reachedVia..st @@ -0,0 +1,5 @@ +enumerating +addNewObject: anObject reachedVia: aReference + walk + add: {nil. anObject} + reachedVia: aReference. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/checkPathsTo.ifMultiple..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/checkPathsTo.ifMultiple..st new file mode 100644 index 000000000..beec99efd --- /dev/null +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/checkPathsTo.ifMultiple..st @@ -0,0 +1,3 @@ +enumerating +checkPathsTo: anObject ifMultiple: aBlock + walk checkPathsTo: anObject ifMultiple: [aBlock value]. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/do..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/do..st index b8f2a6c45..89c4633a5 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/instance/do..st +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/do..st @@ -3,10 +3,12 @@ do: aBlock walk do: [:each | each first ~= each second ifTrue: - [| referrers | + [| referrers path | referrers := walk currentReferrer. + path := walk currentPath. aBlock value: each first value: each second value: (referrers ifNotNil: [referrers first]) - value: (referrers ifNotNil: [referrers second])]]. \ No newline at end of file + value: (referrers ifNotNil: [referrers second]) + value: path]]. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifFromBoth.ifOnlyLeft.ifOnlyRight..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifFromBoth.ifOnlyLeft.ifOnlyRight..st new file mode 100644 index 000000000..129e65729 --- /dev/null +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifFromBoth.ifOnlyLeft.ifOnlyRight..st @@ -0,0 +1,27 @@ +enumerating +followReferencesOf: left and: right ifDifferentShape: replacementBlock ifFromBoth: commonRefBlock ifOnlyLeft: removalBlock ifOnlyRight: additionBlock + | leftReflected rightReflected | + leftReflected := SquotObjectReflection object: left mirror: (mirrors at: left undecorated). + rightReflected := SquotObjectReflection object: right mirror: (mirrors at: right undecorated). + ((leftReflected isComparableTo: rightReflected) not + or: [leftReflected canHaveReferences not + or: [rightReflected canHaveReferences not]]) + ifTrue: [replacementBlock value] + ifFalse: + [(leftReflected references intersection: rightReflected references) do: + [:each | | nextLeft nextRight | + nextLeft := leftReflected reflect: each. + nextRight := rightReflected reflect: each. + mirrors at: nextLeft undecorated put: (leftReflected nextMirror: each); + at: nextRight undecorated put: (rightReflected nextMirror: each). + commonRefBlock value: nextLeft value: nextRight value: (walk currentPath copyWith: each)]. + (leftReflected references copyWithoutAll: rightReflected references) do: + [:each | | oldTarget | + oldTarget := leftReflected reflect: each. + mirrors at: oldTarget undecorated put: (leftReflected nextMirror: each). + removalBlock value: oldTarget value: (walk currentPath copyWith: each)]. + (rightReflected references copyWithoutAll: leftReflected references) do: + [:each | | newTarget | + newTarget := rightReflected reflect: each. + mirrors at: newTarget undecorated put: (rightReflected nextMirror: each). + additionBlock value: newTarget value: (walk currentPath copyWith: each)]] \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifOnlyLeft.ifOnlyRight.ifAlreadyVisited..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifOnlyLeft.ifOnlyRight.ifAlreadyVisited..st index 3b810ba7b..d75f6f03b 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifOnlyLeft.ifOnlyRight.ifAlreadyVisited..st +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifOnlyLeft.ifOnlyRight.ifAlreadyVisited..st @@ -1,24 +1,32 @@ enumerating followReferencesOf: left and: right ifDifferentShape: replacementBlock ifOnlyLeft: removalBlock ifOnlyRight: additionBlock ifAlreadyVisited: multiPathBlock | leftReflected rightReflected | + self deprecated. leftReflected := SquotObjectReflection object: left mirror: (mirrors at: left). rightReflected := SquotObjectReflection object: right mirror: (mirrors at: right). ((leftReflected isComparableTo: rightReflected) not or: [leftReflected references isEmpty and: [rightReflected references isEmpty]]) - ifTrue: [replacementBlock value: walk currentPath] + ifTrue: [replacementBlock value] ifFalse: [ walk checkPathsTo: left ifMultiple: [multiPathBlock value]; checkPathsTo: right ifMultiple: [multiPathBlock value]. (leftReflected references intersection: rightReflected references) do: [:each | | nextLeft nextRight | + nextLeft := leftReflected reflect: each. + nextRight := rightReflected reflect: each. + mirrors at: nextLeft undecorated put: (leftReflected nextMirror: each); + at: nextRight undecorated put: (rightReflected nextMirror: each). walk - add: {nextLeft := leftReflected reflect: each. - nextRight := rightReflected reflect: each} - reachedVia: each. - mirrors at: nextLeft put: (leftReflected nextMirror: each); - at: nextRight put: (rightReflected nextMirror: each)]. + add: {nextLeft. nextRight} + reachedVia: each]. (leftReflected references copyWithoutAll: rightReflected references) do: - [:each | removalBlock value: (leftReflected reflect: each) value: (walk currentPath copyWith: each)]. + [:each | | oldTarget | + oldTarget := leftReflected reflect: each. + mirrors at: oldTarget undecorated put: (leftReflected nextMirror: each). + removalBlock value: oldTarget value: (walk currentPath copyWith: each)]. (rightReflected references copyWithoutAll: leftReflected references) do: - [:each | additionBlock value: (rightReflected reflect: each) value: (walk currentPath copyWith: each)]] \ No newline at end of file + [:each | | newTarget | + newTarget := rightReflected reflect: each. + mirrors at: newTarget undecorated put: (rightReflected nextMirror: each). + additionBlock value: newTarget value: (walk currentPath copyWith: each)]] \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOfNewObject.do..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOfNewObject.do..st new file mode 100644 index 000000000..cc4f793a9 --- /dev/null +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOfNewObject.do..st @@ -0,0 +1,9 @@ +enumerating +followReferencesOfNewObject: anObject do: aBlock + | reflected | + reflected := SquotObjectReflection object: anObject mirror: (mirrors at: anObject undecorated). + reflected references do: + [:each | | newTarget | + newTarget := reflected reflect: each. + mirrors at: newTarget undecorated put: (reflected nextMirror: each). + aBlock value: newTarget value: (walk currentPath copyWith: each)]. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/startFrom.and..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/startFrom.and..st index f280465bd..4ef667d7c 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/instance/startFrom.and..st +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/startFrom.and..st @@ -1,5 +1,5 @@ initialize-release startFrom: leftObject and: rightObject walk addFirst: {leftObject. rightObject}. - mirrors at: leftObject put: (thisContext objectClass: leftObject) squotMirror. - mirrors at: rightObject put: (thisContext objectClass: rightObject) squotMirror. \ No newline at end of file + mirrors at: leftObject undecorated put: (thisContext objectClass: leftObject undecorated) squotMirror. + mirrors at: rightObject undecorated put: (thisContext objectClass: rightObject undecorated) squotMirror. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json index 9a7a6addb..8c43aeda6 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json +++ b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json @@ -2,7 +2,12 @@ "class" : { "startingFrom:and:" : "jr 12/20/2020 21:48" }, "instance" : { - "do:" : "jr 1/9/2021 19:33", - "followReferencesOf:and:ifDifferentShape:ifOnlyLeft:ifOnlyRight:ifAlreadyVisited:" : "jr 4/8/2021 13:30", + "addLeft:right:reachedVia:" : "jr 7/18/2021 21:53", + "addNewObject:reachedVia:" : "jr 7/18/2021 16:19", + "checkPathsTo:ifMultiple:" : "jr 7/18/2021 17:05", + "do:" : "jr 7/18/2021 11:38", + "followReferencesOf:and:ifDifferentShape:ifFromBoth:ifOnlyLeft:ifOnlyRight:" : "jr 7/18/2021 22:10", + "followReferencesOf:and:ifDifferentShape:ifOnlyLeft:ifOnlyRight:ifAlreadyVisited:" : "jr 7/18/2021 17:00", + "followReferencesOfNewObject:do:" : "jr 7/18/2021 20:20", "initialize" : "jr 4/8/2021 13:25", - "startFrom:and:" : "jr 4/8/2021 13:26" } } + "startFrom:and:" : "jr 7/18/2021 11:39" } } diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/instance/addReferenceDiff..st b/src/Squot.package/SquotHashedCollectionDiff.class/instance/addReferenceDiff..st new file mode 100644 index 000000000..4753a9833 --- /dev/null +++ b/src/Squot.package/SquotHashedCollectionDiff.class/instance/addReferenceDiff..st @@ -0,0 +1,7 @@ +comparing +addReferenceDiff: aSquotReferenceDiff + | diff | + diff := aSquotReferenceDiff asSlotDiff. + (diff isRemoval or: [diff isAddition]) + ifTrue: [itemChanges add: diff] + ifFalse: [super addReferenceDiff: aSquotReferenceDiff]. \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/instance/addTransitiveChangeIn..st b/src/Squot.package/SquotHashedCollectionDiff.class/instance/addTransitiveChangeIn..st index 01ec624f4..425f3d3c6 100644 --- a/src/Squot.package/SquotHashedCollectionDiff.class/instance/addTransitiveChangeIn..st +++ b/src/Squot.package/SquotHashedCollectionDiff.class/instance/addTransitiveChangeIn..st @@ -2,4 +2,6 @@ initialize-release addTransitiveChangeIn: aSlot (aSlot isKindOf: SquotHashedCollectionSlot) ifTrue: [^ itemChanges add: (SquotSlotTransitiveChange key: aSlot key)]. + (aSlot isKindOf: SquotCollectionElement) ifTrue: + [^ itemChanges add: (SquotSlotTransitiveChange key: aSlot asSlotDiffKey)]. ^ super addTransitiveChangeIn: aSlot \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/instance/diff.against.with..st b/src/Squot.package/SquotHashedCollectionDiff.class/instance/diff.against.with..st index 548896bd2..6c11d72f4 100644 --- a/src/Squot.package/SquotHashedCollectionDiff.class/instance/diff.against.with..st +++ b/src/Squot.package/SquotHashedCollectionDiff.class/instance/diff.against.with..st @@ -1,4 +1,4 @@ initialize-release diff: leftObjectShadow against: rightShadow with: aDiffBuilder super diff: leftObjectShadow against: rightShadow with: aDiffBuilder. - leftObjectShadow diffItemsAgainstThoseOf: rightShadow in: self with: aDiffBuilder. \ No newline at end of file + "leftObjectShadow diffItemsAgainstThoseOf: rightShadow in: self with: aDiffBuilder." \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/instance/initialize.st b/src/Squot.package/SquotHashedCollectionDiff.class/instance/initialize.st new file mode 100644 index 000000000..6cd3fcda5 --- /dev/null +++ b/src/Squot.package/SquotHashedCollectionDiff.class/instance/initialize.st @@ -0,0 +1,3 @@ +initialize-release +initialize + itemChanges := Dictionary new. \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json b/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json index 6e19104e8..468b9e5fb 100644 --- a/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json +++ b/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json @@ -2,12 +2,14 @@ "class" : { }, "instance" : { - "addTransitiveChangeIn:" : "jr 7/30/2017 00:06", + "addReferenceDiff:" : "jr 7/18/2021 20:51", + "addTransitiveChangeIn:" : "jr 7/18/2021 21:02", "applyTo:with:" : "jr 7/29/2017 22:06", "diff:against:" : "jr 9/18/2019 20:18", - "diff:against:with:" : "jr 6/22/2017 13:06", + "diff:against:with:" : "jr 7/18/2021 20:34", "diffItems:againstThoseOf:" : "jr 9/18/2019 20:18", "diffItems:againstThoseOf:with:" : "jr 6/22/2017 13:05", + "initialize" : "jr 7/18/2021 20:50", "itemChanges" : "jr 6/25/2017 22:25", "postCopy" : "jr 11/18/2018 02:02", "referenceDiffsWithDefaultOwners:reflectedIn:do:" : "jr 6/27/2021 22:55", diff --git a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st deleted file mode 100644 index bdb7f1a0c..000000000 --- a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st +++ /dev/null @@ -1,6 +0,0 @@ -failures -expectedFailures - | bugs | - bugs := #(testTrackingText "Because patched object graphs are inconsistent: the list of object names does not use the same instances as the referenced objects."). - bugs flag: #todo. "Fix them" - ^ super expectedFailures, bugs \ No newline at end of file diff --git a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json index 8e52995f8..217feabd2 100644 --- a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json +++ b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json @@ -2,7 +2,6 @@ "class" : { }, "instance" : { - "expectedFailures" : "jr 7/17/2021 21:57", "newRepository" : "jr 2/4/2017 01:58", "testImmutabilityOfSnapshots" : "jr 1/26/2020 22:58", "testVersionsDoNotContainWorkingCopyArtifacts" : "jr 11/18/2020 21:35" } } diff --git a/src/Squot.package/SquotIndexableField.class/instance/asSlotDiffKey.st b/src/Squot.package/SquotIndexableField.class/instance/asSlotDiffKey.st new file mode 100644 index 000000000..90fb4d1fc --- /dev/null +++ b/src/Squot.package/SquotIndexableField.class/instance/asSlotDiffKey.st @@ -0,0 +1,3 @@ +converting +asSlotDiffKey + ^ index \ No newline at end of file diff --git a/src/Squot.package/SquotIndexableField.class/instance/asSlotWithValue..st b/src/Squot.package/SquotIndexableField.class/instance/asSlotWithValue..st new file mode 100644 index 000000000..e9bdc959c --- /dev/null +++ b/src/Squot.package/SquotIndexableField.class/instance/asSlotWithValue..st @@ -0,0 +1,3 @@ +converting +asSlotWithValue: anObject + ^ SquotVariablePartSlot key: index value: anObject \ No newline at end of file diff --git a/src/Squot.package/SquotIndexableField.class/methodProperties.json b/src/Squot.package/SquotIndexableField.class/methodProperties.json index 110c70baf..4ad87b7e1 100644 --- a/src/Squot.package/SquotIndexableField.class/methodProperties.json +++ b/src/Squot.package/SquotIndexableField.class/methodProperties.json @@ -3,6 +3,8 @@ "index:" : "jr 12/15/2020 23:21" }, "instance" : { "=" : "jr 12/15/2020 23:29", + "asSlotDiffKey" : "jr 7/18/2021 20:19", + "asSlotWithValue:" : "jr 7/18/2021 20:22", "hash" : "jr 12/15/2020 23:29", "index" : "jr 12/15/2020 23:29", "newNameFragment" : "jr 4/7/2021 22:10", diff --git a/src/Squot.package/SquotInstanceVariable.class/instance/asSlotDiffKey.st b/src/Squot.package/SquotInstanceVariable.class/instance/asSlotDiffKey.st new file mode 100644 index 000000000..f87e401cb --- /dev/null +++ b/src/Squot.package/SquotInstanceVariable.class/instance/asSlotDiffKey.st @@ -0,0 +1,3 @@ +converting +asSlotDiffKey + ^ name \ No newline at end of file diff --git a/src/Squot.package/SquotInstanceVariable.class/instance/asSlotWithValue..st b/src/Squot.package/SquotInstanceVariable.class/instance/asSlotWithValue..st new file mode 100644 index 000000000..e646c384b --- /dev/null +++ b/src/Squot.package/SquotInstanceVariable.class/instance/asSlotWithValue..st @@ -0,0 +1,3 @@ +converting +asSlotWithValue: anObject + ^ SquotInstVarSlot key: name value: anObject \ No newline at end of file diff --git a/src/Squot.package/SquotInstanceVariable.class/methodProperties.json b/src/Squot.package/SquotInstanceVariable.class/methodProperties.json index 904172630..6acabd46c 100644 --- a/src/Squot.package/SquotInstanceVariable.class/methodProperties.json +++ b/src/Squot.package/SquotInstanceVariable.class/methodProperties.json @@ -3,6 +3,8 @@ "named:" : "jr 12/15/2020 23:21" }, "instance" : { "=" : "jr 12/15/2020 23:30", + "asSlotDiffKey" : "jr 7/18/2021 20:18", + "asSlotWithValue:" : "jr 7/18/2021 20:31", "hash" : "jr 12/15/2020 23:30", "isInstanceVariable" : "jr 4/17/2021 17:54", "name" : "jr 12/15/2020 23:29", diff --git a/src/Squot.package/SquotMirror.class/instance/canHaveReferences..st b/src/Squot.package/SquotMirror.class/instance/canHaveReferences..st new file mode 100644 index 000000000..cc89db40e --- /dev/null +++ b/src/Squot.package/SquotMirror.class/instance/canHaveReferences..st @@ -0,0 +1,4 @@ +testing +canHaveReferences: anObject + "Answer whether the kind of anObject is capable of having references to other objects." + ^ self subclassResponsibility \ No newline at end of file diff --git a/src/Squot.package/SquotMirror.class/instance/is.comparableTo..st b/src/Squot.package/SquotMirror.class/instance/is.comparableTo..st new file mode 100644 index 000000000..fbeb95ff9 --- /dev/null +++ b/src/Squot.package/SquotMirror.class/instance/is.comparableTo..st @@ -0,0 +1,4 @@ +comparing +is: anObject comparableTo: anotherObject + "Answer true if anObject and anotherObject are of the same kind." + ^ self subclassResponsibility \ No newline at end of file diff --git a/src/Squot.package/SquotMirror.class/methodProperties.json b/src/Squot.package/SquotMirror.class/methodProperties.json index f045371cf..daafbb559 100644 --- a/src/Squot.package/SquotMirror.class/methodProperties.json +++ b/src/Squot.package/SquotMirror.class/methodProperties.json @@ -2,7 +2,9 @@ "class" : { }, "instance" : { + "canHaveReferences:" : "jr 7/18/2021 22:11", "capture:with:ifReplaced:" : "jr 7/17/2021 23:52", + "is:comparableTo:" : "jr 7/18/2021 20:09", "mirrorForReplacement:" : "jr 4/8/2021 20:30", "mirrorOf:reachedVia:from:" : "jr 4/11/2021 20:56", "referencesFrom:" : "jr 12/16/2020 00:17", diff --git a/src/Squot.package/SquotObjectDiff.class/instance/addReferenceDiff..st b/src/Squot.package/SquotObjectDiff.class/instance/addReferenceDiff..st new file mode 100644 index 000000000..6171bac72 --- /dev/null +++ b/src/Squot.package/SquotObjectDiff.class/instance/addReferenceDiff..st @@ -0,0 +1,3 @@ +Squot-diff-comparing +addReferenceDiff: aSquotReferenceDiff + slotChanges add: aSquotReferenceDiff asSlotDiff. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiff.class/instance/addTransitiveChangeIn..st b/src/Squot.package/SquotObjectDiff.class/instance/addTransitiveChangeIn..st index ce1da84b3..f978d317b 100644 --- a/src/Squot.package/SquotObjectDiff.class/instance/addTransitiveChangeIn..st +++ b/src/Squot.package/SquotObjectDiff.class/instance/addTransitiveChangeIn..st @@ -1,5 +1,8 @@ initialize-release addTransitiveChangeIn: aSlot | change | - change := (SquotSlotTransitiveChange key: aSlot key). + change := SquotSlotTransitiveChange key: + ((aSlot isKindOf: SquotReference) + ifTrue: [aSlot asSlotDiffKey] + ifFalse: [aSlot key]). slotChanges at: change key ifAbsent: [slotChanges add: change]. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st b/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st index 80831c83e..dd8947bb6 100644 --- a/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st +++ b/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st @@ -3,7 +3,7 @@ diff: leftObjectShadow against: rightShadow with: aDiffBuilder originalClass := leftObjectShadow originalClass. newClass := rightShadow originalClass. slotChanges := Dictionary new. - leftObjectShadow slots associationsDo: [:eachSlot | + "leftObjectShadow slots associationsDo: [:eachSlot | self diffSlot: eachSlot withCorrespondingSlotIn: rightShadow slots with: aDiffBuilder]. (rightShadow slots keys copyWithoutAll: leftObjectShadow slots keys) do: [:eachKey | - self addSlotOnlyRight: (rightShadow slots associationAt: eachKey) with: aDiffBuilder]. \ No newline at end of file + self addSlotOnlyRight: (rightShadow slots associationAt: eachKey) with: aDiffBuilder]." \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiff.class/instance/diffSlot.withCorrespondingSlotIn.with..st b/src/Squot.package/SquotObjectDiff.class/instance/diffSlot.withCorrespondingSlotIn.with..st index d3a63b950..bb987a48a 100644 --- a/src/Squot.package/SquotObjectDiff.class/instance/diffSlot.withCorrespondingSlotIn.with..st +++ b/src/Squot.package/SquotObjectDiff.class/instance/diffSlot.withCorrespondingSlotIn.with..st @@ -1,6 +1,7 @@ initialize-release diffSlot: leftSlot withCorrespondingSlotIn: rightSlots with: aDiffBuilder | rightSlot slotDiff | + self flag: #deprecated. rightSlot := rightSlots associationAt: leftSlot key ifAbsent: [^ slotChanges add: (SquotSlotRemoval key: leftSlot key removedSlot: leftSlot)]. diff --git a/src/Squot.package/SquotObjectDiff.class/methodProperties.json b/src/Squot.package/SquotObjectDiff.class/methodProperties.json index 8de2d5149..d8e45c171 100644 --- a/src/Squot.package/SquotObjectDiff.class/methodProperties.json +++ b/src/Squot.package/SquotObjectDiff.class/methodProperties.json @@ -2,15 +2,16 @@ "class" : { "left:right:" : "jr 10/2/2017 20:01" }, "instance" : { + "addReferenceDiff:" : "jr 7/18/2021 20:16", "addSlotOnlyRight:" : "jr 9/16/2019 21:24", "addSlotOnlyRight:with:" : "jr 6/22/2017 12:01", - "addTransitiveChangeIn:" : "jr 7/27/2017 00:17", + "addTransitiveChangeIn:" : "jr 7/18/2021 21:05", "applyTo:" : "jr 9/23/2019 23:18", "applyTo:with:" : "jr 7/29/2017 21:29", "diff:against:" : "jr 6/17/2021 00:57", - "diff:against:with:" : "jr 4/29/2018 20:44", + "diff:against:with:" : "jr 7/18/2021 20:34", "diffSlot:withCorrespondingSlotIn:" : "jr 9/16/2019 21:21", - "diffSlot:withCorrespondingSlotIn:with:" : "jr 7/17/2017 00:02", + "diffSlot:withCorrespondingSlotIn:with:" : "jr 7/18/2021 20:00", "initialize" : "jr 6/17/2021 00:57", "initializeSquotDiffNodes:with:" : "jr 11/18/2017 22:41", "newSquotDiffNodes" : "jr 11/18/2017 22:29", diff --git a/src/Squot.package/SquotObjectDiffTest.class/instance/assertDiffAgainstItselfHasNoChanges..st b/src/Squot.package/SquotObjectDiffTest.class/instance/assertDiffAgainstItselfHasNoChanges..st index 25532b1b9..03bc3ce4c 100644 --- a/src/Squot.package/SquotObjectDiffTest.class/instance/assertDiffAgainstItselfHasNoChanges..st +++ b/src/Squot.package/SquotObjectDiffTest.class/instance/assertDiffAgainstItselfHasNoChanges..st @@ -1,8 +1,8 @@ helpers assertDiffAgainstItselfHasNoChanges: anObject - | leftShadow rightShadow diff | - leftShadow := capturer captureStandalone: anObject. - rightShadow := capturer captureStandalone: anObject. - diff := leftShadow squotDiffAgainst: rightShadow. + | left right diff | + left := capturer captureGraph: anObject. + right := capturer captureGraph: anObject. + diff := left squotDiffAgainst: right. self deny: diff squotHasChanges. ^ diff \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiffTest.class/methodProperties.json b/src/Squot.package/SquotObjectDiffTest.class/methodProperties.json index 2b1e60361..eece11158 100644 --- a/src/Squot.package/SquotObjectDiffTest.class/methodProperties.json +++ b/src/Squot.package/SquotObjectDiffTest.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "assertDiffAgainstItselfHasNoChanges:" : "jr 9/13/2019 11:38", + "assertDiffAgainstItselfHasNoChanges:" : "jr 7/18/2021 21:04", "diff:against:" : "jr 9/13/2019 11:39", "diff:againstItselfAfter:" : "jr 9/13/2019 11:39", "expectedFailures" : "jr 6/6/2020 18:17", diff --git a/src/Squot.package/SquotObjectGraphDiffKickoff.class/instance/referenceDiffsWithDefaultOwners.reflectedIn.do..st b/src/Squot.package/SquotObjectGraphDiffKickoff.class/instance/referenceDiffsWithDefaultOwners.reflectedIn.do..st index da79b76da..ea05e5156 100644 --- a/src/Squot.package/SquotObjectGraphDiffKickoff.class/instance/referenceDiffsWithDefaultOwners.reflectedIn.do..st +++ b/src/Squot.package/SquotObjectGraphDiffKickoff.class/instance/referenceDiffsWithDefaultOwners.reflectedIn.do..st @@ -5,10 +5,7 @@ referenceDiffsWithDefaultOwners: leftAndRightShadows reflectedIn: aMirror do: aB [:each :name | | left right rightName reference isForStart | each isAddition ifFalse: [rightName := each rightName ifNil: [name]. - reference := SquotObjectGraphReference new - objectDiff: each; - objectName: rightName; - yourself. + reference := SquotObjectGraphReference diff: each objectName: rightName. left := graphDiff left shadowNamed: name ifAbsent: []. right := graphDiff right shadowNamed: rightName ifAbsent: []. isForStart := each == graphDiff startDiff. diff --git a/src/Squot.package/SquotObjectGraphDiffKickoff.class/methodProperties.json b/src/Squot.package/SquotObjectGraphDiffKickoff.class/methodProperties.json index 548fa3ae9..87da1e18c 100644 --- a/src/Squot.package/SquotObjectGraphDiffKickoff.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphDiffKickoff.class/methodProperties.json @@ -2,5 +2,5 @@ "class" : { "for:" : "jr 6/18/2021 00:23" }, "instance" : { - "referenceDiffsWithDefaultOwners:reflectedIn:do:" : "jr 7/4/2021 20:10", + "referenceDiffsWithDefaultOwners:reflectedIn:do:" : "jr 7/18/2021 16:24", "setGraphDiff:" : "jr 6/18/2021 00:23" } } diff --git a/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testMoveObjectCloserToStart.st b/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testMoveObjectCloserToStart.st new file mode 100644 index 000000000..8a01639cc --- /dev/null +++ b/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testMoveObjectCloserToStart.st @@ -0,0 +1,11 @@ +tests +testMoveObjectCloserToStart + "If an object is moved closer to the start object, the comparison walk will encounter it sooner. This must not cause trouble with the mirror lookups." + | diff o1 o2 o3 | + o1 := {o2 := {o3 := {42}}}. + diff := self diff: o1 againstItselfAfter: [o1 at: 1 put: o3]. + self assert: (diff diffForObjectNamed: (objectRegistry nameOf: o1) ifAbsent: []) notNil; + assert: (diff diffForObjectNamed: (objectRegistry nameOf: o3) ifAbsent: []) isNil. + "Now try with new references instead of changing an existing reference." + o1 := Set newFrom: {o2}. + diff := self diff: o1 againstItselfAfter: [o1 add: o3; remove: o2]. "Should not raise an error. Did not wrap in shouldnt:raise: because without it is easier to debug." \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testRectangles.st b/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testRectangles.st index d37fb2c80..d492b09a3 100644 --- a/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testRectangles.st +++ b/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testRectangles.st @@ -1,12 +1,12 @@ tests testRectangles "Points should be reassigned, not patched." - | diff rect origin corner | + | diff rect origin corner pointDiff | origin := 1@2. corner := 3@4. rect := (origin corner: corner). diff := self diff: rect against: (5@6 corner: 7@8). self assert: diff squotHasChanges; assert: (diff diffForObjectNamed: (objectRegistry nameOf: rect) ifAbsent: []) notNil; - deny: (diff diffForObjectNamed: (objectRegistry nameOf: rect origin ifAbsent: []) ifAbsent: []) isModification; - deny: (diff diffForObjectNamed: (objectRegistry nameOf: rect corner ifAbsent: []) ifAbsent: []) isModification. \ No newline at end of file + deny: ((pointDiff := diff diffForObjectNamed: (objectRegistry nameOf: rect origin ifAbsent: []) ifAbsent: []) notNil and: [pointDiff isModification]); + deny: ((pointDiff := diff diffForObjectNamed: (objectRegistry nameOf: rect corner ifAbsent: []) ifAbsent: []) notNil and: [pointDiff isModification]). \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json b/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json index cf23ff3ac..86fb017a8 100644 --- a/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json @@ -18,8 +18,9 @@ "testDictionariesWithSharedAssociations" : "jr 7/30/2017 00:12", "testDictionary" : "jr 9/13/2019 11:50", "testIdentityReplacedObject" : "jr 7/30/2017 13:16", + "testMoveObjectCloserToStart" : "jr 7/25/2021 14:14", "testObjects" : "jr 9/13/2019 11:19", - "testRectangles" : "jr 9/21/2019 21:51", + "testRectangles" : "jr 7/19/2021 00:38", "testReferenceSwap" : "jr 9/13/2019 11:44", "testReplacedObject2" : "jr 7/20/2017 16:59", "testSet" : "jr 9/13/2019 11:37" } } diff --git a/src/Squot.package/SquotObjectGraphReference.class/class/diff.objectName..st b/src/Squot.package/SquotObjectGraphReference.class/class/diff.objectName..st new file mode 100644 index 000000000..2c330b1ba --- /dev/null +++ b/src/Squot.package/SquotObjectGraphReference.class/class/diff.objectName..st @@ -0,0 +1,5 @@ +instance creation +diff: aDiff objectName: name + ^ self new + setDiff: aDiff objectName: name; + yourself \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphReference.class/instance/setDiff.objectName..st b/src/Squot.package/SquotObjectGraphReference.class/instance/setDiff.objectName..st new file mode 100644 index 000000000..2eeac2c2f --- /dev/null +++ b/src/Squot.package/SquotObjectGraphReference.class/instance/setDiff.objectName..st @@ -0,0 +1,4 @@ +initialize-release +setDiff: aDiff objectName: name + objectDiff := aDiff. + objectName := name. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphReference.class/methodProperties.json b/src/Squot.package/SquotObjectGraphReference.class/methodProperties.json index b396dddbd..3d9bf2ef2 100644 --- a/src/Squot.package/SquotObjectGraphReference.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphReference.class/methodProperties.json @@ -1,6 +1,6 @@ { "class" : { - }, + "diff:objectName:" : "jr 7/18/2021 16:24" }, "instance" : { "newNameFragment" : "jr 6/20/2021 17:16", "objectDiff" : "jr 6/20/2021 17:16", @@ -8,4 +8,5 @@ "objectName" : "jr 6/20/2021 18:35", "objectName:" : "jr 6/20/2021 18:35", "reflect:in:" : "jr 6/20/2021 18:38", - "reflect:in:put:" : "jr 6/20/2021 19:03" } } + "reflect:in:put:" : "jr 6/20/2021 19:03", + "setDiff:objectName:" : "jr 7/18/2021 16:24" } } diff --git a/src/Squot.package/SquotObjectMirror.class/instance/canHaveReferences..st b/src/Squot.package/SquotObjectMirror.class/instance/canHaveReferences..st new file mode 100644 index 000000000..6f1d20615 --- /dev/null +++ b/src/Squot.package/SquotObjectMirror.class/instance/canHaveReferences..st @@ -0,0 +1,9 @@ +testing +canHaveReferences: anObject + class isImmediateClass ifTrue: [^ false]. + class = UndefinedObject ifTrue: [^ false]. + class isVariable ifTrue: [^ true]. + (class inheritsFrom: Boolean) ifTrue: [^ false]. + class squotMirror = SquotSystemSingletonMirror ifTrue: [^ false]. + anObject isCollection ifTrue: [^ true]. + ^ true \ No newline at end of file diff --git a/src/Squot.package/SquotObjectMirror.class/instance/is.comparableTo..st b/src/Squot.package/SquotObjectMirror.class/instance/is.comparableTo..st new file mode 100644 index 000000000..32d870ce4 --- /dev/null +++ b/src/Squot.package/SquotObjectMirror.class/instance/is.comparableTo..st @@ -0,0 +1,3 @@ +comparing +is: anObject comparableTo: anotherObject + ^ anObject isMemberOf: anotherObject class \ No newline at end of file diff --git a/src/Squot.package/SquotObjectMirror.class/methodProperties.json b/src/Squot.package/SquotObjectMirror.class/methodProperties.json index 2dc33f197..2df30192d 100644 --- a/src/Squot.package/SquotObjectMirror.class/methodProperties.json +++ b/src/Squot.package/SquotObjectMirror.class/methodProperties.json @@ -3,9 +3,11 @@ "class:" : "jr 12/15/2020 23:32" }, "instance" : { "=" : "jr 12/15/2020 23:33", + "canHaveReferences:" : "jr 7/18/2021 22:28", "capture:with:ifReplaced:" : "jr 7/17/2021 23:51", "hash" : "jr 12/15/2020 23:33", "initializeSnapshot:of:with:" : "jr 4/8/2021 21:23", + "is:comparableTo:" : "jr 7/18/2021 20:13", "newShadowObject" : "jr 4/3/2021 20:59", "printOn:" : "jr 4/8/2021 19:34", "referencesFrom:" : "jr 4/8/2021 00:13", diff --git a/src/Squot.package/SquotObjectReflection.class/instance/canHaveReferences.st b/src/Squot.package/SquotObjectReflection.class/instance/canHaveReferences.st new file mode 100644 index 000000000..0347a78f4 --- /dev/null +++ b/src/Squot.package/SquotObjectReflection.class/instance/canHaveReferences.st @@ -0,0 +1,3 @@ +testing +canHaveReferences + ^ mirror canHaveReferences: object \ No newline at end of file diff --git a/src/Squot.package/SquotObjectReflection.class/instance/isComparableTo..st b/src/Squot.package/SquotObjectReflection.class/instance/isComparableTo..st index dc4b69d81..156378141 100644 --- a/src/Squot.package/SquotObjectReflection.class/instance/isComparableTo..st +++ b/src/Squot.package/SquotObjectReflection.class/instance/isComparableTo..st @@ -1,3 +1,4 @@ comparing isComparableTo: aReflectedObject - ^ mirror = aReflectedObject mirror \ No newline at end of file + ^ mirror = aReflectedObject mirror + and: [mirror is: object comparableTo: aReflectedObject object] \ No newline at end of file diff --git a/src/Squot.package/SquotObjectReflection.class/instance/nextMirror..st b/src/Squot.package/SquotObjectReflection.class/instance/nextMirror..st index 21f5c45a7..ae37136be 100644 --- a/src/Squot.package/SquotObjectReflection.class/instance/nextMirror..st +++ b/src/Squot.package/SquotObjectReflection.class/instance/nextMirror..st @@ -1,3 +1,3 @@ reflection nextMirror: aReference - ^ mirror mirrorOf: (aReference reflect: object in: mirror) reachedVia: aReference from: object \ No newline at end of file + ^ mirror mirrorOf: (aReference reflect: object in: mirror) undecorated reachedVia: aReference from: object \ No newline at end of file diff --git a/src/Squot.package/SquotObjectReflection.class/methodProperties.json b/src/Squot.package/SquotObjectReflection.class/methodProperties.json index 22a75ebc6..e72da9443 100644 --- a/src/Squot.package/SquotObjectReflection.class/methodProperties.json +++ b/src/Squot.package/SquotObjectReflection.class/methodProperties.json @@ -2,9 +2,10 @@ "class" : { "object:mirror:" : "jr 12/21/2020 23:31" }, "instance" : { - "isComparableTo:" : "jr 12/21/2020 00:36", + "canHaveReferences" : "jr 7/18/2021 22:10", + "isComparableTo:" : "jr 7/18/2021 20:08", "mirror" : "jr 12/21/2020 00:37", - "nextMirror:" : "jr 4/11/2021 20:50", + "nextMirror:" : "jr 7/18/2021 20:11", "object" : "jr 12/21/2020 00:37", "printOn:" : "jr 12/21/2020 00:50", "references" : "jr 12/21/2020 00:32", diff --git a/src/Squot.package/SquotObjectReplacement.class/instance/addReferenceDiff..st b/src/Squot.package/SquotObjectReplacement.class/instance/addReferenceDiff..st new file mode 100644 index 000000000..32e6205f9 --- /dev/null +++ b/src/Squot.package/SquotObjectReplacement.class/instance/addReferenceDiff..st @@ -0,0 +1,3 @@ +Squot-diff-comparing +addReferenceDiff: aSquotReferenceDiff + "Ignore this since right shall completely replace left from the referrer." \ No newline at end of file diff --git a/src/Squot.package/SquotObjectReplacement.class/methodProperties.json b/src/Squot.package/SquotObjectReplacement.class/methodProperties.json index 4050b31da..5a19b33b0 100644 --- a/src/Squot.package/SquotObjectReplacement.class/methodProperties.json +++ b/src/Squot.package/SquotObjectReplacement.class/methodProperties.json @@ -2,6 +2,7 @@ "class" : { "left:right:" : "jr 6/1/2017 12:48" }, "instance" : { + "addReferenceDiff:" : "jr 7/25/2021 14:19", "applyToShadowNamed:inGraph:" : "jr 7/4/2021 18:00", "asSquotConflicts" : "jr 12/20/2020 23:32", "incoming" : "jr 8/4/2019 00:14", diff --git a/src/Squot.package/SquotObjectShadowMirror.class/instance/^equals.st b/src/Squot.package/SquotObjectShadowMirror.class/instance/^equals.st index 1ef12b885..c893b6e41 100644 --- a/src/Squot.package/SquotObjectShadowMirror.class/instance/^equals.st +++ b/src/Squot.package/SquotObjectShadowMirror.class/instance/^equals.st @@ -6,4 +6,4 @@ comparing ifTrue: [^ true]. self class = anObject class ifFalse: [^ false]. - ^ self theClass = anObject theClass. \ No newline at end of file + ^ true \ No newline at end of file diff --git a/src/Squot.package/SquotObjectShadowMirror.class/instance/canHaveReferences..st b/src/Squot.package/SquotObjectShadowMirror.class/instance/canHaveReferences..st new file mode 100644 index 000000000..e5da5b0ed --- /dev/null +++ b/src/Squot.package/SquotObjectShadowMirror.class/instance/canHaveReferences..st @@ -0,0 +1,8 @@ +testing +canHaveReferences: aSquotObjectShadow + | class | + class := aSquotObjectShadow originalClass. + class isImmediateClass ifTrue: [^ false]. + class isVariable ifTrue: [^ true]. + (class squotMirror isKindOf: SquotSystemSingletonMirror) ifTrue: [^ false]. + ^ true \ No newline at end of file diff --git a/src/Squot.package/SquotObjectShadowMirror.class/instance/is.comparableTo..st b/src/Squot.package/SquotObjectShadowMirror.class/instance/is.comparableTo..st new file mode 100644 index 000000000..5f2b0b21b --- /dev/null +++ b/src/Squot.package/SquotObjectShadowMirror.class/instance/is.comparableTo..st @@ -0,0 +1,3 @@ +comparing +is: aSquotObjectShadow comparableTo: aSquotObjectShadow2 + ^ aSquotObjectShadow capturedClass = aSquotObjectShadow2 capturedClass \ No newline at end of file diff --git a/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json b/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json index 8c9925870..56b11d4dd 100644 --- a/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json +++ b/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json @@ -2,10 +2,12 @@ "class" : { "class:" : "jr 12/15/2020 23:32" }, "instance" : { - "=" : "jr 12/15/2020 23:33", + "=" : "jr 7/18/2021 20:08", + "canHaveReferences:" : "jr 7/18/2021 22:23", "capture:with:ifReplaced:" : "jr 7/17/2021 23:58", "captureReferences:from:reflectedIn:into:with:" : "jr 4/8/2021 21:23", "hash" : "jr 12/15/2020 23:33", + "is:comparableTo:" : "jr 7/18/2021 20:10", "newShadowObject" : "jr 4/3/2021 21:00", "referencesFrom:" : "jr 4/10/2021 12:23", "reflectIndexableField:in:" : "jr 4/10/2021 16:15", diff --git a/src/Squot.package/SquotOpaqueValueMirror.class/instance/canHaveReferences..st b/src/Squot.package/SquotOpaqueValueMirror.class/instance/canHaveReferences..st new file mode 100644 index 000000000..190003341 --- /dev/null +++ b/src/Squot.package/SquotOpaqueValueMirror.class/instance/canHaveReferences..st @@ -0,0 +1,3 @@ +testing +canHaveReferences: anObject + ^ false \ No newline at end of file diff --git a/src/Squot.package/SquotOpaqueValueMirror.class/instance/is.comparableTo..st b/src/Squot.package/SquotOpaqueValueMirror.class/instance/is.comparableTo..st new file mode 100644 index 000000000..edd00331a --- /dev/null +++ b/src/Squot.package/SquotOpaqueValueMirror.class/instance/is.comparableTo..st @@ -0,0 +1,3 @@ +comparing +is: anObject comparableTo: anotherObject + ^ true \ No newline at end of file diff --git a/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json b/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json index 7190e1dc3..c58b0812c 100644 --- a/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json +++ b/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json @@ -3,7 +3,9 @@ }, "instance" : { "=" : "jr 4/8/2021 20:17", + "canHaveReferences:" : "jr 7/18/2021 22:35", "capture:with:ifReplaced:" : "jr 7/17/2021 23:58", "hash" : "jr 4/8/2021 20:16", + "is:comparableTo:" : "jr 7/18/2021 20:14", "referencesFrom:" : "jr 4/8/2021 20:14", "shouldObjectHaveNameAssigned:" : "jr 4/8/2021 20:15" } } diff --git a/src/Squot.package/SquotReferenceAddition.class/instance/asSlotDiff.st b/src/Squot.package/SquotReferenceAddition.class/instance/asSlotDiff.st new file mode 100644 index 000000000..3dc5ac425 --- /dev/null +++ b/src/Squot.package/SquotReferenceAddition.class/instance/asSlotDiff.st @@ -0,0 +1,3 @@ +converting +asSlotDiff + ^ SquotSlotAddition key: reference asSlotDiffKey newSlot: (reference asSlotWithValue: target) \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceAddition.class/methodProperties.json b/src/Squot.package/SquotReferenceAddition.class/methodProperties.json index 5e18a54ca..38e4dc092 100644 --- a/src/Squot.package/SquotReferenceAddition.class/methodProperties.json +++ b/src/Squot.package/SquotReferenceAddition.class/methodProperties.json @@ -2,6 +2,7 @@ "class" : { "to:reference:target:rightOwner:" : "jr 12/24/2020 01:30" }, "instance" : { + "asSlotDiff" : "jr 7/18/2021 20:21", "printOn:" : "jr 6/16/2021 21:20", "setReference:leftOwner:rightOwner:target:" : "jr 12/24/2020 01:29", "squotReflectOn:in:" : "jr 12/24/2020 01:37", diff --git a/src/Squot.package/SquotReferenceDiff.class/instance/asSlotDiff.st b/src/Squot.package/SquotReferenceDiff.class/instance/asSlotDiff.st new file mode 100644 index 000000000..d52c7d358 --- /dev/null +++ b/src/Squot.package/SquotReferenceDiff.class/instance/asSlotDiff.st @@ -0,0 +1,4 @@ +converting +asSlotDiff + "Convert to SquotSlotDiff for compatbility with SquotObjectDiff" + ^ self subclassResponsibility \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceDiff.class/methodProperties.json b/src/Squot.package/SquotReferenceDiff.class/methodProperties.json index 12cb789cb..bf162d870 100644 --- a/src/Squot.package/SquotReferenceDiff.class/methodProperties.json +++ b/src/Squot.package/SquotReferenceDiff.class/methodProperties.json @@ -2,6 +2,7 @@ "class" : { }, "instance" : { + "asSlotDiff" : "jr 7/18/2021 20:17", "isAddition" : "jr 6/12/2021 19:01", "isModification" : "jr 6/12/2021 19:01", "isRemoval" : "jr 6/12/2021 19:01", diff --git a/src/Squot.package/SquotReferenceRemoval.class/class/from.reference.rightObject..st b/src/Squot.package/SquotReferenceRemoval.class/class/from.reference.rightObject..st deleted file mode 100644 index 3fc013e68..000000000 --- a/src/Squot.package/SquotReferenceRemoval.class/class/from.reference.rightObject..st +++ /dev/null @@ -1,6 +0,0 @@ -instance creation -from: leftObject reference: aReference rightObject: rightObject - ^ self new - setReference: aReference leftOwner: leftObject rightObject: rightObject; - yourself - "rightObject is not called rightOwner because the object does not own/contain the target object anymore." \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceRemoval.class/class/of.from.reference.rightObject..st b/src/Squot.package/SquotReferenceRemoval.class/class/of.from.reference.rightObject..st new file mode 100644 index 000000000..82725c522 --- /dev/null +++ b/src/Squot.package/SquotReferenceRemoval.class/class/of.from.reference.rightObject..st @@ -0,0 +1,6 @@ +instance creation +of: anObject from: leftObject reference: aReference rightObject: rightObject + ^ self new + setOldTarget: anObject reference: aReference leftOwner: leftObject rightObject: rightObject; + yourself + "rightObject is not called rightOwner because the object does not own/contain the target object anymore." \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceRemoval.class/instance/asSlotDiff.st b/src/Squot.package/SquotReferenceRemoval.class/instance/asSlotDiff.st new file mode 100644 index 000000000..4908c8433 --- /dev/null +++ b/src/Squot.package/SquotReferenceRemoval.class/instance/asSlotDiff.st @@ -0,0 +1,3 @@ +converting +asSlotDiff + ^ SquotSlotRemoval key: reference asSlotDiffKey removedSlot: (reference asSlotWithValue: oldTarget) \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceRemoval.class/instance/setOldTarget.reference.leftOwner.rightObject..st b/src/Squot.package/SquotReferenceRemoval.class/instance/setOldTarget.reference.leftOwner.rightObject..st new file mode 100644 index 000000000..a830084b4 --- /dev/null +++ b/src/Squot.package/SquotReferenceRemoval.class/instance/setOldTarget.reference.leftOwner.rightObject..st @@ -0,0 +1,5 @@ +initialize-release +setOldTarget: anObject reference: aReference leftOwner: leftObject rightObject: rightObject + super setReference: aReference leftOwner: leftObject rightOwner: rightObject. + "rightObject is not called rightOwner because the object does not own/contain the target object anymore." + oldTarget := anObject. \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceRemoval.class/methodProperties.json b/src/Squot.package/SquotReferenceRemoval.class/methodProperties.json index a2ec2568e..8c4da4d96 100644 --- a/src/Squot.package/SquotReferenceRemoval.class/methodProperties.json +++ b/src/Squot.package/SquotReferenceRemoval.class/methodProperties.json @@ -1,8 +1,10 @@ { "class" : { - "from:reference:rightObject:" : "jr 6/20/2021 21:56" }, + "of:from:reference:rightObject:" : "jr 7/18/2021 20:25" }, "instance" : { + "asSlotDiff" : "jr 7/18/2021 20:26", "printOn:" : "jr 6/16/2021 21:19", + "setOldTarget:reference:leftOwner:rightObject:" : "jr 7/18/2021 20:25", "setReference:leftOwner:rightObject:" : "jr 6/20/2021 21:56", "squotReflectOn:in:" : "jr 12/24/2020 01:33", "squotReflectOn:in:withValue:" : "jr 6/20/2021 21:36", diff --git a/src/Squot.package/SquotReferenceRemoval.class/properties.json b/src/Squot.package/SquotReferenceRemoval.class/properties.json index 008a52fca..8607914ca 100644 --- a/src/Squot.package/SquotReferenceRemoval.class/properties.json +++ b/src/Squot.package/SquotReferenceRemoval.class/properties.json @@ -7,7 +7,7 @@ ], "commentStamp" : "jr 12/24/2020 00:59", "instvars" : [ - ], + "oldTarget" ], "name" : "SquotReferenceRemoval", "pools" : [ ], diff --git a/src/Squot.package/SquotReferenceTargetExchange.class/instance/asSlotDiff.st b/src/Squot.package/SquotReferenceTargetExchange.class/instance/asSlotDiff.st new file mode 100644 index 000000000..a376f601a --- /dev/null +++ b/src/Squot.package/SquotReferenceTargetExchange.class/instance/asSlotDiff.st @@ -0,0 +1,3 @@ +converting +asSlotDiff + ^ SquotSlotReassignment key: reference asSlotDiffKey leftShadow: leftTarget rightShadow: rightTarget \ No newline at end of file diff --git a/src/Squot.package/SquotReferenceTargetExchange.class/methodProperties.json b/src/Squot.package/SquotReferenceTargetExchange.class/methodProperties.json index 31c5ff2a5..3024826e8 100644 --- a/src/Squot.package/SquotReferenceTargetExchange.class/methodProperties.json +++ b/src/Squot.package/SquotReferenceTargetExchange.class/methodProperties.json @@ -2,6 +2,7 @@ "class" : { }, "instance" : { + "asSlotDiff" : "jr 7/18/2021 20:18", "printOn:" : "jr 6/16/2021 21:20", "squotReflectOn:in:" : "jr 12/24/2020 01:27", "squotReflectOn:in:withValue:" : "jr 6/20/2021 19:17" } } diff --git a/src/Squot.package/SquotSlotRemoval.class/instance/asReferenceDiffWithDefaultOwners.reflectedIn..st b/src/Squot.package/SquotSlotRemoval.class/instance/asReferenceDiffWithDefaultOwners.reflectedIn..st index 797aae7a8..fa4b79c4e 100644 --- a/src/Squot.package/SquotSlotRemoval.class/instance/asReferenceDiffWithDefaultOwners.reflectedIn..st +++ b/src/Squot.package/SquotSlotRemoval.class/instance/asReferenceDiffWithDefaultOwners.reflectedIn..st @@ -1,6 +1,7 @@ converting asReferenceDiffWithDefaultOwners: leftAndRightShadows reflectedIn: aMirror ^ SquotReferenceRemoval + of: self slotToBeRemoved value from: leftAndRightShadows first reference: self slotToBeRemoved asReference rightObject: leftAndRightShadows second \ No newline at end of file diff --git a/src/Squot.package/SquotSlotRemoval.class/methodProperties.json b/src/Squot.package/SquotSlotRemoval.class/methodProperties.json index e45528cf7..28d4ac162 100644 --- a/src/Squot.package/SquotSlotRemoval.class/methodProperties.json +++ b/src/Squot.package/SquotSlotRemoval.class/methodProperties.json @@ -4,7 +4,7 @@ "instance" : { "applyTo:" : "jr 9/23/2019 23:19", "applyTo:with:" : "jr 7/29/2017 21:29", - "asReferenceDiffWithDefaultOwners:reflectedIn:" : "jr 6/13/2021 21:01", + "asReferenceDiffWithDefaultOwners:reflectedIn:" : "jr 7/18/2021 20:24", "hierarchicalDiffTitle" : "jr 6/25/2017 21:51", "printDescriptionOn:" : "jr 6/18/2017 11:51", "slotShadowType" : "jr 6/25/2017 22:09", diff --git a/src/Squot.package/SquotStringMirror.class/instance/canHaveReferences..st b/src/Squot.package/SquotStringMirror.class/instance/canHaveReferences..st new file mode 100644 index 000000000..010622b78 --- /dev/null +++ b/src/Squot.package/SquotStringMirror.class/instance/canHaveReferences..st @@ -0,0 +1,3 @@ +testing +canHaveReferences: aString + ^ false \ No newline at end of file diff --git a/src/Squot.package/SquotStringMirror.class/instance/is.comparableTo..st b/src/Squot.package/SquotStringMirror.class/instance/is.comparableTo..st new file mode 100644 index 000000000..d734c7e09 --- /dev/null +++ b/src/Squot.package/SquotStringMirror.class/instance/is.comparableTo..st @@ -0,0 +1,3 @@ +comparing +is: aString comparableTo: aString2 + ^ aString2 isString \ No newline at end of file diff --git a/src/Squot.package/SquotStringMirror.class/methodProperties.json b/src/Squot.package/SquotStringMirror.class/methodProperties.json index b3695bed4..be37c3761 100644 --- a/src/Squot.package/SquotStringMirror.class/methodProperties.json +++ b/src/Squot.package/SquotStringMirror.class/methodProperties.json @@ -3,9 +3,11 @@ "class:" : "jr 12/15/2020 23:32" }, "instance" : { "=" : "jr 12/15/2020 23:33", + "canHaveReferences:" : "jr 7/18/2021 22:40", "capture:with:ifReplaced:" : "jr 7/18/2021 00:05", "hash" : "jr 12/15/2020 23:33", "initializeSnapshot:of:with:" : "jr 7/18/2021 00:00", + "is:comparableTo:" : "jr 7/18/2021 20:15", "newShadowObject" : "jr 4/7/2021 20:42", "referencesFrom:" : "jr 12/16/2020 01:51", "reflectIndexableField:in:" : "jr 12/16/2020 00:04", diff --git a/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st b/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st index d554f04f2..912ed96c5 100644 --- a/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st +++ b/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st @@ -3,11 +3,19 @@ squotDiffAgainst: aTrackedObjectMetadata | walk diffs | diffs := Dictionary new. walk := SquotGraphComparisonWalk startingFrom: self and: aTrackedObjectMetadata. + walk checkPathsTo: self ifMultiple: []; + checkPathsTo: aTrackedObjectMetadata ifMultiple: ["Same object." ^ SquotDiffOfEqualObjects instance]. walk do: - [:left :right :leftReferrer :rightReferrer | - walk followReferencesOf: left and: right - ifDifferentShape: [:path | diffs at: path put: (SquotReferenceTargetExchange reference: path last leftOwner: leftReferrer target: left rightOwner: rightReferrer target: right)] - ifOnlyLeft: [:removed :path | diffs at: path put: (SquotReferenceRemoval from: left reference: path last rightObject: right)] - ifOnlyRight: [:added :path | diffs at: path put: (SquotReferenceAddition to: left reference: path last target: added rightOwner: right)] - ifAlreadyVisited: [self error: 'Multiple paths']]. + [:left :right :leftReferrer :rightReferrer :path | + walk followReferencesOf: left and: right + ifDifferentShape: [diffs at: path put: (SquotReferenceTargetExchange reference: path last leftOwner: leftReferrer target: left rightOwner: rightReferrer target: right)] + ifFromBoth: + [:leftValue :rightValue :commonPath | | alreadyVisited | + alreadyVisited := false. + walk checkPathsTo: leftValue ifMultiple: [alreadyVisited := true]; + checkPathsTo: rightValue ifMultiple: [alreadyVisited := true]. + alreadyVisited ifFalse: + [walk addLeft: leftValue right: rightValue reachedVia: commonPath last]] + ifOnlyLeft: [:removed :oldPath | diffs at: oldPath put: (SquotReferenceRemoval of: removed from: left reference: oldPath last rightObject: right)] + ifOnlyRight: [:added :newPath | diffs at: newPath put: (SquotReferenceAddition to: left reference: newPath last target: added rightOwner: right)]]. ^ SquotTrackedObjectMetadataDiff left: self right: aTrackedObjectMetadata diffs: diffs \ No newline at end of file diff --git a/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotMergeWith.basedOn..st b/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotMergeWith.basedOn..st index b4369067d..07a22847f 100644 --- a/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotMergeWith.basedOn..st +++ b/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotMergeWith.basedOn..st @@ -8,7 +8,7 @@ squotMergeWith: incomingTrackedObjectMetadata basedOn: baseTrackedObjectMetadata [:working :incoming :base :workingReferrer :incomingReferrer :baseReferrer | walk followReferencesIfReplaced: [:path | diffs at: path put: (SquotReferenceTargetExchange reference: path last leftOwner: workingReferrer target: working rightOwner: incomingReferrer target: incoming)] ifReplacedDifferently: [:path | conflicts at: path put: (SquotObjectReferenceConflict key: path last base: base working: working incoming: incoming)] - ifRemoved: [:removed :path | diffs at: path put: (SquotReferenceRemoval from: working reference: path last rightObject: incoming)] + ifRemoved: [:removed :path | diffs at: path put: (SquotReferenceRemoval of: removed from: working reference: path last rightObject: incoming)] ifWorkingChanged: [:changed :original :path | conflicts at: path put: (SquotObjectReferenceConflict key: path last base: original working: changed incoming: nil)] ifIncomingChanged: [:changed :original :path | conflicts at: path put: (SquotObjectReferenceConflict key: path last base: original working: nil incoming: changed)] ifAdded: [:added :path | diffs at: path put: (SquotReferenceAddition to: working reference: path last target: added rightOwner: incoming)] diff --git a/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json b/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json index dcba6cce0..f0cc5841a 100644 --- a/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json +++ b/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json @@ -32,6 +32,6 @@ "serializer:" : "jr 7/16/2017 12:28", "slotOverrideFor:in:ifFound:ifNone:" : "jr 7/16/2017 13:50", "slotOverrides" : "jr 7/16/2017 12:21", - "squotDiffAgainst:" : "jr 1/9/2021 19:34", - "squotMergeWith:basedOn:" : "jr 1/9/2021 19:47", + "squotDiffAgainst:" : "jr 7/18/2021 20:23", + "squotMergeWith:basedOn:" : "jr 7/18/2021 20:23", "updateFrom:" : "jr 12/13/2020 21:51" } } diff --git a/src/Squot.package/SquotTrackedObjectMetadataDiffTest.class/instance/testCyclesDoNotCauseInifiniteLoops.st b/src/Squot.package/SquotTrackedObjectMetadataDiffTest.class/instance/testCyclesDoNotCauseInifiniteLoops.st new file mode 100644 index 000000000..168c92aa7 --- /dev/null +++ b/src/Squot.package/SquotTrackedObjectMetadataDiffTest.class/instance/testCyclesDoNotCauseInifiniteLoops.st @@ -0,0 +1,12 @@ +tests +testCyclesDoNotCauseInifiniteLoops + "Even though every object is treated as a value object, cycles should not cause infinite loops." + | m1 m2 holder diff | + holder := ValueHolder new. + holder contents: holder. + m1 := SquotTrackedObjectMetadata newFrom: {#complex -> holder}. + m2 := SquotTrackedObjectMetadata newFrom: {#complex -> holder}. + "when" + m1 absorbDiff: (diff := m1 squotDiffAgainst: m2). + "then" + self assert: (m1 at: #complex) == holder. "Not changed" \ No newline at end of file diff --git a/src/Squot.package/SquotTrackedObjectMetadataDiffTest.class/methodProperties.json b/src/Squot.package/SquotTrackedObjectMetadataDiffTest.class/methodProperties.json index d010bd418..cdc2b9bb1 100644 --- a/src/Squot.package/SquotTrackedObjectMetadataDiffTest.class/methodProperties.json +++ b/src/Squot.package/SquotTrackedObjectMetadataDiffTest.class/methodProperties.json @@ -3,6 +3,7 @@ }, "instance" : { "testApplyIsNonDestructive" : "jr 12/23/2020 20:36", + "testCyclesDoNotCauseInifiniteLoops" : "jr 7/18/2021 17:19", "testEverythingIsAValue" : "jr 12/22/2020 00:21", "testReplacesStrings" : "jr 12/17/2020 19:44", "testUnchangedValuesRemain" : "jr 12/22/2020 00:24" } } diff --git a/src/Squot.package/SquotTrackedObjectMetadataMirror.class/instance/is.comparableTo..st b/src/Squot.package/SquotTrackedObjectMetadataMirror.class/instance/is.comparableTo..st new file mode 100644 index 000000000..c45dd3632 --- /dev/null +++ b/src/Squot.package/SquotTrackedObjectMetadataMirror.class/instance/is.comparableTo..st @@ -0,0 +1,3 @@ +comparing +is: metadata1 comparableTo: metadata2 + ^ true \ No newline at end of file diff --git a/src/Squot.package/SquotTrackedObjectMetadataMirror.class/methodProperties.json b/src/Squot.package/SquotTrackedObjectMetadataMirror.class/methodProperties.json index ba972c71b..b608bfb19 100644 --- a/src/Squot.package/SquotTrackedObjectMetadataMirror.class/methodProperties.json +++ b/src/Squot.package/SquotTrackedObjectMetadataMirror.class/methodProperties.json @@ -2,6 +2,7 @@ "class" : { }, "instance" : { + "is:comparableTo:" : "jr 7/18/2021 20:12", "mirrorOf:reachedVia:from:" : "jr 4/11/2021 20:46", "referencesFrom:" : "jr 4/8/2021 00:51", "reflectElement:of:put:" : "jr 4/8/2021 00:48" } } diff --git a/src/Squot.package/TSquotDiff.trait/instance/addReferenceDiff..st b/src/Squot.package/TSquotDiff.trait/instance/addReferenceDiff..st new file mode 100644 index 000000000..f87186e28 --- /dev/null +++ b/src/Squot.package/TSquotDiff.trait/instance/addReferenceDiff..st @@ -0,0 +1,3 @@ +Squot-diff-comparing +addReferenceDiff: aSquotReferenceDiff + self shouldBeImplemented. \ No newline at end of file diff --git a/src/Squot.package/TSquotDiff.trait/methodProperties.json b/src/Squot.package/TSquotDiff.trait/methodProperties.json index 824ec921d..cce42f197 100644 --- a/src/Squot.package/TSquotDiff.trait/methodProperties.json +++ b/src/Squot.package/TSquotDiff.trait/methodProperties.json @@ -2,6 +2,7 @@ "class" : { }, "instance" : { + "addReferenceDiff:" : "jr 7/18/2021 11:21", "applyToObjectNamed:inGraph:with:" : "jr 7/17/2021 02:05", "applyToShadowNamed:inGraph:" : "jr 7/4/2021 17:44", "asSquotConflicts" : "jr 10/19/2017 19:20", From c50f3dc7bff9d2d370a62361066d5e8393247f2a Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 19:41:29 +0200 Subject: [PATCH 12/43] Allow shadows of bits objects to show their references Still do not show references from Strings to Characters intentionally. --- .../instance/is.comparableTo..st | 4 ++++ .../SquotBitsMirror.class/methodProperties.json | 1 + .../class/squotMirror.st | 2 +- .../instance/addVariablePartSlot..st | 5 +++++ .../instance/isComparableTo..st | 3 +++ .../instance/references.st | 4 ++++ .../instance/variablePartSlotWithIndex..st | 3 +++ .../methodProperties.json | 6 +++++- .../SquotBitsShadowMirror.class/README.md | 0 .../instance/is.comparableTo..st | 3 +++ .../methodProperties.json | 5 +++++ .../SquotBitsShadowMirror.class/properties.json | 14 ++++++++++++++ .../instance/testByteArray.st | 17 +++++++++++++++++ .../methodProperties.json | 1 + .../instance/newShadowObject.st | 2 +- .../methodProperties.json | 2 +- .../SquotStringShadow.class/README.md | 0 .../instance/references.st | 3 +++ .../methodProperties.json | 5 +++++ .../SquotStringShadow.class/properties.json | 14 ++++++++++++++ .../SquotStringShadowMirror.class/README.md | 0 .../instance/referencesFrom..st | 3 +++ .../methodProperties.json | 5 +++++ .../properties.json | 14 ++++++++++++++ 24 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 src/Squot.package/SquotBitsMirror.class/instance/is.comparableTo..st create mode 100644 src/Squot.package/SquotBitsObjectShadow.class/instance/addVariablePartSlot..st create mode 100644 src/Squot.package/SquotBitsObjectShadow.class/instance/isComparableTo..st create mode 100644 src/Squot.package/SquotBitsObjectShadow.class/instance/references.st create mode 100644 src/Squot.package/SquotBitsObjectShadow.class/instance/variablePartSlotWithIndex..st create mode 100644 src/Squot.package/SquotBitsShadowMirror.class/README.md create mode 100644 src/Squot.package/SquotBitsShadowMirror.class/instance/is.comparableTo..st create mode 100644 src/Squot.package/SquotBitsShadowMirror.class/methodProperties.json create mode 100644 src/Squot.package/SquotBitsShadowMirror.class/properties.json create mode 100644 src/Squot.package/SquotObjectGraphDiffTest.class/instance/testByteArray.st create mode 100644 src/Squot.package/SquotStringShadow.class/README.md create mode 100644 src/Squot.package/SquotStringShadow.class/instance/references.st create mode 100644 src/Squot.package/SquotStringShadow.class/methodProperties.json create mode 100644 src/Squot.package/SquotStringShadow.class/properties.json create mode 100644 src/Squot.package/SquotStringShadowMirror.class/README.md create mode 100644 src/Squot.package/SquotStringShadowMirror.class/instance/referencesFrom..st create mode 100644 src/Squot.package/SquotStringShadowMirror.class/methodProperties.json create mode 100644 src/Squot.package/SquotStringShadowMirror.class/properties.json diff --git a/src/Squot.package/SquotBitsMirror.class/instance/is.comparableTo..st b/src/Squot.package/SquotBitsMirror.class/instance/is.comparableTo..st new file mode 100644 index 000000000..4f8d798ed --- /dev/null +++ b/src/Squot.package/SquotBitsMirror.class/instance/is.comparableTo..st @@ -0,0 +1,4 @@ +comparing +is: anObject comparableTo: anotherObject + self assert: anObject class isBits. + ^ anObject isMemberOf: anotherObject class \ No newline at end of file diff --git a/src/Squot.package/SquotBitsMirror.class/methodProperties.json b/src/Squot.package/SquotBitsMirror.class/methodProperties.json index 797849d33..27ca5cde7 100644 --- a/src/Squot.package/SquotBitsMirror.class/methodProperties.json +++ b/src/Squot.package/SquotBitsMirror.class/methodProperties.json @@ -3,4 +3,5 @@ }, "instance" : { "initializeSnapshot:of:with:" : "jr 7/17/2021 23:56", + "is:comparableTo:" : "jr 7/25/2021 16:42", "shadowFactory" : "jr 4/8/2021 20:52" } } diff --git a/src/Squot.package/SquotBitsObjectShadow.class/class/squotMirror.st b/src/Squot.package/SquotBitsObjectShadow.class/class/squotMirror.st index 73fbcbfaa..f7cc0809a 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/class/squotMirror.st +++ b/src/Squot.package/SquotBitsObjectShadow.class/class/squotMirror.st @@ -1,3 +1,3 @@ reflecting squotMirror - ^ SquotBitsMirror new \ No newline at end of file + ^ SquotBitsShadowMirror new \ No newline at end of file diff --git a/src/Squot.package/SquotBitsObjectShadow.class/instance/addVariablePartSlot..st b/src/Squot.package/SquotBitsObjectShadow.class/instance/addVariablePartSlot..st new file mode 100644 index 000000000..dcc18cd99 --- /dev/null +++ b/src/Squot.package/SquotBitsObjectShadow.class/instance/addVariablePartSlot..st @@ -0,0 +1,5 @@ +accessing +addVariablePartSlot: aVariablePartSlot + | primitiveValue | + primitiveValue := aVariablePartSlot value. + value basicAt: aVariablePartSlot index put: primitiveValue value. \ No newline at end of file diff --git a/src/Squot.package/SquotBitsObjectShadow.class/instance/isComparableTo..st b/src/Squot.package/SquotBitsObjectShadow.class/instance/isComparableTo..st new file mode 100644 index 000000000..4c9811fee --- /dev/null +++ b/src/Squot.package/SquotBitsObjectShadow.class/instance/isComparableTo..st @@ -0,0 +1,3 @@ +comparing +isComparableTo: aBitsObjectShadow + ^ aBitsObjectShadow value isMemberOf: value class \ No newline at end of file diff --git a/src/Squot.package/SquotBitsObjectShadow.class/instance/references.st b/src/Squot.package/SquotBitsObjectShadow.class/instance/references.st new file mode 100644 index 000000000..a53e2eea7 --- /dev/null +++ b/src/Squot.package/SquotBitsObjectShadow.class/instance/references.st @@ -0,0 +1,4 @@ +reflection +references + ^ (1 to: (thisContext objectSize: value)) + collect: [:each | SquotIndexableField index: each] \ No newline at end of file diff --git a/src/Squot.package/SquotBitsObjectShadow.class/instance/variablePartSlotWithIndex..st b/src/Squot.package/SquotBitsObjectShadow.class/instance/variablePartSlotWithIndex..st new file mode 100644 index 000000000..124850e73 --- /dev/null +++ b/src/Squot.package/SquotBitsObjectShadow.class/instance/variablePartSlotWithIndex..st @@ -0,0 +1,3 @@ +accessing +variablePartSlotWithIndex: anInteger + ^ (value basicAt: anInteger) captureWithSquot \ No newline at end of file diff --git a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json index e5f70cf16..18e59a112 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json +++ b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json @@ -1,13 +1,16 @@ { "class" : { - "squotMirror" : "jr 4/10/2021 12:39" }, + "squotMirror" : "jr 7/25/2021 17:39" }, "instance" : { + "addVariablePartSlot:" : "jr 7/25/2021 18:33", "applySequenceDiff:" : "jr 9/24/2019 00:24", "applySequenceDiff:with:" : "jr 6/27/2017 16:59", "copyBitsFrom:" : "jr 4/8/2021 20:55", "initializeFrom:with:" : "jr 1/11/2021 00:08", + "isComparableTo:" : "jr 7/25/2021 17:41", "privateApplySequenceDiff:" : "jr 9/24/2019 00:24", "privateApplySequenceDiff:with:" : "jr 10/24/2017 23:42", + "references" : "jr 7/25/2021 19:34", "sameIn:withName:ifAbsent:" : "jr 9/6/2019 22:33", "squotDiffAgainst:" : "jr 6/27/2017 17:02", "squotDiffAgainst:with:" : "jr 10/21/2017 16:57", @@ -15,4 +18,5 @@ "squotPreferredSerializer" : "jr 9/20/2017 19:40", "squotShadowMarker" : "jr 6/27/2017 17:04", "squotWith:diffFromSequence:" : "jr 6/27/2017 17:04", + "variablePartSlotWithIndex:" : "jr 7/25/2021 18:30", "writeTo:" : "jr 6/27/2017 17:06" } } diff --git a/src/Squot.package/SquotBitsShadowMirror.class/README.md b/src/Squot.package/SquotBitsShadowMirror.class/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/Squot.package/SquotBitsShadowMirror.class/instance/is.comparableTo..st b/src/Squot.package/SquotBitsShadowMirror.class/instance/is.comparableTo..st new file mode 100644 index 000000000..69da8c92d --- /dev/null +++ b/src/Squot.package/SquotBitsShadowMirror.class/instance/is.comparableTo..st @@ -0,0 +1,3 @@ +comparing +is: aSquotBitsObjectShadow comparableTo: aSquotBitsObjectShadow2 + ^ aSquotBitsObjectShadow isComparableTo: aSquotBitsObjectShadow2 \ No newline at end of file diff --git a/src/Squot.package/SquotBitsShadowMirror.class/methodProperties.json b/src/Squot.package/SquotBitsShadowMirror.class/methodProperties.json new file mode 100644 index 000000000..9eda5071a --- /dev/null +++ b/src/Squot.package/SquotBitsShadowMirror.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "is:comparableTo:" : "jr 7/25/2021 17:42" } } diff --git a/src/Squot.package/SquotBitsShadowMirror.class/properties.json b/src/Squot.package/SquotBitsShadowMirror.class/properties.json new file mode 100644 index 000000000..b26c80105 --- /dev/null +++ b/src/Squot.package/SquotBitsShadowMirror.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Squot-Reflection", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "SquotBitsShadowMirror", + "pools" : [ + ], + "super" : "SquotObjectShadowMirror", + "type" : "normal" } diff --git a/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testByteArray.st b/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testByteArray.st new file mode 100644 index 000000000..4f924d29a --- /dev/null +++ b/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testByteArray.st @@ -0,0 +1,17 @@ +tests +testByteArray + | left right array arrayName other diff | + "{1. 2} <=> {1. 2}" + array := #[1 2]. + other := #[1 2] copy. + left := capturer captureGraph: (ValueHolder new contents: array; yourself). + arrayName := objectRegistry nameOf: array. + objectRegistry assign: arrayName to: other. + diff := left squotDiffAgainst: (capturer captureGraph: (ValueHolder new contents: other; yourself)). + self assert: (diff diffForObjectNamed: arrayName ifAbsent: []) isNil. + "{2. 1} <=> {1. 2}" + other := #[2 1]. + capturer objectGraph assign: (objectRegistry nameOf: array) to: other. + diff := left squotDiffAgainst: (right := capturer captureGraph: (ValueHolder new contents: other; yourself)). + self assert: (diff := diff diffForObjectNamed: arrayName ifAbsent: []) notNil; + assert: (diff squotApplyTo: (left shadowNamed: arrayName)) = (right shadowNamed: arrayName). \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json b/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json index 86fb017a8..0612f276e 100644 --- a/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json @@ -10,6 +10,7 @@ "testAddSubgraph" : "jr 9/24/2019 00:30", "testArrayOfDifferentlyTypedObjects" : "jr 4/4/2020 19:33", "testArrayOfIntegers" : "jr 9/13/2019 11:29", + "testByteArray" : "jr 7/25/2021 19:06", "testCyclicReferences" : "jr 6/25/2017 22:22", "testDeepChanges" : "jr 7/26/2017 23:30", "testDeepChanges2" : "jr 7/26/2017 23:31", diff --git a/src/Squot.package/SquotStringMirror.class/instance/newShadowObject.st b/src/Squot.package/SquotStringMirror.class/instance/newShadowObject.st index a9823371c..55a810833 100644 --- a/src/Squot.package/SquotStringMirror.class/instance/newShadowObject.st +++ b/src/Squot.package/SquotStringMirror.class/instance/newShadowObject.st @@ -1,3 +1,3 @@ capturing newShadowObject - ^ SquotBitsObjectShadow new \ No newline at end of file + ^ SquotStringShadow new \ No newline at end of file diff --git a/src/Squot.package/SquotStringMirror.class/methodProperties.json b/src/Squot.package/SquotStringMirror.class/methodProperties.json index be37c3761..9ff87e182 100644 --- a/src/Squot.package/SquotStringMirror.class/methodProperties.json +++ b/src/Squot.package/SquotStringMirror.class/methodProperties.json @@ -8,7 +8,7 @@ "hash" : "jr 12/15/2020 23:33", "initializeSnapshot:of:with:" : "jr 7/18/2021 00:00", "is:comparableTo:" : "jr 7/18/2021 20:15", - "newShadowObject" : "jr 4/7/2021 20:42", + "newShadowObject" : "jr 7/25/2021 18:46", "referencesFrom:" : "jr 12/16/2020 01:51", "reflectIndexableField:in:" : "jr 12/16/2020 00:04", "setClass:" : "jr 12/15/2020 23:33", diff --git a/src/Squot.package/SquotStringShadow.class/README.md b/src/Squot.package/SquotStringShadow.class/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/Squot.package/SquotStringShadow.class/instance/references.st b/src/Squot.package/SquotStringShadow.class/instance/references.st new file mode 100644 index 000000000..74fd6192e --- /dev/null +++ b/src/Squot.package/SquotStringShadow.class/instance/references.st @@ -0,0 +1,3 @@ +reflection +references + ^ #() \ No newline at end of file diff --git a/src/Squot.package/SquotStringShadow.class/methodProperties.json b/src/Squot.package/SquotStringShadow.class/methodProperties.json new file mode 100644 index 000000000..127a02b39 --- /dev/null +++ b/src/Squot.package/SquotStringShadow.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "references" : "jr 7/25/2021 18:46" } } diff --git a/src/Squot.package/SquotStringShadow.class/properties.json b/src/Squot.package/SquotStringShadow.class/properties.json new file mode 100644 index 000000000..5d058d046 --- /dev/null +++ b/src/Squot.package/SquotStringShadow.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Squot-Shadows", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "SquotStringShadow", + "pools" : [ + ], + "super" : "SquotBitsObjectShadow", + "type" : "normal" } diff --git a/src/Squot.package/SquotStringShadowMirror.class/README.md b/src/Squot.package/SquotStringShadowMirror.class/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/Squot.package/SquotStringShadowMirror.class/instance/referencesFrom..st b/src/Squot.package/SquotStringShadowMirror.class/instance/referencesFrom..st new file mode 100644 index 000000000..69be53850 --- /dev/null +++ b/src/Squot.package/SquotStringShadowMirror.class/instance/referencesFrom..st @@ -0,0 +1,3 @@ +enumerating +referencesFrom: aBitsObjectShadow + ^ #() \ No newline at end of file diff --git a/src/Squot.package/SquotStringShadowMirror.class/methodProperties.json b/src/Squot.package/SquotStringShadowMirror.class/methodProperties.json new file mode 100644 index 000000000..c0c930c3e --- /dev/null +++ b/src/Squot.package/SquotStringShadowMirror.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "referencesFrom:" : "jr 7/25/2021 18:44" } } diff --git a/src/Squot.package/SquotStringShadowMirror.class/properties.json b/src/Squot.package/SquotStringShadowMirror.class/properties.json new file mode 100644 index 000000000..716370a21 --- /dev/null +++ b/src/Squot.package/SquotStringShadowMirror.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Squot-Reflection", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "SquotStringShadowMirror", + "pools" : [ + ], + "super" : "SquotBitsShadowMirror", + "type" : "normal" } From b38c1d185317fd7d258c6c7459bc14bc5700ec54 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 19:47:31 +0200 Subject: [PATCH 13/43] Transitive diff markers added only with SquotReferences now --- .../instance/addTransitiveChangeIn..st | 5 ----- .../SquotDictionaryDiff.class/methodProperties.json | 2 +- .../instance/addTransitiveChangeIn..st | 10 ++++------ .../methodProperties.json | 2 +- .../instance/addTransitiveChangeIn..st | 7 ++----- .../SquotObjectDiff.class/methodProperties.json | 2 +- .../instance/addTransitiveChangeIn..st | 3 +++ .../SquotObjectReplacement.class/methodProperties.json | 1 + 8 files changed, 13 insertions(+), 19 deletions(-) delete mode 100644 src/Squot.package/SquotDictionaryDiff.class/instance/addTransitiveChangeIn..st create mode 100644 src/Squot.package/SquotObjectReplacement.class/instance/addTransitiveChangeIn..st diff --git a/src/Squot.package/SquotDictionaryDiff.class/instance/addTransitiveChangeIn..st b/src/Squot.package/SquotDictionaryDiff.class/instance/addTransitiveChangeIn..st deleted file mode 100644 index 1e9630511..000000000 --- a/src/Squot.package/SquotDictionaryDiff.class/instance/addTransitiveChangeIn..st +++ /dev/null @@ -1,5 +0,0 @@ -initialize-release -addTransitiveChangeIn: aSlot - (aSlot isKindOf: SquotDictionarySlot) ifTrue: - [^ itemChanges add: (SquotSlotTransitiveChange key: aSlot key)]. - ^ super addTransitiveChangeIn: aSlot \ No newline at end of file diff --git a/src/Squot.package/SquotDictionaryDiff.class/methodProperties.json b/src/Squot.package/SquotDictionaryDiff.class/methodProperties.json index 9530f79ab..0e4a66223 100644 --- a/src/Squot.package/SquotDictionaryDiff.class/methodProperties.json +++ b/src/Squot.package/SquotDictionaryDiff.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { }, "instance" : { - "addTransitiveChangeIn:" : "jr 7/30/2017 00:06" } } + } } diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/instance/addTransitiveChangeIn..st b/src/Squot.package/SquotHashedCollectionDiff.class/instance/addTransitiveChangeIn..st index 425f3d3c6..9c9ccce03 100644 --- a/src/Squot.package/SquotHashedCollectionDiff.class/instance/addTransitiveChangeIn..st +++ b/src/Squot.package/SquotHashedCollectionDiff.class/instance/addTransitiveChangeIn..st @@ -1,7 +1,5 @@ initialize-release -addTransitiveChangeIn: aSlot - (aSlot isKindOf: SquotHashedCollectionSlot) ifTrue: - [^ itemChanges add: (SquotSlotTransitiveChange key: aSlot key)]. - (aSlot isKindOf: SquotCollectionElement) ifTrue: - [^ itemChanges add: (SquotSlotTransitiveChange key: aSlot asSlotDiffKey)]. - ^ super addTransitiveChangeIn: aSlot \ No newline at end of file +addTransitiveChangeIn: aReference + (aReference isKindOf: SquotCollectionElement) ifTrue: + [^ itemChanges add: (SquotSlotTransitiveChange key: aReference asSlotDiffKey)]. + ^ super addTransitiveChangeIn: aReference \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json b/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json index 468b9e5fb..d538db146 100644 --- a/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json +++ b/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json @@ -3,7 +3,7 @@ }, "instance" : { "addReferenceDiff:" : "jr 7/18/2021 20:51", - "addTransitiveChangeIn:" : "jr 7/18/2021 21:02", + "addTransitiveChangeIn:" : "jr 7/25/2021 15:50", "applyTo:with:" : "jr 7/29/2017 22:06", "diff:against:" : "jr 9/18/2019 20:18", "diff:against:with:" : "jr 7/18/2021 20:34", diff --git a/src/Squot.package/SquotObjectDiff.class/instance/addTransitiveChangeIn..st b/src/Squot.package/SquotObjectDiff.class/instance/addTransitiveChangeIn..st index f978d317b..9bbdaa6d4 100644 --- a/src/Squot.package/SquotObjectDiff.class/instance/addTransitiveChangeIn..st +++ b/src/Squot.package/SquotObjectDiff.class/instance/addTransitiveChangeIn..st @@ -1,8 +1,5 @@ initialize-release -addTransitiveChangeIn: aSlot +addTransitiveChangeIn: aReference | change | - change := SquotSlotTransitiveChange key: - ((aSlot isKindOf: SquotReference) - ifTrue: [aSlot asSlotDiffKey] - ifFalse: [aSlot key]). + change := SquotSlotTransitiveChange key: aReference asSlotDiffKey. slotChanges at: change key ifAbsent: [slotChanges add: change]. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiff.class/methodProperties.json b/src/Squot.package/SquotObjectDiff.class/methodProperties.json index d8e45c171..7a63aa584 100644 --- a/src/Squot.package/SquotObjectDiff.class/methodProperties.json +++ b/src/Squot.package/SquotObjectDiff.class/methodProperties.json @@ -5,7 +5,7 @@ "addReferenceDiff:" : "jr 7/18/2021 20:16", "addSlotOnlyRight:" : "jr 9/16/2019 21:24", "addSlotOnlyRight:with:" : "jr 6/22/2017 12:01", - "addTransitiveChangeIn:" : "jr 7/18/2021 21:05", + "addTransitiveChangeIn:" : "jr 7/25/2021 15:49", "applyTo:" : "jr 9/23/2019 23:18", "applyTo:with:" : "jr 7/29/2017 21:29", "diff:against:" : "jr 6/17/2021 00:57", diff --git a/src/Squot.package/SquotObjectReplacement.class/instance/addTransitiveChangeIn..st b/src/Squot.package/SquotObjectReplacement.class/instance/addTransitiveChangeIn..st new file mode 100644 index 000000000..db0533e00 --- /dev/null +++ b/src/Squot.package/SquotObjectReplacement.class/instance/addTransitiveChangeIn..st @@ -0,0 +1,3 @@ +Squot-diff-comparing +addTransitiveChangeIn: aReference + "Ignore this since right shall completely replace left from the referrer." \ No newline at end of file diff --git a/src/Squot.package/SquotObjectReplacement.class/methodProperties.json b/src/Squot.package/SquotObjectReplacement.class/methodProperties.json index 5a19b33b0..ef944c135 100644 --- a/src/Squot.package/SquotObjectReplacement.class/methodProperties.json +++ b/src/Squot.package/SquotObjectReplacement.class/methodProperties.json @@ -3,6 +3,7 @@ "left:right:" : "jr 6/1/2017 12:48" }, "instance" : { "addReferenceDiff:" : "jr 7/25/2021 14:19", + "addTransitiveChangeIn:" : "jr 7/25/2021 19:44", "applyToShadowNamed:inGraph:" : "jr 7/4/2021 18:00", "asSquotConflicts" : "jr 12/20/2020 23:32", "incoming" : "jr 8/4/2019 00:14", From 1f34cd491a56a8c6556046d805d55b42b0334f9e Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 19:58:08 +0200 Subject: [PATCH 14/43] Remove dead code, arm deprecations --- .../instance/captureWithSquot..st | 2 +- .../methodProperties.json | 2 +- .../instance/captureWithSquot..st | 2 +- .../Object.extension/methodProperties.json | 2 +- .../instance/follow..st | 17 ---------- .../instance/left.right..st | 11 ------- .../instance/leftSlot.rightSlot..st | 21 ------------ .../instance/reassignSlot.to..st | 3 -- .../instance/replacing.with..st | 11 ------- .../methodProperties.json | 5 --- ...fOnlyLeft.ifOnlyRight.ifAlreadyVisited..st | 32 ------------------- .../methodProperties.json | 1 - .../instance/diff.against.with..st | 4 --- .../diffItems.againstThoseOf.with..st | 4 --- .../methodProperties.json | 2 -- .../instance/diffItems.with..st | 19 ----------- .../diffItemsAgainstThoseOf.in.with..st | 6 ---- .../methodProperties.json | 2 -- .../instance/diff.against.with..st | 6 +--- .../diffSlot.withCorrespondingSlotIn.with..st | 10 ------ .../methodProperties.json | 3 +- .../instance/captureWithSquot..st | 2 +- .../methodProperties.json | 2 +- .../instance/squotDiffAgainst.with..st | 3 -- .../methodProperties.json | 1 - 25 files changed, 8 insertions(+), 165 deletions(-) delete mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/follow..st delete mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/left.right..st delete mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/leftSlot.rightSlot..st delete mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/reassignSlot.to..st delete mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/replacing.with..st delete mode 100644 src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifOnlyLeft.ifOnlyRight.ifAlreadyVisited..st delete mode 100644 src/Squot.package/SquotHashedCollectionDiff.class/instance/diff.against.with..st delete mode 100644 src/Squot.package/SquotHashedCollectionDiff.class/instance/diffItems.againstThoseOf.with..st delete mode 100644 src/Squot.package/SquotHashedCollectionShadow.class/instance/diffItems.with..st delete mode 100644 src/Squot.package/SquotHashedCollectionShadow.class/instance/diffItemsAgainstThoseOf.in.with..st delete mode 100644 src/Squot.package/SquotObjectDiff.class/instance/diffSlot.withCorrespondingSlotIn.with..st delete mode 100644 src/Squot.package/SquotShadowSlot.class/instance/squotDiffAgainst.with..st diff --git a/src/Squot.package/ClassDescription.extension/instance/captureWithSquot..st b/src/Squot.package/ClassDescription.extension/instance/captureWithSquot..st index 03a0dd527..a6ebd3743 100644 --- a/src/Squot.package/ClassDescription.extension/instance/captureWithSquot..st +++ b/src/Squot.package/ClassDescription.extension/instance/captureWithSquot..st @@ -1,5 +1,5 @@ *Squot-trackable captureWithSquot: aCapturer - self flag: #deprecated. "Ask the mirror instead." + self deprecated: 'Ask the mirror instead'. self isMeta ifTrue: [^ super captureWithSquot: aCapturer]. ^ aCapturer shadowOf: self ifAbsentPut: [self captureWithSquot] \ No newline at end of file diff --git a/src/Squot.package/ClassDescription.extension/methodProperties.json b/src/Squot.package/ClassDescription.extension/methodProperties.json index 04eb8dd74..52738da44 100644 --- a/src/Squot.package/ClassDescription.extension/methodProperties.json +++ b/src/Squot.package/ClassDescription.extension/methodProperties.json @@ -3,7 +3,7 @@ }, "instance" : { "captureWithSquot" : "jr 8/13/2017 18:23", - "captureWithSquot:" : "jr 1/11/2021 00:01", + "captureWithSquot:" : "jr 7/25/2021 16:36", "package" : "jr 7/21/2017 17:31", "squotAddTransientStoreInfoTo:" : "jr 7/27/2017 23:52", "squotRemoveTransientStoreInfoFrom:" : "jr 7/27/2017 23:52" } } diff --git a/src/Squot.package/Object.extension/instance/captureWithSquot..st b/src/Squot.package/Object.extension/instance/captureWithSquot..st index 003f7f96a..f47bfbf5a 100644 --- a/src/Squot.package/Object.extension/instance/captureWithSquot..st +++ b/src/Squot.package/Object.extension/instance/captureWithSquot..st @@ -2,7 +2,7 @@ captureWithSquot: aCapturer "Use aCapturer to answer a conserved form of me that is suitable to be stored in Snapshots." | replacementOrSelf | - self flag: #deprecated. "Ask the mirror instead." + self deprecated: 'Ask the mirror instead'. self class isImmediateClass ifTrue: [^ aCapturer capturePrimitiveValue: self]. self class isBits ifTrue: [^ aCapturer captureBits: self]. replacementOrSelf := self squotReplacementFor: aCapturer. diff --git a/src/Squot.package/Object.extension/methodProperties.json b/src/Squot.package/Object.extension/methodProperties.json index d1e7282bc..af5817888 100644 --- a/src/Squot.package/Object.extension/methodProperties.json +++ b/src/Squot.package/Object.extension/methodProperties.json @@ -9,7 +9,7 @@ "browseFromSquotWorkingCopyArtifact:" : "jr 11/1/2020 21:06", "canHaveNameAssignedBySquot" : "jr 9/25/2019 14:34", "captureWithSquot" : "jr 7/16/2017 00:16", - "captureWithSquot:" : "jr 1/10/2021 23:58", + "captureWithSquot:" : "jr 7/25/2021 16:36", "hasSquotShadowName" : "jr 6/20/2017 13:15", "shouldHaveNameAssignedBySquot" : "jr 6/22/2017 15:19", "squotAddTransientStoreInfoTo:" : "jr 7/16/2017 18:57", diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/follow..st b/src/Squot.package/SquotDiffBuilder.class/instance/follow..st deleted file mode 100644 index 6c8f0acc9..000000000 --- a/src/Squot.package/SquotDiffBuilder.class/instance/follow..st +++ /dev/null @@ -1,17 +0,0 @@ -private -follow: aPairOfShadows - | leftShadow rightShadow | - leftShadow := aPairOfShadows key. - rightShadow := aPairOfShadows value. - leftShadow - ifNil: - ["added object" - (visited includes: rightShadow undecorated) ifTrue: [^ self]. - visited add: rightShadow undecorated. - self followAddedObjectReferences: rightShadow] - ifNotNil: - ["existing object" - (visited includes: leftShadow undecorated) ifTrue: [^ self]. - visited add: leftShadow undecorated. - diffedPair := aPairOfShadows. - self left: leftShadow right: rightShadow]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/left.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/left.right..st deleted file mode 100644 index 5ad850d16..000000000 --- a/src/Squot.package/SquotDiffBuilder.class/instance/left.right..st +++ /dev/null @@ -1,11 +0,0 @@ -diffing high-level -left: leftShadow right: rightShadow - "Answer a diff that would transform leftShadow into rightShadow" - diffedPair ifNil: ["top invocation" - ^ self startFromLeft: leftShadow right: rightShadow]. - self rememberNameOf: leftShadow; - rememberNameOf: rightShadow. - (shadowNames at: leftShadow undecorated ifAbsent: [1]) - = (shadowNames at: rightShadow undecorated ifAbsent: [2]) - ifFalse: [^ self replacing: leftShadow with: rightShadow]. - ^ leftShadow squotDiffAgainst: rightShadow with: self \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/leftSlot.rightSlot..st b/src/Squot.package/SquotDiffBuilder.class/instance/leftSlot.rightSlot..st deleted file mode 100644 index a8c40bdf0..000000000 --- a/src/Squot.package/SquotDiffBuilder.class/instance/leftSlot.rightSlot..st +++ /dev/null @@ -1,21 +0,0 @@ -diffing low-level -leftSlot: leftSlot rightSlot: rightSlot - "If the slot values refer to different origin objects, record a reassignment, - otherwise queue the slot values to be visited to detect deep changes." - | rightName | - (objectsWithChanges includes: leftSlot value undecorated) ifFalse: - [(referrers at: leftSlot value undecorated ifAbsentPut: [OrderedCollection new]) - add: diffedPair key -> leftSlot. - (referrers at: rightSlot value undecorated ifAbsentPut: [OrderedCollection new]) - add: diffedPair value -> rightSlot]. - rightSlot value sameIn: left asIn: right ifAbsent: - [rightName := right nameOf: rightSlot value undecorated ifAbsent: []. - self addedObject: rightSlot value withName: rightName]. - ^ (leftSlot value hasSquotShadowName not - or: [rightSlot value hasSquotShadowName not - or: [leftSlot value name ~= rightSlot value name]]) - ifTrue: [self reassignSlot: leftSlot to: rightSlot] - ifFalse: [self addToBeVisitedLeft: leftSlot value right: rightSlot value. - (objectsWithChanges includes: leftSlot value undecorated) - ifTrue: [SquotSlotTransitiveChange key: leftSlot key] - ifFalse: [SquotDiffOfEqualObjects instance]] \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/reassignSlot.to..st b/src/Squot.package/SquotDiffBuilder.class/instance/reassignSlot.to..st deleted file mode 100644 index 02e96e4c2..000000000 --- a/src/Squot.package/SquotDiffBuilder.class/instance/reassignSlot.to..st +++ /dev/null @@ -1,3 +0,0 @@ -diffing low-level -reassignSlot: leftSlot to: rightSlot - ^ leftSlot squotDiffAgainst: rightSlot \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/replacing.with..st b/src/Squot.package/SquotDiffBuilder.class/instance/replacing.with..st deleted file mode 100644 index 742cef70f..000000000 --- a/src/Squot.package/SquotDiffBuilder.class/instance/replacing.with..st +++ /dev/null @@ -1,11 +0,0 @@ -diffing low-level -replacing: leftShadow with: rightShadow - "Answer a diff that will replace the target object with the rightShadow" - | newName | - self assert: objectDiffs isEmpty description: 'only the start object can be replaced, the replacement of other objects is captured in slot reassignments'. - newName := shadowNames at: rightShadow undecorated. - (left includesObjectNamed: newName) - ifFalse: [self addedObject: rightShadow withName: newName]. - ^ self diffFrom: leftShadow to: rightShadow - ifNew: [SquotObjectReplacement left: leftShadow right: rightShadow] - andInitialize: [] \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json index efabd4060..a530e6a6a 100644 --- a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json +++ b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json @@ -5,20 +5,15 @@ "addToBeVisitedLeft:right:" : "jr 7/18/2021 20:02", "addedObject:withName:" : "jr 7/19/2021 00:14", "diffFrom:to:ifNew:andInitialize:" : "jr 6/27/2020 10:27", - "follow:" : "jr 9/24/2019 13:54", "followAddedObjectReferences:" : "jr 9/24/2019 14:19", "initialize" : "jr 9/30/2017 19:47", "left" : "jr 9/21/2019 21:03", "left:" : "jr 9/21/2019 21:03", - "left:right:" : "jr 8/15/2017 19:38", - "leftSlot:rightSlot:" : "jr 9/24/2019 14:07", "newStartFromLeft:right:" : "jr 7/18/2021 22:41", "noteChanged:" : "jr 8/15/2017 19:03", "noteChangedReferrer:via:to:" : "jr 7/27/2017 00:03", - "reassignSlot:to:" : "jr 9/16/2019 21:32", "rememberNameOf:" : "jr 11/19/2020 16:36", "rememberNameOf:orAssume:" : "jr 7/21/2017 00:42", - "replacing:with:" : "jr 7/7/2021 23:51", "right" : "jr 9/21/2019 21:03", "right:" : "jr 9/21/2019 21:03", "startFromLeft:right:" : "jr 7/18/2021 20:03" } } diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifOnlyLeft.ifOnlyRight.ifAlreadyVisited..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifOnlyLeft.ifOnlyRight.ifAlreadyVisited..st deleted file mode 100644 index d75f6f03b..000000000 --- a/src/Squot.package/SquotGraphComparisonWalk.class/instance/followReferencesOf.and.ifDifferentShape.ifOnlyLeft.ifOnlyRight.ifAlreadyVisited..st +++ /dev/null @@ -1,32 +0,0 @@ -enumerating -followReferencesOf: left and: right ifDifferentShape: replacementBlock ifOnlyLeft: removalBlock ifOnlyRight: additionBlock ifAlreadyVisited: multiPathBlock - | leftReflected rightReflected | - self deprecated. - leftReflected := SquotObjectReflection object: left mirror: (mirrors at: left). - rightReflected := SquotObjectReflection object: right mirror: (mirrors at: right). - ((leftReflected isComparableTo: rightReflected) not - or: [leftReflected references isEmpty - and: [rightReflected references isEmpty]]) - ifTrue: [replacementBlock value] - ifFalse: [ - walk checkPathsTo: left ifMultiple: [multiPathBlock value]; - checkPathsTo: right ifMultiple: [multiPathBlock value]. - (leftReflected references intersection: rightReflected references) do: - [:each | | nextLeft nextRight | - nextLeft := leftReflected reflect: each. - nextRight := rightReflected reflect: each. - mirrors at: nextLeft undecorated put: (leftReflected nextMirror: each); - at: nextRight undecorated put: (rightReflected nextMirror: each). - walk - add: {nextLeft. nextRight} - reachedVia: each]. - (leftReflected references copyWithoutAll: rightReflected references) do: - [:each | | oldTarget | - oldTarget := leftReflected reflect: each. - mirrors at: oldTarget undecorated put: (leftReflected nextMirror: each). - removalBlock value: oldTarget value: (walk currentPath copyWith: each)]. - (rightReflected references copyWithoutAll: leftReflected references) do: - [:each | | newTarget | - newTarget := rightReflected reflect: each. - mirrors at: newTarget undecorated put: (rightReflected nextMirror: each). - additionBlock value: newTarget value: (walk currentPath copyWith: each)]] \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json index 8c43aeda6..7b4794fd9 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json +++ b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json @@ -7,7 +7,6 @@ "checkPathsTo:ifMultiple:" : "jr 7/18/2021 17:05", "do:" : "jr 7/18/2021 11:38", "followReferencesOf:and:ifDifferentShape:ifFromBoth:ifOnlyLeft:ifOnlyRight:" : "jr 7/18/2021 22:10", - "followReferencesOf:and:ifDifferentShape:ifOnlyLeft:ifOnlyRight:ifAlreadyVisited:" : "jr 7/18/2021 17:00", "followReferencesOfNewObject:do:" : "jr 7/18/2021 20:20", "initialize" : "jr 4/8/2021 13:25", "startFrom:and:" : "jr 7/18/2021 11:39" } } diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/instance/diff.against.with..st b/src/Squot.package/SquotHashedCollectionDiff.class/instance/diff.against.with..st deleted file mode 100644 index 6c11d72f4..000000000 --- a/src/Squot.package/SquotHashedCollectionDiff.class/instance/diff.against.with..st +++ /dev/null @@ -1,4 +0,0 @@ -initialize-release -diff: leftObjectShadow against: rightShadow with: aDiffBuilder - super diff: leftObjectShadow against: rightShadow with: aDiffBuilder. - "leftObjectShadow diffItemsAgainstThoseOf: rightShadow in: self with: aDiffBuilder." \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/instance/diffItems.againstThoseOf.with..st b/src/Squot.package/SquotHashedCollectionDiff.class/instance/diffItems.againstThoseOf.with..st deleted file mode 100644 index 160707d3e..000000000 --- a/src/Squot.package/SquotHashedCollectionDiff.class/instance/diffItems.againstThoseOf.with..st +++ /dev/null @@ -1,4 +0,0 @@ -comparing -diffItems: leftDictionarySlots againstThoseOf: rightDictionaryShadow with: aDiffBuilder - itemChanges := Dictionary new - addAll: (rightDictionaryShadow diffItems: leftDictionarySlots with: aDiffBuilder). \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json b/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json index d538db146..4fc9c2b67 100644 --- a/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json +++ b/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json @@ -6,9 +6,7 @@ "addTransitiveChangeIn:" : "jr 7/25/2021 15:50", "applyTo:with:" : "jr 7/29/2017 22:06", "diff:against:" : "jr 9/18/2019 20:18", - "diff:against:with:" : "jr 7/18/2021 20:34", "diffItems:againstThoseOf:" : "jr 9/18/2019 20:18", - "diffItems:againstThoseOf:with:" : "jr 6/22/2017 13:05", "initialize" : "jr 7/18/2021 20:50", "itemChanges" : "jr 6/25/2017 22:25", "postCopy" : "jr 11/18/2018 02:02", diff --git a/src/Squot.package/SquotHashedCollectionShadow.class/instance/diffItems.with..st b/src/Squot.package/SquotHashedCollectionShadow.class/instance/diffItems.with..st deleted file mode 100644 index 3eb05bae4..000000000 --- a/src/Squot.package/SquotHashedCollectionShadow.class/instance/diffItems.with..st +++ /dev/null @@ -1,19 +0,0 @@ -comparing -diffItems: leftItemSlots with: aDiffBuilder - | changes left right addedNames removedNames | - changes := Dictionary new. - left := Dictionary newFrom: (leftItemSlots collect: [:each | each value name -> each]). - right := Dictionary newFrom: (itemSlots collect: [:each | each value name -> each]). - addedNames := right keys copyWithoutAll: left keys. - removedNames := left keys copyWithoutAll: right keys. - addedNames do: [:each | changes add: - (SquotSlotAddition key: each newSlot: (right at: each))]. - removedNames do: [:each | changes add: - (SquotSlotRemoval key: each removedSlot: (left at: each))]. - (right keys copyWithoutAll: addedNames) - do: [:each | | slotDiff | - slotDiff := (aDiffBuilder - leftSlot: (left at: each) - rightSlot: (right at: each)). - slotDiff squotHasChanges ifTrue: [changes add: slotDiff]]. - ^ changes \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionShadow.class/instance/diffItemsAgainstThoseOf.in.with..st b/src/Squot.package/SquotHashedCollectionShadow.class/instance/diffItemsAgainstThoseOf.in.with..st deleted file mode 100644 index 9294a70f0..000000000 --- a/src/Squot.package/SquotHashedCollectionShadow.class/instance/diffItemsAgainstThoseOf.in.with..st +++ /dev/null @@ -1,6 +0,0 @@ -comparing -diffItemsAgainstThoseOf: rightShadow in: aHashedCollectionDiff with: aDiffBuilder - ^ aHashedCollectionDiff - diffItems: itemSlots - againstThoseOf: rightShadow - with: aDiffBuilder \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionShadow.class/methodProperties.json b/src/Squot.package/SquotHashedCollectionShadow.class/methodProperties.json index 2b14c403e..22f775b24 100644 --- a/src/Squot.package/SquotHashedCollectionShadow.class/methodProperties.json +++ b/src/Squot.package/SquotHashedCollectionShadow.class/methodProperties.json @@ -7,9 +7,7 @@ "atElement:put:" : "jr 4/7/2021 22:25", "diffClass" : "jr 6/22/2017 13:07", "diffItems:" : "jr 9/18/2019 20:22", - "diffItems:with:" : "jr 4/29/2018 20:45", "diffItemsAgainstThoseOf:in:" : "jr 9/18/2019 20:22", - "diffItemsAgainstThoseOf:in:with:" : "jr 6/22/2017 13:04", "explorerContents" : "jr 12/30/2019 00:56", "explorerItemFor:" : "jr 12/30/2019 00:56", "hasContentsInExplorer" : "jr 2/22/2020 17:08", diff --git a/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st b/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st index dd8947bb6..8690d96f3 100644 --- a/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st +++ b/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st @@ -2,8 +2,4 @@ initialize-release diff: leftObjectShadow against: rightShadow with: aDiffBuilder originalClass := leftObjectShadow originalClass. newClass := rightShadow originalClass. - slotChanges := Dictionary new. - "leftObjectShadow slots associationsDo: [:eachSlot | - self diffSlot: eachSlot withCorrespondingSlotIn: rightShadow slots with: aDiffBuilder]. - (rightShadow slots keys copyWithoutAll: leftObjectShadow slots keys) do: [:eachKey | - self addSlotOnlyRight: (rightShadow slots associationAt: eachKey) with: aDiffBuilder]." \ No newline at end of file + slotChanges := Dictionary new. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiff.class/instance/diffSlot.withCorrespondingSlotIn.with..st b/src/Squot.package/SquotObjectDiff.class/instance/diffSlot.withCorrespondingSlotIn.with..st deleted file mode 100644 index bb987a48a..000000000 --- a/src/Squot.package/SquotObjectDiff.class/instance/diffSlot.withCorrespondingSlotIn.with..st +++ /dev/null @@ -1,10 +0,0 @@ -initialize-release -diffSlot: leftSlot withCorrespondingSlotIn: rightSlots with: aDiffBuilder - | rightSlot slotDiff | - self flag: #deprecated. - rightSlot := rightSlots associationAt: leftSlot key - ifAbsent: [^ slotChanges add: - (SquotSlotRemoval key: leftSlot key removedSlot: leftSlot)]. - slotDiff := leftSlot squotDiffAgainst: rightSlot with: aDiffBuilder. - slotDiff squotHasChanges ifFalse: [^ self]. - slotChanges add: slotDiff. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiff.class/methodProperties.json b/src/Squot.package/SquotObjectDiff.class/methodProperties.json index 7a63aa584..36193c55e 100644 --- a/src/Squot.package/SquotObjectDiff.class/methodProperties.json +++ b/src/Squot.package/SquotObjectDiff.class/methodProperties.json @@ -9,9 +9,8 @@ "applyTo:" : "jr 9/23/2019 23:18", "applyTo:with:" : "jr 7/29/2017 21:29", "diff:against:" : "jr 6/17/2021 00:57", - "diff:against:with:" : "jr 7/18/2021 20:34", + "diff:against:with:" : "jr 7/25/2021 15:33", "diffSlot:withCorrespondingSlotIn:" : "jr 9/16/2019 21:21", - "diffSlot:withCorrespondingSlotIn:with:" : "jr 7/18/2021 20:00", "initialize" : "jr 6/17/2021 00:57", "initializeSquotDiffNodes:with:" : "jr 11/18/2017 22:41", "newSquotDiffNodes" : "jr 11/18/2017 22:29", diff --git a/src/Squot.package/SquotShadowGraph.class/instance/captureWithSquot..st b/src/Squot.package/SquotShadowGraph.class/instance/captureWithSquot..st index 859508c11..3b052871b 100644 --- a/src/Squot.package/SquotShadowGraph.class/instance/captureWithSquot..st +++ b/src/Squot.package/SquotShadowGraph.class/instance/captureWithSquot..st @@ -1,5 +1,5 @@ converting captureWithSquot: aCapturer - self flag: #deprecated. "Ask the mirror instead." Warning signal: 'About to capture a SquotObjectGraph, which should not be done.'. + self deprecated: 'Ask the mirror instead'. ^ super captureWithSquot: aCapturer \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraph.class/methodProperties.json b/src/Squot.package/SquotShadowGraph.class/methodProperties.json index ecc1f8030..2e7f3fc65 100644 --- a/src/Squot.package/SquotShadowGraph.class/methodProperties.json +++ b/src/Squot.package/SquotShadowGraph.class/methodProperties.json @@ -8,7 +8,7 @@ "as:" : "jr 7/30/2017 02:07", "asShadowGraph" : "jr 7/30/2017 01:37", "browse" : "jr 12/23/2019 14:43", - "captureWithSquot:" : "jr 1/11/2021 00:01", + "captureWithSquot:" : "jr 7/25/2021 16:36", "delegateRegistry" : "jr 6/27/2017 17:33", "delegateRegistry:" : "jr 7/21/2017 01:30", "errorNotFound:" : "jr 7/30/2017 01:19", diff --git a/src/Squot.package/SquotShadowSlot.class/instance/squotDiffAgainst.with..st b/src/Squot.package/SquotShadowSlot.class/instance/squotDiffAgainst.with..st deleted file mode 100644 index 2ce10c0ab..000000000 --- a/src/Squot.package/SquotShadowSlot.class/instance/squotDiffAgainst.with..st +++ /dev/null @@ -1,3 +0,0 @@ -Squot-diffing -squotDiffAgainst: otherSlot with: aDiffBuilder - ^ aDiffBuilder leftSlot: self rightSlot: otherSlot \ No newline at end of file diff --git a/src/Squot.package/SquotShadowSlot.class/methodProperties.json b/src/Squot.package/SquotShadowSlot.class/methodProperties.json index 1e6bd3abd..784acff88 100644 --- a/src/Squot.package/SquotShadowSlot.class/methodProperties.json +++ b/src/Squot.package/SquotShadowSlot.class/methodProperties.json @@ -10,6 +10,5 @@ "removeFrom:" : "jr 9/23/2019 23:19", "removeFrom:with:" : "jr 9/23/2019 23:20", "squotDiffAgainst:" : "jr 9/18/2019 20:24", - "squotDiffAgainst:with:" : "jr 6/22/2017 13:46", "value" : "jr 9/1/2019 12:06", "value:" : "jr 9/1/2019 12:06" } } From c2f66d291699579f859b58188540185d213c878e Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 19:59:10 +0200 Subject: [PATCH 15/43] Move diff builder method to its proper place --- .../instance/newStartFromLeft.right..st | 130 ----------------- .../instance/startFromLeft.right..st | 132 ++++++++++++++++-- .../methodProperties.json | 3 +- 3 files changed, 123 insertions(+), 142 deletions(-) delete mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/newStartFromLeft.right..st diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/newStartFromLeft.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/newStartFromLeft.right..st deleted file mode 100644 index c862e0da1..000000000 --- a/src/Squot.package/SquotDiffBuilder.class/instance/newStartFromLeft.right..st +++ /dev/null @@ -1,130 +0,0 @@ -diffing high-level -newStartFromLeft: leftStartShadow right: rightStartShadow - "Walk the two object graphs and record the differences. Answer the graph diff." - "The first objects always get a name, so that their diff can be found in the graph diff. If the first objects have different identities, a SquotObjectReplacement is recorded as their diff. Otherwise the references of each pair of encountered object are followed and if the values of the references have been reassigned, diffs are created for the referrers and reference diffs are added to them. If references have been added or removed, this is also added to the diff of the referrers. If a diff is created for a pair of objects, a diff is also created for the pair of referrers, noting that the object referred to has been changed somehow." - | walk fallbackName | - self initialize. - graphDiff left: left; right: right. - walk := SquotGraphComparisonWalk startingFrom: leftStartShadow and: rightStartShadow. - fallbackName := ({rightStartShadow. leftStartShadow} detect: #hasSquotShadowName ifNone: []) - ifNotNil: [:shadow | shadow name] - ifNil: [SquotObjectCapturer new rootName]. - self rememberNameOf: leftStartShadow orAssume: [fallbackName]. - self rememberNameOf: rightStartShadow orAssume: [fallbackName]. - (shadowNames at: leftStartShadow undecorated) ~= (shadowNames at: rightStartShadow undecorated) - ifTrue: - ["Start objects have different identities." - | newName diff | - newName := shadowNames at: rightStartShadow undecorated. - diff := self diffFrom: leftStartShadow to: rightStartShadow - ifNew: [SquotObjectReplacement left: leftStartShadow right: rightStartShadow] - andInitialize: []]. - walk do: - [:leftShadow :rightShadow :leftReferrer :rightReferrer :path | | reference | - reference := path ifNotEmpty: [path last]. - diffedPair := leftShadow -> rightShadow. - leftShadow - ifNil: "Walking via a new object that did not exist in the old graph." - [walk followReferencesOfNewObject: rightShadow do: - [:value :newPath | | alreadyVisited | - alreadyVisited := false. - walk checkPathsTo: value ifMultiple: [alreadyVisited := true]. - alreadyVisited ifFalse: - [| existing name | - name := self rememberNameOf: value. - existing := value sameIn: left asIn: right ifAbsent: []. - existing - ifNil: - [self addedObject: value withName: name. - walk addNewObject: value reachedVia: newPath last] - ifNotNil: [walk addLeft: existing right: value reachedVia: newPath last]]]] - ifNotNil: "Comparing two objects with the same identity (except for the start objects which might still have different identities)." - [| diff | - "Give objects with intrinsic state a chance to compute the mutation." - diff := leftShadow squotDiffAgainst: rightShadow with: self. - "For other objects, the evaluation of the references is the important part." - walk followReferencesOf: leftShadow and: rightShadow - ifDifferentShape: - ["Replaced or objects without modeled outgoing references." - "Except for the start objects, this case was already handled when the names of the shadows were different before they were added to the walk. Objects of different kinds must have different identities if they have any identity at all." - | existing name | - self assert: path isEmpty. "May only happen with the start objects." - name := shadowNames at: rightShadow undecorated. - existing := rightShadow sameIn: left asIn: right ifAbsent: []. - existing - ifNil: - [self addedObject: rightShadow withName: name. - "Add to the walk again to get the addition in the graph diff." - walk addNewObject: rightShadow reachedVia: nil] - ifNotNil: - [existing undecorated ~= leftShadow - ifTrue: [walk addLeft: existing right: rightShadow reachedVia: nil]]] - ifFromBoth: - [:leftValue :rightValue :commonPath | | rightName | - self rememberNameOf: leftValue. - rightName := self rememberNameOf: rightValue. - (shadowNames at: leftValue undecorated ifAbsent: [1]) - = (shadowNames at: rightValue undecorated ifAbsent: [2]) - ifTrue: "The reference itself did not change, but we might later find out that the value has some differences." - [| alreadyVisited | - alreadyVisited := false. - walk checkPathsTo: leftValue ifMultiple: [alreadyVisited := true]. - alreadyVisited - ifTrue: - [(objectsWithChanges includes: leftValue undecorated) - ifTrue: [diff addReferenceDiff: - (SquotDifferentReferenceTarget - reference: commonPath last - leftOwner: leftShadow target: leftValue - rightOwner: rightShadow target: rightValue)]] - ifFalse: "left object not visited yet" - [walk addLeft: leftValue right: rightValue reachedVia: commonPath last]] - ifFalse: "Reference was reassigned to a different object or the targets are value objects." - [leftValue = rightValue ifFalse: - [diff addReferenceDiff: - (SquotReferenceTargetExchange - reference: commonPath last - leftOwner: leftShadow target: leftValue - rightOwner: rightShadow target: rightValue)]]. - rightValue sameIn: left asIn: right ifAbsent: - [| alreadyVisited | - alreadyVisited := false. - walk checkPathsTo: rightValue ifMultiple: [alreadyVisited := true]. - alreadyVisited ifFalse: - [self addedObject: rightValue withName: rightName. - walk addNewObject: rightValue reachedVia: commonPath last]]. - (objectsWithChanges includes: leftValue undecorated) ifFalse: - [(referrers at: leftValue undecorated ifAbsentPut: [OrderedCollection new]) - add: leftShadow -> commonPath last. - (referrers at: rightValue undecorated ifAbsentPut: [OrderedCollection new]) - add: rightShadow -> commonPath last]] - ifOnlyLeft: [:removed :oldPath | "Reference was removed" - diff addReferenceDiff: - (SquotReferenceRemoval of: removed - from: leftShadow reference: oldPath last - rightObject: rightShadow)] - ifOnlyRight: [:added :newPath | | alreadyVisited | - "Reference was added. Target might be new too, but not necessarily." - diff addReferenceDiff: - (SquotReferenceAddition - to: leftShadow reference: newPath last target: added - rightOwner: rightShadow). - alreadyVisited := false. - walk checkPathsTo: added ifMultiple: [alreadyVisited := true]. - alreadyVisited ifFalse: - [| existing name | - name := self rememberNameOf: added. - existing := added sameIn: left asIn: right ifAbsent: []. - existing - ifNil: - [self addedObject: added withName: name. - walk addNewObject: added reachedVia: newPath last] - ifNotNil: [walk addLeft: existing right: added reachedVia: newPath last]]]]]. - diffedPair := nil. - (objectDiffs select: [:each | each squotHasChanges]) - keysAndValuesDo: - [:shadow :diff | - graphDiff addDiff: diff forObjectNamed: (left nameOf: shadow). - self noteChanged: shadow]. - graphDiff startObjectName: (shadowNames at: leftStartShadow undecorated). - ^ graphDiff \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st index 502ed59db..84b327eba 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st @@ -1,18 +1,130 @@ diffing high-level -startFromLeft: leftShadow right: rightShadow +startFromLeft: leftStartShadow right: rightStartShadow + "Walk the two object graphs and record the differences. Answer the graph diff." + "The first objects always get a name, so that their diff can be found in the graph diff. If the first objects have different identities, a SquotObjectReplacement is recorded as their diff. Otherwise the references of each pair of encountered object are followed and if the values of the references have been reassigned, diffs are created for the referrers and reference diffs are added to them. If references have been added or removed, this is also added to the diff of the referrers. If a diff is created for a pair of objects, a diff is also created for the pair of referrers, noting that the object referred to has been changed somehow." | walk fallbackName | - true ifTrue: [^ self newStartFromLeft: leftShadow right: rightShadow]. self initialize. graphDiff left: left; right: right. - walk := SquotGraphComparisonWalk startingFrom: leftShadow and: rightShadow. - fallbackName := ({rightShadow. leftShadow} detect: #hasSquotShadowName ifNone: []) + walk := SquotGraphComparisonWalk startingFrom: leftStartShadow and: rightStartShadow. + fallbackName := ({rightStartShadow. leftStartShadow} detect: #hasSquotShadowName ifNone: []) ifNotNil: [:shadow | shadow name] ifNil: [SquotObjectCapturer new rootName]. - self rememberNameOf: leftShadow orAssume: [fallbackName]. - self rememberNameOf: rightShadow orAssume: [fallbackName]. - self addToBeVisitedLeft: leftShadow right: rightShadow. - [toBeVisited isEmpty] whileFalse: - [self follow: toBeVisited removeFirst]. + self rememberNameOf: leftStartShadow orAssume: [fallbackName]. + self rememberNameOf: rightStartShadow orAssume: [fallbackName]. + (shadowNames at: leftStartShadow undecorated) ~= (shadowNames at: rightStartShadow undecorated) + ifTrue: + ["Start objects have different identities." + | newName diff | + newName := shadowNames at: rightStartShadow undecorated. + diff := self diffFrom: leftStartShadow to: rightStartShadow + ifNew: [SquotObjectReplacement left: leftStartShadow right: rightStartShadow] + andInitialize: []]. + walk do: + [:leftShadow :rightShadow :leftReferrer :rightReferrer :path | | reference | + reference := path ifNotEmpty: [path last]. + diffedPair := leftShadow -> rightShadow. + leftShadow + ifNil: "Walking via a new object that did not exist in the old graph." + [walk followReferencesOfNewObject: rightShadow do: + [:value :newPath | | alreadyVisited | + alreadyVisited := false. + walk checkPathsTo: value ifMultiple: [alreadyVisited := true]. + alreadyVisited ifFalse: + [| existing name | + name := self rememberNameOf: value. + existing := value sameIn: left asIn: right ifAbsent: []. + existing + ifNil: + [self addedObject: value withName: name. + walk addNewObject: value reachedVia: newPath last] + ifNotNil: [walk addLeft: existing right: value reachedVia: newPath last]]]] + ifNotNil: "Comparing two objects with the same identity (except for the start objects which might still have different identities)." + [| diff | + "Give objects with intrinsic state a chance to compute the mutation." + diff := leftShadow squotDiffAgainst: rightShadow with: self. + "For other objects, the evaluation of the references is the important part." + walk followReferencesOf: leftShadow and: rightShadow + ifDifferentShape: + ["Replaced or objects without modeled outgoing references." + "Except for the start objects, this case was already handled when the names of the shadows were different before they were added to the walk. Objects of different kinds must have different identities if they have any identity at all." + | existing name | + self assert: path isEmpty. "May only happen with the start objects." + name := shadowNames at: rightShadow undecorated. + existing := rightShadow sameIn: left asIn: right ifAbsent: []. + existing + ifNil: + [self addedObject: rightShadow withName: name. + "Add to the walk again to get the addition in the graph diff." + walk addNewObject: rightShadow reachedVia: nil] + ifNotNil: + [existing undecorated ~= leftShadow + ifTrue: [walk addLeft: existing right: rightShadow reachedVia: nil]]] + ifFromBoth: + [:leftValue :rightValue :commonPath | | rightName | + self rememberNameOf: leftValue. + rightName := self rememberNameOf: rightValue. + (shadowNames at: leftValue undecorated ifAbsent: [1]) + = (shadowNames at: rightValue undecorated ifAbsent: [2]) + ifTrue: "The reference itself did not change, but we might later find out that the value has some differences." + [| alreadyVisited | + alreadyVisited := false. + walk checkPathsTo: leftValue ifMultiple: [alreadyVisited := true]. + alreadyVisited + ifTrue: + [(objectsWithChanges includes: leftValue undecorated) + ifTrue: [diff addReferenceDiff: + (SquotDifferentReferenceTarget + reference: commonPath last + leftOwner: leftShadow target: leftValue + rightOwner: rightShadow target: rightValue)]] + ifFalse: "left object not visited yet" + [walk addLeft: leftValue right: rightValue reachedVia: commonPath last]] + ifFalse: "Reference was reassigned to a different object or the targets are value objects." + [leftValue = rightValue ifFalse: + [diff addReferenceDiff: + (SquotReferenceTargetExchange + reference: commonPath last + leftOwner: leftShadow target: leftValue + rightOwner: rightShadow target: rightValue)]]. + rightValue sameIn: left asIn: right ifAbsent: + [| alreadyVisited | + alreadyVisited := false. + walk checkPathsTo: rightValue ifMultiple: [alreadyVisited := true]. + alreadyVisited ifFalse: + [self addedObject: rightValue withName: rightName. + walk addNewObject: rightValue reachedVia: commonPath last]]. + (objectsWithChanges includes: leftValue undecorated) ifFalse: + [(referrers at: leftValue undecorated ifAbsentPut: [OrderedCollection new]) + add: leftShadow -> commonPath last. + (referrers at: rightValue undecorated ifAbsentPut: [OrderedCollection new]) + add: rightShadow -> commonPath last]] + ifOnlyLeft: [:removed :oldPath | "Reference was removed" + diff addReferenceDiff: + (SquotReferenceRemoval of: removed + from: leftShadow reference: oldPath last + rightObject: rightShadow)] + ifOnlyRight: [:added :newPath | | alreadyVisited | + "Reference was added. Target might be new too, but not necessarily." + diff addReferenceDiff: + (SquotReferenceAddition + to: leftShadow reference: newPath last target: added + rightOwner: rightShadow). + alreadyVisited := false. + walk checkPathsTo: added ifMultiple: [alreadyVisited := true]. + alreadyVisited ifFalse: + [| existing name | + name := self rememberNameOf: added. + existing := added sameIn: left asIn: right ifAbsent: []. + existing + ifNil: + [self addedObject: added withName: name. + walk addNewObject: added reachedVia: newPath last] + ifNotNil: [walk addLeft: existing right: added reachedVia: newPath last]]]]]. diffedPair := nil. - graphDiff startObjectName: (shadowNames at: leftShadow undecorated). + (objectDiffs select: [:each | each squotHasChanges]) + keysAndValuesDo: + [:shadow :diff | + graphDiff addDiff: diff forObjectNamed: (left nameOf: shadow). + self noteChanged: shadow]. + graphDiff startObjectName: (shadowNames at: leftStartShadow undecorated). ^ graphDiff \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json index a530e6a6a..0e0ebfc30 100644 --- a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json +++ b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json @@ -9,11 +9,10 @@ "initialize" : "jr 9/30/2017 19:47", "left" : "jr 9/21/2019 21:03", "left:" : "jr 9/21/2019 21:03", - "newStartFromLeft:right:" : "jr 7/18/2021 22:41", "noteChanged:" : "jr 8/15/2017 19:03", "noteChangedReferrer:via:to:" : "jr 7/27/2017 00:03", "rememberNameOf:" : "jr 11/19/2020 16:36", "rememberNameOf:orAssume:" : "jr 7/21/2017 00:42", "right" : "jr 9/21/2019 21:03", "right:" : "jr 9/21/2019 21:03", - "startFromLeft:right:" : "jr 7/18/2021 20:03" } } + "startFromLeft:right:" : "jr 7/25/2021 15:53" } } From 584702797d569e48ebb7607c0384c9c6b5c91309 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 19:59:53 +0200 Subject: [PATCH 16/43] Fix: slotChanges not initialized in SquotHashedCollectionDiff --- .../SquotHashedCollectionDiff.class/instance/initialize.st | 1 + .../SquotHashedCollectionDiff.class/methodProperties.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/instance/initialize.st b/src/Squot.package/SquotHashedCollectionDiff.class/instance/initialize.st index 6cd3fcda5..c77cb2e64 100644 --- a/src/Squot.package/SquotHashedCollectionDiff.class/instance/initialize.st +++ b/src/Squot.package/SquotHashedCollectionDiff.class/instance/initialize.st @@ -1,3 +1,4 @@ initialize-release initialize + super initialize. itemChanges := Dictionary new. \ No newline at end of file diff --git a/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json b/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json index 4fc9c2b67..b5c3e62fa 100644 --- a/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json +++ b/src/Squot.package/SquotHashedCollectionDiff.class/methodProperties.json @@ -7,7 +7,7 @@ "applyTo:with:" : "jr 7/29/2017 22:06", "diff:against:" : "jr 9/18/2019 20:18", "diffItems:againstThoseOf:" : "jr 9/18/2019 20:18", - "initialize" : "jr 7/18/2021 20:50", + "initialize" : "jr 7/25/2021 19:08", "itemChanges" : "jr 6/25/2017 22:25", "postCopy" : "jr 11/18/2018 02:02", "referenceDiffsWithDefaultOwners:reflectedIn:do:" : "jr 6/27/2021 22:55", From 692f05f86a5b8925c56c8ef824cff3292ea6f5cd Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 20:00:32 +0200 Subject: [PATCH 17/43] Extend comparison walk comment --- .../SquotGraphComparisonWalk.class/README.md | 8 +++++++- .../SquotGraphComparisonWalk.class/properties.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/README.md b/src/Squot.package/SquotGraphComparisonWalk.class/README.md index e78d6fed4..32d9db0d7 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/README.md +++ b/src/Squot.package/SquotGraphComparisonWalk.class/README.md @@ -1 +1,7 @@ -I iterate over two graphs of objects and point out the differences. \ No newline at end of file +I iterate over two graphs of objects and point out the differences. + +When two objects can supposedly transformed into each other, I iterate over their references and provide the pairs of values to my client. My client is then supposed to compute the diff of the pair of values. + +When two objects supposedly cannot be transformed into each other, because, for example, their classes are different, I report this to the client. + +I am also able to walk along objects that are not present on the left side of the comparison. The left object will be reported as nil to my client then. Walking along added objects is necessary because added objects might (indirectly) refer to existing objects again. These existing objects might not be reachable from any other existing objects, but nevertheless they must be walked by, such that my client may compute their differences. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/properties.json b/src/Squot.package/SquotGraphComparisonWalk.class/properties.json index ee9178410..4fb372756 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/properties.json +++ b/src/Squot.package/SquotGraphComparisonWalk.class/properties.json @@ -4,7 +4,7 @@ ], "classvars" : [ ], - "commentStamp" : "jr 12/20/2020 22:11", + "commentStamp" : "jr 7/25/2021 17:57", "instvars" : [ "walk", "mirrors" ], From a195c6f832b4da43730cb94d1b9d5b12bfb68397 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 20:03:10 +0200 Subject: [PATCH 18/43] Extract method and inline method to ease debugging Want to be able to restart the diff applying in the patcher. No such need for fine granularity when comparing graphs. --- ...d.reflectedIn.diffsOfReferenceValuesDo..st | 21 +++++++++++++++ .../instance/apply.toLoadedGraph..st | 26 ++++++------------- .../SquotPatcher.class/methodProperties.json | 3 ++- .../instance/squotDiffAgainst..st | 5 +++- .../instance/squotDiffAgainst.with..st | 5 ---- .../methodProperties.json | 3 +-- 6 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 src/Squot.package/SquotPatcher.class/instance/apply.from.to.reflectedIn.inGraph.original.reflectedIn.patched.reflectedIn.diffsOfReferenceValuesDo..st delete mode 100644 src/Squot.package/SquotShadowGraph.class/instance/squotDiffAgainst.with..st diff --git a/src/Squot.package/SquotPatcher.class/instance/apply.from.to.reflectedIn.inGraph.original.reflectedIn.patched.reflectedIn.diffsOfReferenceValuesDo..st b/src/Squot.package/SquotPatcher.class/instance/apply.from.to.reflectedIn.inGraph.original.reflectedIn.patched.reflectedIn.diffsOfReferenceValuesDo..st new file mode 100644 index 000000000..976df48ca --- /dev/null +++ b/src/Squot.package/SquotPatcher.class/instance/apply.from.to.reflectedIn.inGraph.original.reflectedIn.patched.reflectedIn.diffsOfReferenceValuesDo..st @@ -0,0 +1,21 @@ +public graph patching +apply: diff from: aGraphDiff to: targetObject reflectedIn: mirror inGraph: anObjectGraph original: oldShadow reflectedIn: oldShadowMirror patched: newShadow reflectedIn: shadowMirror diffsOfReferenceValuesDo: walkBlock + | remaining object | + object := targetObject. + object := diff update: object reflectedIn: mirror + asMaterializedFrom: newShadow reflectedIn: shadowMirror. + "Oftentimes the new object is also the old object (same instance)." self flag: #todo. "But if it is not, we need a new mirror." + self take: object asMaterializedFrom: newShadow. + remaining := OrderedCollection new. + diff referenceDiffsWithDefaultOwners: {oldShadow. newShadow} reflectedIn: shadowMirror do: + [:each | self applyReferenceDiff: each to: object reflectedIn: mirror + new: newShadow reflectedIn: shadowMirror + old: oldShadow reflectedIn: oldShadowMirror + from: aGraphDiff + ifDeferred: [remaining add: each reference] + nextDiffsDo: [:valueDiff :value :valueMirror :valueShadow :valueShadowMirror :oldValueShadow | walkBlock valueWithArguments: {each. valueDiff. value. valueMirror. valueShadow. valueShadowMirror. oldValueShadow. oldShadowMirror mirrorOf: oldValueShadow reachedVia: each reference from: oldShadow}]]. + remaining + ifEmpty: [self reactivate: object] + ifNotEmpty: [pendingOutgoingReferences at: object put: remaining]. + self assignIdentifierIfAnyTo: object reflectedIn: mirror in: anObjectGraph materializedFrom: newShadow. + self updateReferrersTo: object materializedFrom: newShadow diff --git a/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st b/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st index 40823a2fd..e9b5392f9 100644 --- a/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st +++ b/src/Squot.package/SquotPatcher.class/instance/apply.toLoadedGraph..st @@ -8,24 +8,14 @@ apply: aGraphDiff toLoadedGraph: anObjectGraph walk := SquotGraphWalk startingFrom: {aGraphDiff asStartDiff. anObjectGraph. SquotObjectGraphMirror new. aGraphDiff right. SquotObjectGraphMirror new. aGraphDiff left. SquotObjectGraphMirror new}. walk doNotTrackReferrers. [walk atEnd] whileFalse: - [ | next diff object mirror newShadow shadowMirror oldShadow oldShadowMirror remaining | + [ | next diff object mirror newShadow shadowMirror oldShadow oldShadowMirror | next := walk next. diff := next first. object := next second. mirror := next third. newShadow := next fourth. shadowMirror := next fifth. oldShadow := next sixth. oldShadowMirror := next seventh. - object := diff update: object reflectedIn: mirror - asMaterializedFrom: newShadow reflectedIn: shadowMirror. - "Oftentimes the new object is also the old object (same instance)." self flag: #todo. "But if it is not, we need a new mirror." - self take: object asMaterializedFrom: newShadow. - remaining := OrderedCollection new. - diff referenceDiffsWithDefaultOwners: {oldShadow. newShadow} reflectedIn: shadowMirror do: - [:each | self applyReferenceDiff: each to: object reflectedIn: mirror - new: newShadow reflectedIn: shadowMirror - old: oldShadow reflectedIn: oldShadowMirror - from: aGraphDiff - ifDeferred: [remaining add: each reference] - nextDiffsDo: [:valueDiff :value :valueMirror :valueShadow :valueShadowMirror :oldValueShadow | walk add: {valueDiff. value. valueMirror. valueShadow. valueShadowMirror. oldValueShadow. oldShadowMirror mirrorOf: oldValueShadow reachedVia: each reference from: oldShadow} reachedVia: each]]. - remaining - ifEmpty: [self reactivate: object] - ifNotEmpty: [pendingOutgoingReferences at: object put: remaining]. - self assignIdentifierIfAnyTo: object reflectedIn: mirror in: anObjectGraph materializedFrom: newShadow. - self updateReferrersTo: object materializedFrom: newShadow]. + self apply: diff from: aGraphDiff to: object reflectedIn: mirror + inGraph: anObjectGraph + original: oldShadow reflectedIn: oldShadowMirror + patched: newShadow reflectedIn: shadowMirror + diffsOfReferenceValuesDo: + [:referenceDiff :valueDiff :value :valueMirror :valueShadow :valueShadowMirror :oldValueShadow :oldValueShadowMirror | + walk add: {valueDiff. value. valueMirror. valueShadow. valueShadowMirror. oldValueShadow. oldValueShadowMirror} reachedVia: referenceDiff]]. pendingOutgoingReferences ifNotEmpty: [self error: 'Objects not fully updated']. ^ anObjectGraph \ No newline at end of file diff --git a/src/Squot.package/SquotPatcher.class/methodProperties.json b/src/Squot.package/SquotPatcher.class/methodProperties.json index 1905c7617..cd395f1c5 100644 --- a/src/Squot.package/SquotPatcher.class/methodProperties.json +++ b/src/Squot.package/SquotPatcher.class/methodProperties.json @@ -2,7 +2,8 @@ "class" : { }, "instance" : { - "apply:toLoadedGraph:" : "jr 7/18/2021 00:54", + "apply:from:to:reflectedIn:inGraph:original:reflectedIn:patched:reflectedIn:diffsOfReferenceValuesDo:" : "jr 7/25/2021 18:21", + "apply:toLoadedGraph:" : "jr 7/25/2021 18:25", "applyReferenceDiff:to:reflectedIn:new:reflectedIn:old:reflectedIn:from:ifDeferred:nextDiffsDo:" : "jr 7/18/2021 00:56", "applying:fill:reachedVia:into:reflectedIn:ifDeferredUntilActivated:ifNotTreatedYet:" : "jr 7/18/2021 00:29", "assignIdentifierIfAnyTo:reflectedIn:in:materializedFrom:" : "jr 7/18/2021 00:57", diff --git a/src/Squot.package/SquotShadowGraph.class/instance/squotDiffAgainst..st b/src/Squot.package/SquotShadowGraph.class/instance/squotDiffAgainst..st index 8bc0f7408..0de97a5ce 100644 --- a/src/Squot.package/SquotShadowGraph.class/instance/squotDiffAgainst..st +++ b/src/Squot.package/SquotShadowGraph.class/instance/squotDiffAgainst..st @@ -1,4 +1,7 @@ Squot-shadow-diffing squotDiffAgainst: aGraph "Answer an object that describes the differences between me and otherContent." - ^ self squotDiffAgainst: aGraph with: SquotDiffBuilder new \ No newline at end of file + | diffBuilder | + diffBuilder := SquotDiffBuilder new. + diffBuilder left: self; right: aGraph. + ^ diffBuilder startFromLeft: self startShadow right: aGraph startShadow \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraph.class/instance/squotDiffAgainst.with..st b/src/Squot.package/SquotShadowGraph.class/instance/squotDiffAgainst.with..st deleted file mode 100644 index 6c9998bd9..000000000 --- a/src/Squot.package/SquotShadowGraph.class/instance/squotDiffAgainst.with..st +++ /dev/null @@ -1,5 +0,0 @@ -Squot-shadow-diffing -squotDiffAgainst: otherObjectGraph with: aDiffBuilder - "Answer an object that describes the differences between me and otherContent." - aDiffBuilder left: self; right: otherObjectGraph. - ^ aDiffBuilder startFromLeft: self startShadow right: otherObjectGraph startShadow \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraph.class/methodProperties.json b/src/Squot.package/SquotShadowGraph.class/methodProperties.json index 2e7f3fc65..820f9c24d 100644 --- a/src/Squot.package/SquotShadowGraph.class/methodProperties.json +++ b/src/Squot.package/SquotShadowGraph.class/methodProperties.json @@ -28,8 +28,7 @@ "shadowNamed:" : "jr 7/16/2017 00:55", "shadowNamed:ifAbsent:" : "jr 7/16/2017 00:55", "shadows" : "jr 5/10/2018 19:54", - "squotDiffAgainst:" : "jr 9/21/2019 21:02", - "squotDiffAgainst:with:" : "jr 9/21/2019 21:03", + "squotDiffAgainst:" : "jr 7/25/2021 15:56", "squotDiffAgainst:withBase:" : "jr 8/13/2019 17:27", "squotMaterializeWith:from:replacing:" : "jr 7/16/2017 18:09", "squotRewritePath:with:" : "jr 4/7/2018 16:06", From 8f12054dce3a4fd580bf5f3495f3a72a37c7bec1 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 20:59:48 +0200 Subject: [PATCH 19/43] Fix: missing extension method due to wrong category --- .../GenericDiff.extension/instance/addReferenceDiff..st | 3 +++ src/Squot.package/GenericDiff.extension/methodProperties.json | 1 + 2 files changed, 4 insertions(+) create mode 100644 src/Squot.package/GenericDiff.extension/instance/addReferenceDiff..st diff --git a/src/Squot.package/GenericDiff.extension/instance/addReferenceDiff..st b/src/Squot.package/GenericDiff.extension/instance/addReferenceDiff..st new file mode 100644 index 000000000..3be8bd3d2 --- /dev/null +++ b/src/Squot.package/GenericDiff.extension/instance/addReferenceDiff..st @@ -0,0 +1,3 @@ +*Squot-diff-comparing +addReferenceDiff: aSquotReferenceDiff + "Ignore since I compute my differences myself." \ No newline at end of file diff --git a/src/Squot.package/GenericDiff.extension/methodProperties.json b/src/Squot.package/GenericDiff.extension/methodProperties.json index d35cacbda..b8d3cd55c 100644 --- a/src/Squot.package/GenericDiff.extension/methodProperties.json +++ b/src/Squot.package/GenericDiff.extension/methodProperties.json @@ -2,6 +2,7 @@ "class" : { "squotDiffClass" : "jr 6/15/2017 17:49" }, "instance" : { + "addReferenceDiff:" : "jr 7/25/2021 17:49", "applyToShadowNamed:inGraph:" : "jr 7/4/2021 17:50", "initializeSquotDiffNodes:with:" : "jr 3/17/2018 14:09", "isAddition" : "jr 6/26/2021 22:33", From b0d5c33d122a6029236e7608077c3e2598d866d8 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 21:12:44 +0200 Subject: [PATCH 20/43] Use valueWithArguments: for older Squeak versions (Squeak 5.2) --- .../SquotGraphComparisonWalk.class/instance/do..st | 12 ++++++------ .../methodProperties.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/do..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/do..st index 89c4633a5..f3b665394 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/instance/do..st +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/do..st @@ -6,9 +6,9 @@ do: aBlock [| referrers path | referrers := walk currentReferrer. path := walk currentPath. - aBlock - value: each first - value: each second - value: (referrers ifNotNil: [referrers first]) - value: (referrers ifNotNil: [referrers second]) - value: path]]. \ No newline at end of file + aBlock valueWithArguments: + {each first. + each second. + referrers ifNotNil: [referrers first]. + referrers ifNotNil: [referrers second]. + path}]]. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json index 7b4794fd9..c3f2f2890 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json +++ b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json @@ -5,7 +5,7 @@ "addLeft:right:reachedVia:" : "jr 7/18/2021 21:53", "addNewObject:reachedVia:" : "jr 7/18/2021 16:19", "checkPathsTo:ifMultiple:" : "jr 7/18/2021 17:05", - "do:" : "jr 7/18/2021 11:38", + "do:" : "jr 7/25/2021 21:10", "followReferencesOf:and:ifDifferentShape:ifFromBoth:ifOnlyLeft:ifOnlyRight:" : "jr 7/18/2021 22:10", "followReferencesOfNewObject:do:" : "jr 7/18/2021 20:20", "initialize" : "jr 4/8/2021 13:25", From b6df2ec978a7008714c861778a4211fbfa75c20d Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 21:36:20 +0200 Subject: [PATCH 21/43] Do not fail fast if Squeak 5.2 tests fail Errors about BoxedFloat64>>truncate appeared for Squeak 5.2 on 32 bits. These errors did not appear in the Squeak 5.3 and Trunk jobs. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 221617f66..1515892b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ jobs: exclude: - os: macos-latest smalltalk: Squeak32-5.2 # 32bit no longer supported on macOS + fail-fast: ${{ matrix.smalltalk != "Squeak32-5.2" }} name: ${{ matrix.smalltalk }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: From fafe391fa310e0056b4eb43772af4ad3cefc6625 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 21:38:22 +0200 Subject: [PATCH 22/43] Selective fail-fast did not work --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1515892b7..6c8dc4919 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: exclude: - os: macos-latest smalltalk: Squeak32-5.2 # 32bit no longer supported on macOS - fail-fast: ${{ matrix.smalltalk != "Squeak32-5.2" }} + fail-fast: false # Do not let failures on Squeak 5.2 stop other jobs. name: ${{ matrix.smalltalk }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: From 99889a592e0237757571e97934b73e4000cc1443 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 25 Jul 2021 22:05:47 +0200 Subject: [PATCH 23/43] Break up long method into shorter ones --- ...edFrom.isDifferentFrom.reachedFrom.via..st | 39 +++++ .../instance/addDiffsToGraphDiff.st | 7 + .../instance/addToBeVisitedLeft.right..st | 7 - .../instance/addedObject.withName..st | 4 - .../addedObject.withName.reachedVia..st | 4 + ...mpare.reachedFrom.with.reachedFrom.via..st | 39 +++++ .../detectStartObjectReplacement.with..st | 10 ++ .../diffFrom.to.ifNew.andInitialize..st | 3 +- .../instance/followAddedObjectReferences..st | 9 -- .../instance/followNewObject..st | 4 + .../rememberStartObjectNamesLeft.right..st | 8 ++ .../searchAndFollowOnce.reachedVia..st | 5 + .../searchFor.named.ifNew.ifFound..st | 7 + .../instance/searchOnceFor.ifNew.ifFound..st | 8 ++ .../instance/startFromLeft.right..st | 134 ++---------------- .../methodProperties.json | 17 ++- .../SquotDiffBuilder.class/properties.json | 3 +- .../newObjectsDo.existingObjectsPairsDo..st | 7 + .../methodProperties.json | 1 + 19 files changed, 166 insertions(+), 150 deletions(-) create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/addDiffsToGraphDiff.st delete mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/addToBeVisitedLeft.right..st delete mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName..st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName.reachedVia..st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/compare.reachedFrom.with.reachedFrom.via..st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/detectStartObjectReplacement.with..st delete mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/followAddedObjectReferences..st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/followNewObject..st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/rememberStartObjectNamesLeft.right..st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/searchAndFollowOnce.reachedVia..st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/searchFor.named.ifNew.ifFound..st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/searchOnceFor.ifNew.ifFound..st create mode 100644 src/Squot.package/SquotGraphComparisonWalk.class/instance/newObjectsDo.existingObjectsPairsDo..st diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st b/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st new file mode 100644 index 000000000..d34eddc66 --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st @@ -0,0 +1,39 @@ +private +addChangesTo: diff when: leftValue reachedFrom: leftShadow isDifferentFrom: rightValue reachedFrom: rightShadow via: aReference + | rightName | + self rememberNameOf: leftValue. + rightName := self rememberNameOf: rightValue. + (shadowNames at: leftValue undecorated ifAbsent: [1]) + = (shadowNames at: rightValue undecorated ifAbsent: [2]) + ifTrue: "The reference itself did not change, but we might later find out that the value has some differences." + [| alreadyVisited | + alreadyVisited := false. + walk checkPathsTo: leftValue ifMultiple: [alreadyVisited := true]. + alreadyVisited + ifTrue: + [(objectsWithChanges includes: leftValue undecorated) + ifTrue: [diff addReferenceDiff: + (SquotDifferentReferenceTarget + reference: aReference + leftOwner: leftShadow target: leftValue + rightOwner: rightShadow target: rightValue)]] + ifFalse: "left object not visited yet" + [walk addLeft: leftValue right: rightValue reachedVia: aReference]] + ifFalse: "Reference was reassigned to a different object or the targets are value objects." + [leftValue = rightValue ifFalse: + [diff addReferenceDiff: + (SquotReferenceTargetExchange + reference: aReference + leftOwner: leftShadow target: leftValue + rightOwner: rightShadow target: rightValue)]]. + rightValue sameIn: left asIn: right ifAbsent: + [| alreadyVisited | + alreadyVisited := false. + walk checkPathsTo: rightValue ifMultiple: [alreadyVisited := true]. + alreadyVisited ifFalse: + [self addedObject: rightValue withName: rightName reachedVia: aReference]]. + (objectsWithChanges includes: leftValue undecorated) ifFalse: + [(referrers at: leftValue undecorated ifAbsentPut: [OrderedCollection new]) + add: leftShadow -> aReference. + (referrers at: rightValue undecorated ifAbsentPut: [OrderedCollection new]) + add: rightShadow -> aReference]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/addDiffsToGraphDiff.st b/src/Squot.package/SquotDiffBuilder.class/instance/addDiffsToGraphDiff.st new file mode 100644 index 000000000..42e285b41 --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/addDiffsToGraphDiff.st @@ -0,0 +1,7 @@ +private +addDiffsToGraphDiff + (objectDiffs select: [:each | each squotHasChanges]) + keysAndValuesDo: + [:shadow :diff | + graphDiff addDiff: diff forObjectNamed: (left nameOf: shadow). + self noteChanged: shadow]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/addToBeVisitedLeft.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/addToBeVisitedLeft.right..st deleted file mode 100644 index d0b2a776c..000000000 --- a/src/Squot.package/SquotDiffBuilder.class/instance/addToBeVisitedLeft.right..st +++ /dev/null @@ -1,7 +0,0 @@ -private -addToBeVisitedLeft: leftShadow right: rightShadow - (left nameOf: leftShadow undecorated ifAbsent: []) ifNotNil: - [:name | shadowNames at: leftShadow undecorated put: name]. - (right nameOf: rightShadow undecorated ifAbsent: []) ifNotNil: - [:name | shadowNames at: rightShadow undecorated put: name]. - "toBeVisited add: leftShadow -> rightShadow." \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName..st b/src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName..st deleted file mode 100644 index 6b1d376b7..000000000 --- a/src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName..st +++ /dev/null @@ -1,4 +0,0 @@ -diffing low-level -addedObject: aShadow withName: name - name ifNotNil: [graphDiff addShadow: aShadow named: name]. - self addToBeVisitedLeft: nil right: aShadow. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName.reachedVia..st b/src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName.reachedVia..st new file mode 100644 index 000000000..6bd1d0d4e --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/addedObject.withName.reachedVia..st @@ -0,0 +1,4 @@ +private +addedObject: aShadow withName: name reachedVia: aReference + name ifNotNil: [graphDiff addShadow: aShadow named: name]. + walk addNewObject: aShadow reachedVia: aReference. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/compare.reachedFrom.with.reachedFrom.via..st b/src/Squot.package/SquotDiffBuilder.class/instance/compare.reachedFrom.with.reachedFrom.via..st new file mode 100644 index 000000000..d29e1e533 --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/compare.reachedFrom.with.reachedFrom.via..st @@ -0,0 +1,39 @@ +private +compare: leftShadow reachedFrom: leftReferrer with: rightShadow reachedFrom: rightReferrer via: reference + | diff | + "Give objects with intrinsic state a chance to compute the mutation." + diff := leftShadow squotDiffAgainst: rightShadow with: self. + "For other objects, the evaluation of the references is the important part." + walk followReferencesOf: leftShadow and: rightShadow + ifDifferentShape: + ["Replaced or objects without modeled outgoing references." + "Except for the start objects, this case was already handled in detectStartObjectReplacement:with:. Objects of different kinds must have different identities if they have any identity at all." + | name | + self assert: reference isNil. "May only happen with the start objects." + name := shadowNames at: rightShadow undecorated. + self searchFor: rightShadow + named: name + ifNew: + [self addedObject: rightShadow withName: name reachedVia: nil. + "Add to the walk again to get the addition in the graph diff."] + ifFound: + [:existing | + existing undecorated ~= leftShadow + ifTrue: [walk addLeft: existing right: rightShadow reachedVia: nil]]] + ifFromBoth: + [:leftValue :rightValue :commonPath | + self addChangesTo: diff + when: leftValue reachedFrom: leftShadow + isDifferentFrom: rightValue reachedFrom: rightShadow via: commonPath last] + ifOnlyLeft: [:removed :oldPath | "Reference was removed" + diff addReferenceDiff: + (SquotReferenceRemoval of: removed + from: leftShadow reference: oldPath last + rightObject: rightShadow)] + ifOnlyRight: [:added :newPath | + "Reference was added. Target might be new too, but not necessarily." + diff addReferenceDiff: + (SquotReferenceAddition + to: leftShadow reference: newPath last target: added + rightOwner: rightShadow). + self searchAndFollowOnce: added reachedVia: newPath last]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/detectStartObjectReplacement.with..st b/src/Squot.package/SquotDiffBuilder.class/instance/detectStartObjectReplacement.with..st new file mode 100644 index 000000000..1576db788 --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/detectStartObjectReplacement.with..st @@ -0,0 +1,10 @@ +private +detectStartObjectReplacement: leftStartShadow with: rightStartShadow + (shadowNames at: leftStartShadow undecorated) ~= (shadowNames at: rightStartShadow undecorated) + ifTrue: + ["Start objects have different identities." + | newName diff | + newName := shadowNames at: rightStartShadow undecorated. + diff := self diffFrom: leftStartShadow to: rightStartShadow + ifNew: [SquotObjectReplacement left: leftStartShadow right: rightStartShadow] + andInitialize: []]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/diffFrom.to.ifNew.andInitialize..st b/src/Squot.package/SquotDiffBuilder.class/instance/diffFrom.to.ifNew.andInitialize..st index a549ecd01..7f40bc608 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/diffFrom.to.ifNew.andInitialize..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/diffFrom.to.ifNew.andInitialize..st @@ -1,7 +1,6 @@ -diffing low-level +comparing diffFrom: leftShadow to: rightShadow ifNew: newBlock andInitialize: initBlock | diff leftUndecorated | - diffedPair := leftShadow -> rightShadow. leftUndecorated := leftShadow undecorated. diff := objectDiffs at: leftUndecorated ifPresent: [:existing | ^ existing] diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/followAddedObjectReferences..st b/src/Squot.package/SquotDiffBuilder.class/instance/followAddedObjectReferences..st deleted file mode 100644 index bec1d36dc..000000000 --- a/src/Squot.package/SquotDiffBuilder.class/instance/followAddedObjectReferences..st +++ /dev/null @@ -1,9 +0,0 @@ -private -followAddedObjectReferences: aShadow - aShadow squotOutgoingReferences - do: [:each | | name leftShadowOrNil | - (name := (right nameOf: each value undecorated ifAbsent: [])) ifNotNil: - [leftShadowOrNil := left shadowNamed: name ifAbsent: []. - leftShadowOrNil - ifNil: [self addedObject: each value withName: name] - ifNotNil: [self addToBeVisitedLeft: leftShadowOrNil right: each value]]]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/followNewObject..st b/src/Squot.package/SquotDiffBuilder.class/instance/followNewObject..st new file mode 100644 index 000000000..daeb3a3bb --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/followNewObject..st @@ -0,0 +1,4 @@ +private +followNewObject: rightShadow + walk followReferencesOfNewObject: rightShadow do: + [:value :newPath | self searchAndFollowOnce: value reachedVia: newPath last]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/rememberStartObjectNamesLeft.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/rememberStartObjectNamesLeft.right..st new file mode 100644 index 000000000..d60bda1bb --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/rememberStartObjectNamesLeft.right..st @@ -0,0 +1,8 @@ +private +rememberStartObjectNamesLeft: leftStartShadow right: rightStartShadow + | fallbackName | + fallbackName := ({rightStartShadow. leftStartShadow} detect: #hasSquotShadowName ifNone: []) + ifNotNil: [:shadow | shadow name] + ifNil: [SquotObjectCapturer new rootName]. + self rememberNameOf: leftStartShadow orAssume: [fallbackName]. + self rememberNameOf: rightStartShadow orAssume: [fallbackName]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/searchAndFollowOnce.reachedVia..st b/src/Squot.package/SquotDiffBuilder.class/instance/searchAndFollowOnce.reachedVia..st new file mode 100644 index 000000000..2c3a79f42 --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/searchAndFollowOnce.reachedVia..st @@ -0,0 +1,5 @@ +private +searchAndFollowOnce: value reachedVia: aReference + self searchOnceFor: value + ifNew: [:name | self addedObject: value withName: name reachedVia: aReference] + ifFound: [:existing | walk addLeft: existing right: value reachedVia: aReference]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/searchFor.named.ifNew.ifFound..st b/src/Squot.package/SquotDiffBuilder.class/instance/searchFor.named.ifNew.ifFound..st new file mode 100644 index 000000000..1be8d30c1 --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/searchFor.named.ifNew.ifFound..st @@ -0,0 +1,7 @@ +private +searchFor: value named: name ifNew: newBlock ifFound: foundBlock + | existing | + existing := value sameIn: left asIn: right ifAbsent: []. + existing + ifNil: [newBlock value] + ifNotNil: [foundBlock value: existing]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/searchOnceFor.ifNew.ifFound..st b/src/Squot.package/SquotDiffBuilder.class/instance/searchOnceFor.ifNew.ifFound..st new file mode 100644 index 000000000..8fce01017 --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/searchOnceFor.ifNew.ifFound..st @@ -0,0 +1,8 @@ +private +searchOnceFor: value ifNew: newBlock ifFound: foundBlock + | name | + walk checkPathsTo: value ifMultiple: [^ self]. + name := self rememberNameOf: value. + self searchFor: value named: name + ifNew: [newBlock value: name] + ifFound: foundBlock. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st index 84b327eba..2c311e8cd 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st @@ -1,130 +1,20 @@ -diffing high-level +comparing startFromLeft: leftStartShadow right: rightStartShadow "Walk the two object graphs and record the differences. Answer the graph diff." "The first objects always get a name, so that their diff can be found in the graph diff. If the first objects have different identities, a SquotObjectReplacement is recorded as their diff. Otherwise the references of each pair of encountered object are followed and if the values of the references have been reassigned, diffs are created for the referrers and reference diffs are added to them. If references have been added or removed, this is also added to the diff of the referrers. If a diff is created for a pair of objects, a diff is also created for the pair of referrers, noting that the object referred to has been changed somehow." - | walk fallbackName | self initialize. graphDiff left: left; right: right. walk := SquotGraphComparisonWalk startingFrom: leftStartShadow and: rightStartShadow. - fallbackName := ({rightStartShadow. leftStartShadow} detect: #hasSquotShadowName ifNone: []) - ifNotNil: [:shadow | shadow name] - ifNil: [SquotObjectCapturer new rootName]. - self rememberNameOf: leftStartShadow orAssume: [fallbackName]. - self rememberNameOf: rightStartShadow orAssume: [fallbackName]. - (shadowNames at: leftStartShadow undecorated) ~= (shadowNames at: rightStartShadow undecorated) - ifTrue: - ["Start objects have different identities." - | newName diff | - newName := shadowNames at: rightStartShadow undecorated. - diff := self diffFrom: leftStartShadow to: rightStartShadow - ifNew: [SquotObjectReplacement left: leftStartShadow right: rightStartShadow] - andInitialize: []]. - walk do: - [:leftShadow :rightShadow :leftReferrer :rightReferrer :path | | reference | - reference := path ifNotEmpty: [path last]. - diffedPair := leftShadow -> rightShadow. - leftShadow - ifNil: "Walking via a new object that did not exist in the old graph." - [walk followReferencesOfNewObject: rightShadow do: - [:value :newPath | | alreadyVisited | - alreadyVisited := false. - walk checkPathsTo: value ifMultiple: [alreadyVisited := true]. - alreadyVisited ifFalse: - [| existing name | - name := self rememberNameOf: value. - existing := value sameIn: left asIn: right ifAbsent: []. - existing - ifNil: - [self addedObject: value withName: name. - walk addNewObject: value reachedVia: newPath last] - ifNotNil: [walk addLeft: existing right: value reachedVia: newPath last]]]] - ifNotNil: "Comparing two objects with the same identity (except for the start objects which might still have different identities)." - [| diff | - "Give objects with intrinsic state a chance to compute the mutation." - diff := leftShadow squotDiffAgainst: rightShadow with: self. - "For other objects, the evaluation of the references is the important part." - walk followReferencesOf: leftShadow and: rightShadow - ifDifferentShape: - ["Replaced or objects without modeled outgoing references." - "Except for the start objects, this case was already handled when the names of the shadows were different before they were added to the walk. Objects of different kinds must have different identities if they have any identity at all." - | existing name | - self assert: path isEmpty. "May only happen with the start objects." - name := shadowNames at: rightShadow undecorated. - existing := rightShadow sameIn: left asIn: right ifAbsent: []. - existing - ifNil: - [self addedObject: rightShadow withName: name. - "Add to the walk again to get the addition in the graph diff." - walk addNewObject: rightShadow reachedVia: nil] - ifNotNil: - [existing undecorated ~= leftShadow - ifTrue: [walk addLeft: existing right: rightShadow reachedVia: nil]]] - ifFromBoth: - [:leftValue :rightValue :commonPath | | rightName | - self rememberNameOf: leftValue. - rightName := self rememberNameOf: rightValue. - (shadowNames at: leftValue undecorated ifAbsent: [1]) - = (shadowNames at: rightValue undecorated ifAbsent: [2]) - ifTrue: "The reference itself did not change, but we might later find out that the value has some differences." - [| alreadyVisited | - alreadyVisited := false. - walk checkPathsTo: leftValue ifMultiple: [alreadyVisited := true]. - alreadyVisited - ifTrue: - [(objectsWithChanges includes: leftValue undecorated) - ifTrue: [diff addReferenceDiff: - (SquotDifferentReferenceTarget - reference: commonPath last - leftOwner: leftShadow target: leftValue - rightOwner: rightShadow target: rightValue)]] - ifFalse: "left object not visited yet" - [walk addLeft: leftValue right: rightValue reachedVia: commonPath last]] - ifFalse: "Reference was reassigned to a different object or the targets are value objects." - [leftValue = rightValue ifFalse: - [diff addReferenceDiff: - (SquotReferenceTargetExchange - reference: commonPath last - leftOwner: leftShadow target: leftValue - rightOwner: rightShadow target: rightValue)]]. - rightValue sameIn: left asIn: right ifAbsent: - [| alreadyVisited | - alreadyVisited := false. - walk checkPathsTo: rightValue ifMultiple: [alreadyVisited := true]. - alreadyVisited ifFalse: - [self addedObject: rightValue withName: rightName. - walk addNewObject: rightValue reachedVia: commonPath last]]. - (objectsWithChanges includes: leftValue undecorated) ifFalse: - [(referrers at: leftValue undecorated ifAbsentPut: [OrderedCollection new]) - add: leftShadow -> commonPath last. - (referrers at: rightValue undecorated ifAbsentPut: [OrderedCollection new]) - add: rightShadow -> commonPath last]] - ifOnlyLeft: [:removed :oldPath | "Reference was removed" - diff addReferenceDiff: - (SquotReferenceRemoval of: removed - from: leftShadow reference: oldPath last - rightObject: rightShadow)] - ifOnlyRight: [:added :newPath | | alreadyVisited | - "Reference was added. Target might be new too, but not necessarily." - diff addReferenceDiff: - (SquotReferenceAddition - to: leftShadow reference: newPath last target: added - rightOwner: rightShadow). - alreadyVisited := false. - walk checkPathsTo: added ifMultiple: [alreadyVisited := true]. - alreadyVisited ifFalse: - [| existing name | - name := self rememberNameOf: added. - existing := added sameIn: left asIn: right ifAbsent: []. - existing - ifNil: - [self addedObject: added withName: name. - walk addNewObject: added reachedVia: newPath last] - ifNotNil: [walk addLeft: existing right: added reachedVia: newPath last]]]]]. - diffedPair := nil. - (objectDiffs select: [:each | each squotHasChanges]) - keysAndValuesDo: - [:shadow :diff | - graphDiff addDiff: diff forObjectNamed: (left nameOf: shadow). - self noteChanged: shadow]. + self rememberStartObjectNamesLeft: leftStartShadow right: rightStartShadow. + self detectStartObjectReplacement: leftStartShadow with: rightStartShadow. + walk + newObjectsDo: "Walking via a new object that did not exist in the old graph." + [:rightShadow :rightReferrer :path | self followNewObject: rightShadow] + existingObjectsPairsDo: "Comparing two objects with the same identity (except for the start objects which might still have different identities)." + [:leftShadow :rightShadow :leftReferrer :rightReferrer :path | + self compare: leftShadow reachedFrom: leftReferrer + with: rightShadow reachedFrom: rightReferrer + via: (path ifEmpty: [] ifNotEmpty: [path last])]. + self addDiffsToGraphDiff. graphDiff startObjectName: (shadowNames at: leftStartShadow undecorated). ^ graphDiff \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json index 0e0ebfc30..d9e9c4ce3 100644 --- a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json +++ b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json @@ -2,10 +2,13 @@ "class" : { }, "instance" : { - "addToBeVisitedLeft:right:" : "jr 7/18/2021 20:02", - "addedObject:withName:" : "jr 7/19/2021 00:14", - "diffFrom:to:ifNew:andInitialize:" : "jr 6/27/2020 10:27", - "followAddedObjectReferences:" : "jr 9/24/2019 14:19", + "addChangesTo:when:reachedFrom:isDifferentFrom:reachedFrom:via:" : "jr 7/25/2021 21:44", + "addDiffsToGraphDiff" : "jr 7/25/2021 21:15", + "addedObject:withName:reachedVia:" : "jr 7/25/2021 20:54", + "compare:reachedFrom:with:reachedFrom:via:" : "jr 7/25/2021 21:59", + "detectStartObjectReplacement:with:" : "jr 7/25/2021 20:08", + "diffFrom:to:ifNew:andInitialize:" : "jr 7/25/2021 20:26", + "followNewObject:" : "jr 7/25/2021 22:00", "initialize" : "jr 9/30/2017 19:47", "left" : "jr 9/21/2019 21:03", "left:" : "jr 9/21/2019 21:03", @@ -13,6 +16,10 @@ "noteChangedReferrer:via:to:" : "jr 7/27/2017 00:03", "rememberNameOf:" : "jr 11/19/2020 16:36", "rememberNameOf:orAssume:" : "jr 7/21/2017 00:42", + "rememberStartObjectNamesLeft:right:" : "jr 7/25/2021 20:06", "right" : "jr 9/21/2019 21:03", "right:" : "jr 9/21/2019 21:03", - "startFromLeft:right:" : "jr 7/25/2021 15:53" } } + "searchAndFollowOnce:reachedVia:" : "jr 7/25/2021 21:59", + "searchFor:named:ifNew:ifFound:" : "jr 7/25/2021 22:03", + "searchOnceFor:ifNew:ifFound:" : "jr 7/25/2021 21:57", + "startFromLeft:right:" : "jr 7/25/2021 21:15" } } diff --git a/src/Squot.package/SquotDiffBuilder.class/properties.json b/src/Squot.package/SquotDiffBuilder.class/properties.json index b99e378cf..8a6a693de 100644 --- a/src/Squot.package/SquotDiffBuilder.class/properties.json +++ b/src/Squot.package/SquotDiffBuilder.class/properties.json @@ -16,7 +16,8 @@ "diffedPair", "objectsWithChanges", "referrers", - "graphDiff" ], + "graphDiff", + "walk" ], "name" : "SquotDiffBuilder", "pools" : [ ], diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/newObjectsDo.existingObjectsPairsDo..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/newObjectsDo.existingObjectsPairsDo..st new file mode 100644 index 000000000..80df1a8c3 --- /dev/null +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/newObjectsDo.existingObjectsPairsDo..st @@ -0,0 +1,7 @@ +enumerating +newObjectsDo: newBlock existingObjectsPairsDo: compareBlock + self do: + [:leftShadow :rightShadow :leftReferrer :rightReferrer :path | + leftShadow + ifNil: [newBlock value: rightShadow value: rightReferrer value: path] + ifNotNil: [compareBlock valueWithArguments: {leftShadow. rightShadow. leftReferrer. rightReferrer. path}]] \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json index c3f2f2890..7bbb0d95b 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json +++ b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json @@ -9,4 +9,5 @@ "followReferencesOf:and:ifDifferentShape:ifFromBoth:ifOnlyLeft:ifOnlyRight:" : "jr 7/18/2021 22:10", "followReferencesOfNewObject:do:" : "jr 7/18/2021 20:20", "initialize" : "jr 4/8/2021 13:25", + "newObjectsDo:existingObjectsPairsDo:" : "jr 7/25/2021 21:11", "startFrom:and:" : "jr 7/18/2021 11:39" } } From b979d2d2770df52712e5687eb9192f5d433ad9b4 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Fri, 30 Jul 2021 20:46:29 +0200 Subject: [PATCH 24/43] Split diff creation from diff initialization more thoroughly Let diff objects be created by the mirrors. If the same kind of object is used in different roles, reflected in different mirrors, different kinds of diffs may be appropriate. Because only the SquotGraphComparisonWalk keeps the mirrors as of now, it now must create the diff objects. --- .../instance/initializeFrom.to..st | 3 +++ .../GenericDiff.extension/methodProperties.json | 1 + .../instance/squotDiffAgainst.with..st | 10 +++++----- .../instance/squotWith.diffFromSequence..st | 1 + .../methodProperties.json | 4 ++-- .../instance/newDiffFrom.to..st | 3 +++ .../methodProperties.json | 3 ++- ...eachedFrom.isDifferentFrom.reachedFrom.via..st | 2 +- .../compare.reachedFrom.with.reachedFrom.via..st | 5 +++-- .../instance/compareLater.with.reachedVia..st | 5 +++++ .../detectStartObjectReplacement.with..st | 6 ++---- .../instance/diffFrom.to.ifNew.andInitialize..st | 1 + .../instance/noteChangedReferrer.via.to..st | 8 +++----- .../instance/searchAndFollowOnce.reachedVia..st | 2 +- .../instance/startFromLeft.right..st | 3 ++- .../SquotDiffBuilder.class/methodProperties.json | 15 ++++++++------- .../instance/newDiffFrom.to..st | 5 +++++ .../methodProperties.json | 1 + .../instance/squotDiffAgainst.with..st | 1 + .../methodProperties.json | 2 +- .../class/startingFrom.and..st | 5 ----- .../instance/addLeft.right.reachedVia..st | 5 ++++- .../instance/startFrom.and..st | 5 ++++- .../methodProperties.json | 6 +++--- .../SquotMirror.class/instance/newDiffFrom.to..st | 4 ++++ .../SquotMirror.class/methodProperties.json | 1 + .../instance/diff.against.with..st | 1 + .../instance/initializeFrom.to..st | 5 +++++ .../SquotObjectDiff.class/methodProperties.json | 3 ++- .../instance/testReplacedObject.st | 8 ++++++++ .../methodProperties.json | 1 + .../instance/newDiffFrom.to..st | 5 +++++ .../SquotObjectMirror.class/methodProperties.json | 1 + .../instance/initializeFrom.to..st | 3 +++ .../methodProperties.json | 1 + .../instance/squotDiffAgainst.with..st | 1 + .../SquotObjectShadow.class/methodProperties.json | 2 +- .../instance/newDiffFrom.to..st | 3 +++ .../methodProperties.json | 1 + .../instance/newDiffFrom.to..st | 4 ++++ .../methodProperties.json | 1 + .../instance/initializeFrom.to..st | 3 +++ .../SquotPackageDiff.class/methodProperties.json | 1 + .../instance/squotDiffAgainst.with..st | 1 + .../methodProperties.json | 2 +- .../instance/newDiffFrom.to..st | 3 +++ .../methodProperties.json | 1 + .../instance/squotDiffAgainst.with..st | 3 +++ .../methodProperties.json | 2 +- .../instance/newDiffFrom.to..st | 5 +++++ .../SquotStringMirror.class/methodProperties.json | 1 + .../instance/squotDiffAgainst..st | 8 +++++--- .../methodProperties.json | 2 +- .../instance/newDiffFrom.to..st | 3 +++ .../methodProperties.json | 1 + .../instance/squotDiffAgainst.with..st | 2 +- .../TSquotDiffable.trait/methodProperties.json | 2 +- .../instance/squotDiffAgainst..st | 5 ----- .../instance/squotDiffAgainst.with..st | 1 + .../methodProperties.json | 3 +-- 60 files changed, 139 insertions(+), 57 deletions(-) create mode 100644 src/Squot.package/GenericDiff.extension/instance/initializeFrom.to..st create mode 100644 src/Squot.package/SquotBitsShadowMirror.class/instance/newDiffFrom.to..st create mode 100644 src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st create mode 100644 src/Squot.package/SquotDiskProxyMirror.class/instance/newDiffFrom.to..st delete mode 100644 src/Squot.package/SquotGraphComparisonWalk.class/class/startingFrom.and..st create mode 100644 src/Squot.package/SquotMirror.class/instance/newDiffFrom.to..st create mode 100644 src/Squot.package/SquotObjectDiff.class/instance/initializeFrom.to..st create mode 100644 src/Squot.package/SquotObjectGraphDiffTest.class/instance/testReplacedObject.st create mode 100644 src/Squot.package/SquotObjectMirror.class/instance/newDiffFrom.to..st create mode 100644 src/Squot.package/SquotObjectReplacement.class/instance/initializeFrom.to..st create mode 100644 src/Squot.package/SquotObjectShadowMirror.class/instance/newDiffFrom.to..st create mode 100644 src/Squot.package/SquotOpaqueValueMirror.class/instance/newDiffFrom.to..st create mode 100644 src/Squot.package/SquotPackageDiff.class/instance/initializeFrom.to..st create mode 100644 src/Squot.package/SquotPackageShadowMirror.class/instance/newDiffFrom.to..st create mode 100644 src/Squot.package/SquotStringMirror.class/instance/newDiffFrom.to..st create mode 100644 src/Squot.package/SquotTrackedObjectMetadataMirror.class/instance/newDiffFrom.to..st delete mode 100644 src/Squot.package/TSquotDiffableShadow.trait/instance/squotDiffAgainst..st diff --git a/src/Squot.package/GenericDiff.extension/instance/initializeFrom.to..st b/src/Squot.package/GenericDiff.extension/instance/initializeFrom.to..st new file mode 100644 index 000000000..eab8dac95 --- /dev/null +++ b/src/Squot.package/GenericDiff.extension/instance/initializeFrom.to..st @@ -0,0 +1,3 @@ +*Squot-diff-comparing +initializeFrom: aSquotBitsObjectShadow to: aSquotBitsObjectShadow2 + "Already done when constructed." \ No newline at end of file diff --git a/src/Squot.package/GenericDiff.extension/methodProperties.json b/src/Squot.package/GenericDiff.extension/methodProperties.json index b8d3cd55c..6f04d5319 100644 --- a/src/Squot.package/GenericDiff.extension/methodProperties.json +++ b/src/Squot.package/GenericDiff.extension/methodProperties.json @@ -4,6 +4,7 @@ "instance" : { "addReferenceDiff:" : "jr 7/25/2021 17:49", "applyToShadowNamed:inGraph:" : "jr 7/4/2021 17:50", + "initializeFrom:to:" : "jr 7/30/2021 19:28", "initializeSquotDiffNodes:with:" : "jr 3/17/2018 14:09", "isAddition" : "jr 6/26/2021 22:33", "isModification" : "jr 6/26/2021 22:33", diff --git a/src/Squot.package/SquotBitsObjectShadow.class/instance/squotDiffAgainst.with..st b/src/Squot.package/SquotBitsObjectShadow.class/instance/squotDiffAgainst.with..st index 1a58ea836..fb18a1fec 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/instance/squotDiffAgainst.with..st +++ b/src/Squot.package/SquotBitsObjectShadow.class/instance/squotDiffAgainst.with..st @@ -1,7 +1,7 @@ Squot-shadow-diffing squotDiffAgainst: otherShadow with: aDiffBuilder - ^ (value species = otherShadow value species) - ifTrue: [aDiffBuilder diffFrom: self to: otherShadow - ifNew: [otherShadow squotWith: aDiffBuilder diffFromSequence: value] - andInitialize: []] - ifFalse: [aDiffBuilder replacing: self with: otherShadow] \ No newline at end of file + self deprecated: 'See SquotBitsShadowMirror newDiffFrom:to:'. + ^ aDiffBuilder + diffFrom: self to: otherShadow + ifNew: [otherShadow squotWith: aDiffBuilder diffFromSequence: value] + andInitialize: [] \ No newline at end of file diff --git a/src/Squot.package/SquotBitsObjectShadow.class/instance/squotWith.diffFromSequence..st b/src/Squot.package/SquotBitsObjectShadow.class/instance/squotWith.diffFromSequence..st index 22949290d..7a33ab40f 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/instance/squotWith.diffFromSequence..st +++ b/src/Squot.package/SquotBitsObjectShadow.class/instance/squotWith.diffFromSequence..st @@ -1,6 +1,7 @@ Squot-shadow-diffing squotWith: aDiffBuilder diffFromSequence: leftSequence "Double dispatch from a sequence." + self deprecated: 'Use squotDiffAgainst: instead, or better yet, use SquotBitsShadowMirror newDiffFrom:to:'. ^ GenericDiff squotDiffClass new file1: leftSequence; file2: value; diff --git a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json index 18e59a112..bcc0b60fd 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json +++ b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json @@ -13,10 +13,10 @@ "references" : "jr 7/25/2021 19:34", "sameIn:withName:ifAbsent:" : "jr 9/6/2019 22:33", "squotDiffAgainst:" : "jr 6/27/2017 17:02", - "squotDiffAgainst:with:" : "jr 10/21/2017 16:57", + "squotDiffAgainst:with:" : "jr 7/30/2021 19:51", "squotMaterializeWith:" : "jr 6/27/2017 17:03", "squotPreferredSerializer" : "jr 9/20/2017 19:40", "squotShadowMarker" : "jr 6/27/2017 17:04", - "squotWith:diffFromSequence:" : "jr 6/27/2017 17:04", + "squotWith:diffFromSequence:" : "jr 7/30/2021 19:56", "variablePartSlotWithIndex:" : "jr 7/25/2021 18:30", "writeTo:" : "jr 6/27/2017 17:06" } } diff --git a/src/Squot.package/SquotBitsShadowMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotBitsShadowMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..7a82367d3 --- /dev/null +++ b/src/Squot.package/SquotBitsShadowMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,3 @@ +comparing +newDiffFrom: aBitsObjectShadow to: aBitsObjectShadow2 + ^ aBitsObjectShadow squotDiffAgainst: aBitsObjectShadow2 \ No newline at end of file diff --git a/src/Squot.package/SquotBitsShadowMirror.class/methodProperties.json b/src/Squot.package/SquotBitsShadowMirror.class/methodProperties.json index 9eda5071a..c9d953b2b 100644 --- a/src/Squot.package/SquotBitsShadowMirror.class/methodProperties.json +++ b/src/Squot.package/SquotBitsShadowMirror.class/methodProperties.json @@ -2,4 +2,5 @@ "class" : { }, "instance" : { - "is:comparableTo:" : "jr 7/25/2021 17:42" } } + "is:comparableTo:" : "jr 7/25/2021 17:42", + "newDiffFrom:to:" : "jr 7/30/2021 19:40" } } diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st b/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st index d34eddc66..83515b731 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st @@ -18,7 +18,7 @@ addChangesTo: diff when: leftValue reachedFrom: leftShadow isDifferentFrom: righ leftOwner: leftShadow target: leftValue rightOwner: rightShadow target: rightValue)]] ifFalse: "left object not visited yet" - [walk addLeft: leftValue right: rightValue reachedVia: aReference]] + [self compareLater: leftValue with: rightValue reachedVia: aReference]] ifFalse: "Reference was reassigned to a different object or the targets are value objects." [leftValue = rightValue ifFalse: [diff addReferenceDiff: diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/compare.reachedFrom.with.reachedFrom.via..st b/src/Squot.package/SquotDiffBuilder.class/instance/compare.reachedFrom.with.reachedFrom.via..st index d29e1e533..48385e1a9 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/compare.reachedFrom.with.reachedFrom.via..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/compare.reachedFrom.with.reachedFrom.via..st @@ -1,8 +1,9 @@ private compare: leftShadow reachedFrom: leftReferrer with: rightShadow reachedFrom: rightReferrer via: reference | diff | + diff := objectDiffs at: leftShadow undecorated. "Give objects with intrinsic state a chance to compute the mutation." - diff := leftShadow squotDiffAgainst: rightShadow with: self. + diff initializeFrom: leftShadow to: rightShadow. "For other objects, the evaluation of the references is the important part." walk followReferencesOf: leftShadow and: rightShadow ifDifferentShape: @@ -19,7 +20,7 @@ compare: leftShadow reachedFrom: leftReferrer with: rightShadow reachedFrom: rig ifFound: [:existing | existing undecorated ~= leftShadow - ifTrue: [walk addLeft: existing right: rightShadow reachedVia: nil]]] + ifTrue: [self compareLater: existing with: rightShadow reachedVia: nil]]] ifFromBoth: [:leftValue :rightValue :commonPath | self addChangesTo: diff diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st b/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st new file mode 100644 index 000000000..65047937c --- /dev/null +++ b/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st @@ -0,0 +1,5 @@ +private +compareLater: leftValue with: rightValue reachedVia: aReference + | newDiff | + newDiff := walk addLeft: leftValue right: rightValue reachedVia: aReference. + objectDiffs at: leftValue undecorated put: newDiff. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/detectStartObjectReplacement.with..st b/src/Squot.package/SquotDiffBuilder.class/instance/detectStartObjectReplacement.with..st index 1576db788..26cc80256 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/detectStartObjectReplacement.with..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/detectStartObjectReplacement.with..st @@ -3,8 +3,6 @@ detectStartObjectReplacement: leftStartShadow with: rightStartShadow (shadowNames at: leftStartShadow undecorated) ~= (shadowNames at: rightStartShadow undecorated) ifTrue: ["Start objects have different identities." - | newName diff | + | newName | newName := shadowNames at: rightStartShadow undecorated. - diff := self diffFrom: leftStartShadow to: rightStartShadow - ifNew: [SquotObjectReplacement left: leftStartShadow right: rightStartShadow] - andInitialize: []]. \ No newline at end of file + objectDiffs at: leftStartShadow undecorated put: (SquotObjectReplacement left: leftStartShadow right: rightStartShadow)]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/diffFrom.to.ifNew.andInitialize..st b/src/Squot.package/SquotDiffBuilder.class/instance/diffFrom.to.ifNew.andInitialize..st index 7f40bc608..375ceee47 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/diffFrom.to.ifNew.andInitialize..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/diffFrom.to.ifNew.andInitialize..st @@ -1,6 +1,7 @@ comparing diffFrom: leftShadow to: rightShadow ifNew: newBlock andInitialize: initBlock | diff leftUndecorated | + self deprecated: 'Rely on the walk (SquotGraphComparisonWalk) instead'. leftUndecorated := leftShadow undecorated. diff := objectDiffs at: leftUndecorated ifPresent: [:existing | ^ existing] diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/noteChangedReferrer.via.to..st b/src/Squot.package/SquotDiffBuilder.class/instance/noteChangedReferrer.via.to..st index 38d8d09ec..e073eefe5 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/noteChangedReferrer.via.to..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/noteChangedReferrer.via.to..st @@ -1,8 +1,6 @@ private diffing -noteChangedReferrer: referringShadow via: aSlot to: anUndecoratedShadow +noteChangedReferrer: referringShadow via: aReference to: anUndecoratedShadow "Add a deep change for aSlot in the diff of referringShadow." - (self diffFrom: referringShadow to: referringShadow - ifNew: [referringShadow diffClass new] - andInitialize: []) - addTransitiveChangeIn: aSlot. + (objectDiffs at: referringShadow undecorated) + addTransitiveChangeIn: aReference. self noteChanged: referringShadow. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/searchAndFollowOnce.reachedVia..st b/src/Squot.package/SquotDiffBuilder.class/instance/searchAndFollowOnce.reachedVia..st index 2c3a79f42..404cddc57 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/searchAndFollowOnce.reachedVia..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/searchAndFollowOnce.reachedVia..st @@ -2,4 +2,4 @@ private searchAndFollowOnce: value reachedVia: aReference self searchOnceFor: value ifNew: [:name | self addedObject: value withName: name reachedVia: aReference] - ifFound: [:existing | walk addLeft: existing right: value reachedVia: aReference]. \ No newline at end of file + ifFound: [:existing | self compareLater: existing with: value reachedVia: aReference]. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st index 2c311e8cd..65a003711 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st @@ -4,7 +4,8 @@ startFromLeft: leftStartShadow right: rightStartShadow "The first objects always get a name, so that their diff can be found in the graph diff. If the first objects have different identities, a SquotObjectReplacement is recorded as their diff. Otherwise the references of each pair of encountered object are followed and if the values of the references have been reassigned, diffs are created for the referrers and reference diffs are added to them. If references have been added or removed, this is also added to the diff of the referrers. If a diff is created for a pair of objects, a diff is also created for the pair of referrers, noting that the object referred to has been changed somehow." self initialize. graphDiff left: left; right: right. - walk := SquotGraphComparisonWalk startingFrom: leftStartShadow and: rightStartShadow. + walk := SquotGraphComparisonWalk new. + objectDiffs at: leftStartShadow undecorated put: (walk startFrom: leftStartShadow and: rightStartShadow). self rememberStartObjectNamesLeft: leftStartShadow right: rightStartShadow. self detectStartObjectReplacement: leftStartShadow with: rightStartShadow. walk diff --git a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json index d9e9c4ce3..6e06613e1 100644 --- a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json +++ b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json @@ -2,24 +2,25 @@ "class" : { }, "instance" : { - "addChangesTo:when:reachedFrom:isDifferentFrom:reachedFrom:via:" : "jr 7/25/2021 21:44", + "addChangesTo:when:reachedFrom:isDifferentFrom:reachedFrom:via:" : "jr 7/30/2021 20:27", "addDiffsToGraphDiff" : "jr 7/25/2021 21:15", "addedObject:withName:reachedVia:" : "jr 7/25/2021 20:54", - "compare:reachedFrom:with:reachedFrom:via:" : "jr 7/25/2021 21:59", - "detectStartObjectReplacement:with:" : "jr 7/25/2021 20:08", - "diffFrom:to:ifNew:andInitialize:" : "jr 7/25/2021 20:26", + "compare:reachedFrom:with:reachedFrom:via:" : "jr 7/30/2021 20:27", + "compareLater:with:reachedVia:" : "jr 7/30/2021 20:27", + "detectStartObjectReplacement:with:" : "jr 7/30/2021 19:12", + "diffFrom:to:ifNew:andInitialize:" : "jr 7/30/2021 19:53", "followNewObject:" : "jr 7/25/2021 22:00", "initialize" : "jr 9/30/2017 19:47", "left" : "jr 9/21/2019 21:03", "left:" : "jr 9/21/2019 21:03", "noteChanged:" : "jr 8/15/2017 19:03", - "noteChangedReferrer:via:to:" : "jr 7/27/2017 00:03", + "noteChangedReferrer:via:to:" : "jr 7/30/2021 19:29", "rememberNameOf:" : "jr 11/19/2020 16:36", "rememberNameOf:orAssume:" : "jr 7/21/2017 00:42", "rememberStartObjectNamesLeft:right:" : "jr 7/25/2021 20:06", "right" : "jr 9/21/2019 21:03", "right:" : "jr 9/21/2019 21:03", - "searchAndFollowOnce:reachedVia:" : "jr 7/25/2021 21:59", + "searchAndFollowOnce:reachedVia:" : "jr 7/30/2021 20:28", "searchFor:named:ifNew:ifFound:" : "jr 7/25/2021 22:03", "searchOnceFor:ifNew:ifFound:" : "jr 7/25/2021 21:57", - "startFromLeft:right:" : "jr 7/25/2021 21:15" } } + "startFromLeft:right:" : "jr 7/30/2021 19:16" } } diff --git a/src/Squot.package/SquotDiskProxyMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotDiskProxyMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..57c4782c3 --- /dev/null +++ b/src/Squot.package/SquotDiskProxyMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,5 @@ +comparing +newDiffFrom: aDiskProxyShadow to: aDiskProxyShadow2 + ^ aDiskProxyShadow = aDiskProxyShadow2 + ifTrue: [SquotDiffOfEqualObjects instance] + ifFalse: [self isThisEverCalled. SquotObjectReplacement left: aDiskProxyShadow right: aDiskProxyShadow2] \ No newline at end of file diff --git a/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json b/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json index 0f4524d20..77e94097f 100644 --- a/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json +++ b/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json @@ -3,4 +3,5 @@ }, "instance" : { "capture:with:ifReplaced:" : "jr 7/17/2021 23:57", + "newDiffFrom:to:" : "jr 7/30/2021 19:45", "shouldObjectHaveNameAssigned:" : "jr 4/8/2021 22:05" } } diff --git a/src/Squot.package/SquotDiskProxyShadow.class/instance/squotDiffAgainst.with..st b/src/Squot.package/SquotDiskProxyShadow.class/instance/squotDiffAgainst.with..st index 8bf159940..b9df89fa4 100644 --- a/src/Squot.package/SquotDiskProxyShadow.class/instance/squotDiffAgainst.with..st +++ b/src/Squot.package/SquotDiskProxyShadow.class/instance/squotDiffAgainst.with..st @@ -1,6 +1,7 @@ Squot-shadow-diffing squotDiffAgainst: otherShadow with: aDiffBuilder "If the otherShadow is also a DiskProxy shadow, compare the constructors. Otherwise, exchange the objects." + self deprecated: 'See SquotDiskProxyMirror newDiffFrom:to:'. ^ self = otherShadow ifTrue: [SquotDiffOfEqualObjects instance] ifFalse: [SquotObjectReplacement left: self right: otherShadow] \ No newline at end of file diff --git a/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json b/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json index 1232ba4ff..ae31c4cd9 100644 --- a/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json +++ b/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json @@ -9,6 +9,6 @@ "proxy" : "jr 4/8/2021 22:25", "sameIn:withName:ifAbsent:" : "jr 8/31/2019 20:43", "setDiskProxy:" : "jr 4/8/2021 22:08", - "squotDiffAgainst:with:" : "jr 4/8/2021 22:19", + "squotDiffAgainst:with:" : "jr 7/30/2021 19:50", "squotMaterializeWith:" : "jr 4/8/2021 22:09", "squotOutgoingReferences" : "jr 4/8/2021 22:15" } } diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/class/startingFrom.and..st b/src/Squot.package/SquotGraphComparisonWalk.class/class/startingFrom.and..st deleted file mode 100644 index 7cc0108da..000000000 --- a/src/Squot.package/SquotGraphComparisonWalk.class/class/startingFrom.and..st +++ /dev/null @@ -1,5 +0,0 @@ -instance creation -startingFrom: left and: right - ^ self new - startFrom: left and: right; - yourself \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st index 74ffd2a09..cf183b6bd 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st @@ -2,6 +2,7 @@ enumerating addLeft: nextLeft right: nextRight reachedVia: aReference "Enqueue the pair of nextLeft and nextRight to the walk." "The mirror for nextLeft can be missing if nextRight is now closer to the start object than before." + | diff | (mirrors includesKey: nextLeft undecorated) ifFalse: ["Workaround: use the mirror for nextRight. Since both are supposed to be editions of the same object, they should be of the same kind and so it should be no problem to use the same mirror for them." mirrors at: nextLeft undecorated put: (mirrors at: nextRight undecorated)]. @@ -9,4 +10,6 @@ addLeft: nextLeft right: nextRight reachedVia: aReference assert: (mirrors includesKey: nextRight undecorated). walk add: {nextLeft. nextRight} - reachedVia: aReference. \ No newline at end of file + reachedVia: aReference. + diff := (mirrors at: nextLeft undecorated) newDiffFrom: nextLeft to: nextRight. + ^ diff \ No newline at end of file diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/startFrom.and..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/startFrom.and..st index 4ef667d7c..09f98a206 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/instance/startFrom.and..st +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/startFrom.and..st @@ -1,5 +1,8 @@ initialize-release startFrom: leftObject and: rightObject + | diff | walk addFirst: {leftObject. rightObject}. mirrors at: leftObject undecorated put: (thisContext objectClass: leftObject undecorated) squotMirror. - mirrors at: rightObject undecorated put: (thisContext objectClass: rightObject undecorated) squotMirror. \ No newline at end of file + mirrors at: rightObject undecorated put: (thisContext objectClass: rightObject undecorated) squotMirror. + diff := (mirrors at: leftObject undecorated) newDiffFrom: leftObject to: rightObject. + ^ diff diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json index 7bbb0d95b..048ce7aac 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json +++ b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json @@ -1,8 +1,8 @@ { "class" : { - "startingFrom:and:" : "jr 12/20/2020 21:48" }, + }, "instance" : { - "addLeft:right:reachedVia:" : "jr 7/18/2021 21:53", + "addLeft:right:reachedVia:" : "jr 7/30/2021 18:58", "addNewObject:reachedVia:" : "jr 7/18/2021 16:19", "checkPathsTo:ifMultiple:" : "jr 7/18/2021 17:05", "do:" : "jr 7/25/2021 21:10", @@ -10,4 +10,4 @@ "followReferencesOfNewObject:do:" : "jr 7/18/2021 20:20", "initialize" : "jr 4/8/2021 13:25", "newObjectsDo:existingObjectsPairsDo:" : "jr 7/25/2021 21:11", - "startFrom:and:" : "jr 7/18/2021 11:39" } } + "startFrom:and:" : "jr 7/30/2021 19:15" } } diff --git a/src/Squot.package/SquotMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..134777439 --- /dev/null +++ b/src/Squot.package/SquotMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,4 @@ +comparing +newDiffFrom: leftObject to: rightObject + "Answer a new instance of a diff suitable to be applied to leftObject." + ^ self subclassResponsibility \ No newline at end of file diff --git a/src/Squot.package/SquotMirror.class/methodProperties.json b/src/Squot.package/SquotMirror.class/methodProperties.json index daafbb559..97ef69f01 100644 --- a/src/Squot.package/SquotMirror.class/methodProperties.json +++ b/src/Squot.package/SquotMirror.class/methodProperties.json @@ -7,6 +7,7 @@ "is:comparableTo:" : "jr 7/18/2021 20:09", "mirrorForReplacement:" : "jr 4/8/2021 20:30", "mirrorOf:reachedVia:from:" : "jr 4/11/2021 20:56", + "newDiffFrom:to:" : "jr 7/30/2021 18:59", "referencesFrom:" : "jr 12/16/2020 00:17", "reflect:of:" : "jr 12/20/2020 22:05", "reflect:of:put:" : "jr 12/24/2020 01:21", diff --git a/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st b/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st index 8690d96f3..b68294bc3 100644 --- a/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st +++ b/src/Squot.package/SquotObjectDiff.class/instance/diff.against.with..st @@ -1,5 +1,6 @@ initialize-release diff: leftObjectShadow against: rightShadow with: aDiffBuilder + self deprecated: 'Use initializeFrom:to: instead'. originalClass := leftObjectShadow originalClass. newClass := rightShadow originalClass. slotChanges := Dictionary new. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiff.class/instance/initializeFrom.to..st b/src/Squot.package/SquotObjectDiff.class/instance/initializeFrom.to..st new file mode 100644 index 000000000..c9cf6fb6d --- /dev/null +++ b/src/Squot.package/SquotObjectDiff.class/instance/initializeFrom.to..st @@ -0,0 +1,5 @@ +initialize-release +initializeFrom: leftObjectShadow to: rightShadow + originalClass := leftObjectShadow originalClass. + newClass := rightShadow originalClass. + slotChanges := Dictionary new. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiff.class/methodProperties.json b/src/Squot.package/SquotObjectDiff.class/methodProperties.json index 36193c55e..404754351 100644 --- a/src/Squot.package/SquotObjectDiff.class/methodProperties.json +++ b/src/Squot.package/SquotObjectDiff.class/methodProperties.json @@ -9,9 +9,10 @@ "applyTo:" : "jr 9/23/2019 23:18", "applyTo:with:" : "jr 7/29/2017 21:29", "diff:against:" : "jr 6/17/2021 00:57", - "diff:against:with:" : "jr 7/25/2021 15:33", + "diff:against:with:" : "jr 7/30/2021 20:21", "diffSlot:withCorrespondingSlotIn:" : "jr 9/16/2019 21:21", "initialize" : "jr 6/17/2021 00:57", + "initializeFrom:to:" : "jr 7/30/2021 19:19", "initializeSquotDiffNodes:with:" : "jr 11/18/2017 22:41", "newSquotDiffNodes" : "jr 11/18/2017 22:29", "postCopy" : "jr 9/9/2017 12:48", diff --git a/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testReplacedObject.st b/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testReplacedObject.st new file mode 100644 index 000000000..6d59e04e5 --- /dev/null +++ b/src/Squot.package/SquotObjectGraphDiffTest.class/instance/testReplacedObject.st @@ -0,0 +1,8 @@ +tests +testReplacedObject + "Capture a ValueHolder whose contents will be proxied." + | holder diff holderDiff | + holder := ValueHolder new contents: (Smalltalk globals bindingOf: #Object); yourself. + diff := self diff: holder againstItselfAfter: [holder contents: (Smalltalk globals bindingOf: #SmallInteger)]. + holderDiff := diff diffForObjectNamed: (objectRegistry nameOf: holder). + self assert: holderDiff squotHasChanges. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json b/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json index 0612f276e..d612e1b0f 100644 --- a/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphDiffTest.class/methodProperties.json @@ -23,5 +23,6 @@ "testObjects" : "jr 9/13/2019 11:19", "testRectangles" : "jr 7/19/2021 00:38", "testReferenceSwap" : "jr 9/13/2019 11:44", + "testReplacedObject" : "jr 7/30/2021 20:02", "testReplacedObject2" : "jr 7/20/2017 16:59", "testSet" : "jr 9/13/2019 11:37" } } diff --git a/src/Squot.package/SquotObjectMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotObjectMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..1188f482c --- /dev/null +++ b/src/Squot.package/SquotObjectMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,5 @@ +comparing +newDiffFrom: anObject to: anObject2 + "Do not create diffs from live objects, only from shadows" + self flag: #stub. "Called during the comparison of SquotTrackedObjectMetadata" + ^ nil \ No newline at end of file diff --git a/src/Squot.package/SquotObjectMirror.class/methodProperties.json b/src/Squot.package/SquotObjectMirror.class/methodProperties.json index 2df30192d..a99ab1770 100644 --- a/src/Squot.package/SquotObjectMirror.class/methodProperties.json +++ b/src/Squot.package/SquotObjectMirror.class/methodProperties.json @@ -8,6 +8,7 @@ "hash" : "jr 12/15/2020 23:33", "initializeSnapshot:of:with:" : "jr 4/8/2021 21:23", "is:comparableTo:" : "jr 7/18/2021 20:13", + "newDiffFrom:to:" : "jr 7/30/2021 20:15", "newShadowObject" : "jr 4/3/2021 20:59", "printOn:" : "jr 4/8/2021 19:34", "referencesFrom:" : "jr 4/8/2021 00:13", diff --git a/src/Squot.package/SquotObjectReplacement.class/instance/initializeFrom.to..st b/src/Squot.package/SquotObjectReplacement.class/instance/initializeFrom.to..st new file mode 100644 index 000000000..fc0dcf1bc --- /dev/null +++ b/src/Squot.package/SquotObjectReplacement.class/instance/initializeFrom.to..st @@ -0,0 +1,3 @@ +initialize-release +initializeFrom: aSquotObjectShadow to: aSquotObjectShadow2 + "Those objects could be anything, so do not attempt to compare them." \ No newline at end of file diff --git a/src/Squot.package/SquotObjectReplacement.class/methodProperties.json b/src/Squot.package/SquotObjectReplacement.class/methodProperties.json index ef944c135..a1c21b0bd 100644 --- a/src/Squot.package/SquotObjectReplacement.class/methodProperties.json +++ b/src/Squot.package/SquotObjectReplacement.class/methodProperties.json @@ -7,6 +7,7 @@ "applyToShadowNamed:inGraph:" : "jr 7/4/2021 18:00", "asSquotConflicts" : "jr 12/20/2020 23:32", "incoming" : "jr 8/4/2019 00:14", + "initializeFrom:to:" : "jr 7/30/2021 19:26", "initializeSquotDiffNodes:with:" : "jr 3/17/2018 14:22", "left" : "jr 6/1/2017 12:44", "left:" : "jr 6/1/2017 12:44", diff --git a/src/Squot.package/SquotObjectShadow.class/instance/squotDiffAgainst.with..st b/src/Squot.package/SquotObjectShadow.class/instance/squotDiffAgainst.with..st index e54e5d89a..1aa753bd3 100644 --- a/src/Squot.package/SquotObjectShadow.class/instance/squotDiffAgainst.with..st +++ b/src/Squot.package/SquotObjectShadow.class/instance/squotDiffAgainst.with..st @@ -1,6 +1,7 @@ comparing squotDiffAgainst: otherShadow with: aDiffBuilder "Answer an object that describes the differences between me and otherShadow." + self deprecated: 'See SquotObjectShadowMirror newDiffFrom:to:'. ^ aDiffBuilder diffFrom: self to: otherShadow ifNew: [self diffClass new] andInitialize: [:diff | diff diff: self against: otherShadow with: aDiffBuilder] \ No newline at end of file diff --git a/src/Squot.package/SquotObjectShadow.class/methodProperties.json b/src/Squot.package/SquotObjectShadow.class/methodProperties.json index 01202f28c..0ab25777b 100644 --- a/src/Squot.package/SquotObjectShadow.class/methodProperties.json +++ b/src/Squot.package/SquotObjectShadow.class/methodProperties.json @@ -34,7 +34,7 @@ "setOriginalClass:capturedClass:" : "jr 1/10/2021 23:45", "slots" : "jr 6/17/2017 23:01", "squotDiffAgainst:" : "jr 9/16/2019 21:45", - "squotDiffAgainst:with:" : "jr 8/15/2017 19:36", + "squotDiffAgainst:with:" : "jr 7/30/2021 19:50", "squotMaterializeWith:" : "jr 7/18/2021 01:04", "squotMergeWith:basedOn:" : "jr 8/29/2019 21:18", "squotOutgoingReferences" : "jr 8/31/2019 19:42", diff --git a/src/Squot.package/SquotObjectShadowMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotObjectShadowMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..a7cdad419 --- /dev/null +++ b/src/Squot.package/SquotObjectShadowMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,3 @@ +comparing +newDiffFrom: aSquotObjectShadow to: aSquotObjectShadow2 + ^ aSquotObjectShadow diffClass new \ No newline at end of file diff --git a/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json b/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json index 56b11d4dd..21024840c 100644 --- a/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json +++ b/src/Squot.package/SquotObjectShadowMirror.class/methodProperties.json @@ -8,6 +8,7 @@ "captureReferences:from:reflectedIn:into:with:" : "jr 4/8/2021 21:23", "hash" : "jr 12/15/2020 23:33", "is:comparableTo:" : "jr 7/18/2021 20:10", + "newDiffFrom:to:" : "jr 7/30/2021 19:18", "newShadowObject" : "jr 4/3/2021 21:00", "referencesFrom:" : "jr 4/10/2021 12:23", "reflectIndexableField:in:" : "jr 4/10/2021 16:15", diff --git a/src/Squot.package/SquotOpaqueValueMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotOpaqueValueMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..a662a1feb --- /dev/null +++ b/src/Squot.package/SquotOpaqueValueMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,4 @@ +comparing +newDiffFrom: aSquotPrimitiveValue to: aSquotPrimitiveValue2 + "Usually called for two equal primitive values and it is later determined that there is no difference to be recorded." + ^ SquotDiffOfEqualObjects instance \ No newline at end of file diff --git a/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json b/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json index c58b0812c..637bded3a 100644 --- a/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json +++ b/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json @@ -7,5 +7,6 @@ "capture:with:ifReplaced:" : "jr 7/17/2021 23:58", "hash" : "jr 4/8/2021 20:16", "is:comparableTo:" : "jr 7/18/2021 20:14", + "newDiffFrom:to:" : "jr 7/30/2021 20:38", "referencesFrom:" : "jr 4/8/2021 20:14", "shouldObjectHaveNameAssigned:" : "jr 4/8/2021 20:15" } } diff --git a/src/Squot.package/SquotPackageDiff.class/instance/initializeFrom.to..st b/src/Squot.package/SquotPackageDiff.class/instance/initializeFrom.to..st new file mode 100644 index 000000000..bfb23e339 --- /dev/null +++ b/src/Squot.package/SquotPackageDiff.class/instance/initializeFrom.to..st @@ -0,0 +1,3 @@ +initialize-release +initializeFrom: aSquotPackageShadow to: aSquotPackageShadow2 + "Already done when constructed." \ No newline at end of file diff --git a/src/Squot.package/SquotPackageDiff.class/methodProperties.json b/src/Squot.package/SquotPackageDiff.class/methodProperties.json index 19b97f416..b7a2f6941 100644 --- a/src/Squot.package/SquotPackageDiff.class/methodProperties.json +++ b/src/Squot.package/SquotPackageDiff.class/methodProperties.json @@ -7,6 +7,7 @@ "asSquotConflicts" : "jr 9/25/2019 22:04", "incoming" : "jr 8/14/2019 19:40", "incoming:" : "jr 8/14/2019 19:40", + "initializeFrom:to:" : "jr 7/30/2021 19:35", "initializeSquotDiffNodes:with:" : "jr 11/29/2020 20:29", "left:withSnapshot:right:withSnapshot:" : "jr 9/25/2019 22:29", "newSquotDiffNodes" : "jr 11/29/2020 20:29", diff --git a/src/Squot.package/SquotPackageShadow.class/instance/squotDiffAgainst.with..st b/src/Squot.package/SquotPackageShadow.class/instance/squotDiffAgainst.with..st index fb6f6e27a..ebad59974 100644 --- a/src/Squot.package/SquotPackageShadow.class/instance/squotDiffAgainst.with..st +++ b/src/Squot.package/SquotPackageShadow.class/instance/squotDiffAgainst.with..st @@ -1,5 +1,6 @@ Squot-shadow-diffing squotDiffAgainst: otherPackageShadow with: aDiffBuilder + self deprecated: 'See SquotPackageShadowMirror newDiffFrom:to:'. ^ aDiffBuilder diffFrom: self to: otherPackageShadow ifNew: [otherPackageShadow diffToBase: self withSnapshot: snapshot] andInitialize: [] \ No newline at end of file diff --git a/src/Squot.package/SquotPackageShadow.class/methodProperties.json b/src/Squot.package/SquotPackageShadow.class/methodProperties.json index 72ba3e7bf..4d86c2437 100644 --- a/src/Squot.package/SquotPackageShadow.class/methodProperties.json +++ b/src/Squot.package/SquotPackageShadow.class/methodProperties.json @@ -23,7 +23,7 @@ "setPackageName:snapshot:tonelProperties:" : "jr 12/4/2020 20:22", "snapshot:" : "jr 6/6/2020 01:11", "squotDiffAgainst:" : "jr 9/25/2019 22:24", - "squotDiffAgainst:with:" : "jr 9/25/2019 22:25", + "squotDiffAgainst:with:" : "jr 7/30/2021 19:50", "squotMaterializeWith:" : "jr 12/5/2020 00:12", "squotMergeWith:basedOn:" : "jr 9/25/2019 20:59", "squotOutgoingReferences" : "jr 8/14/2019 18:29", diff --git a/src/Squot.package/SquotPackageShadowMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotPackageShadowMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..28545635d --- /dev/null +++ b/src/Squot.package/SquotPackageShadowMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,3 @@ +comparing +newDiffFrom: aSquotPackageShadow to: aSquotPackageShadow2 + ^ aSquotPackageShadow squotDiffAgainst: aSquotPackageShadow2 \ No newline at end of file diff --git a/src/Squot.package/SquotPackageShadowMirror.class/methodProperties.json b/src/Squot.package/SquotPackageShadowMirror.class/methodProperties.json index cd1c0ae42..400c579c3 100644 --- a/src/Squot.package/SquotPackageShadowMirror.class/methodProperties.json +++ b/src/Squot.package/SquotPackageShadowMirror.class/methodProperties.json @@ -3,5 +3,6 @@ }, "instance" : { "capture:with:ifReplaced:" : "jr 7/17/2021 23:59", + "newDiffFrom:to:" : "jr 7/30/2021 19:35", "referencesFrom:" : "jr 6/16/2021 22:27", "shouldObjectHaveNameAssigned:" : "jr 6/16/2021 22:28" } } diff --git a/src/Squot.package/SquotPrimitiveValue.class/instance/squotDiffAgainst.with..st b/src/Squot.package/SquotPrimitiveValue.class/instance/squotDiffAgainst.with..st index c5898c8a3..979f6ecdc 100644 --- a/src/Squot.package/SquotPrimitiveValue.class/instance/squotDiffAgainst.with..st +++ b/src/Squot.package/SquotPrimitiveValue.class/instance/squotDiffAgainst.with..st @@ -1,4 +1,7 @@ Squot-shadow-diffing squotDiffAgainst: otherContent with: aDiffBuilder "Answer an object that describes the differences between me and otherContent." + self isThisEverCalled: 'Comparison of trivial objects'. + self deprecated: 'See SquotSystemSingletonMirror or SquotOpaqueValueMirror newDiffFrom:to:'. + "It makes no sense to compare trivial objects, since there are no differing editions of them." ^ aDiffBuilder replacing: self with: otherContent \ No newline at end of file diff --git a/src/Squot.package/SquotPrimitiveValue.class/methodProperties.json b/src/Squot.package/SquotPrimitiveValue.class/methodProperties.json index afe3d85c1..cc703e4b1 100644 --- a/src/Squot.package/SquotPrimitiveValue.class/methodProperties.json +++ b/src/Squot.package/SquotPrimitiveValue.class/methodProperties.json @@ -15,7 +15,7 @@ "sameIn:withName:ifAbsent:" : "jr 8/31/2019 20:26", "slots" : "jr 7/15/2017 23:08", "squotDiffAgainst:" : "jr 9/23/2019 20:44", - "squotDiffAgainst:with:" : "jr 6/15/2017 16:51", + "squotDiffAgainst:with:" : "jr 7/30/2021 19:52", "squotMaterializeWith:" : "jr 6/15/2017 16:51", "squotMergeWith:basedOn:" : "jr 9/7/2019 17:58", "squotOutgoingReferences" : "jr 8/31/2019 20:36", diff --git a/src/Squot.package/SquotStringMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotStringMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..98df6bc4a --- /dev/null +++ b/src/Squot.package/SquotStringMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,5 @@ +comparing +newDiffFrom: aString to: aString2 + "Do not create diffs from live objects, only from shadows" + self flag: #stub. "Called during the comparison of SquotTrackedObjectMetadata" + ^ nil \ No newline at end of file diff --git a/src/Squot.package/SquotStringMirror.class/methodProperties.json b/src/Squot.package/SquotStringMirror.class/methodProperties.json index 9ff87e182..3ff8257b8 100644 --- a/src/Squot.package/SquotStringMirror.class/methodProperties.json +++ b/src/Squot.package/SquotStringMirror.class/methodProperties.json @@ -8,6 +8,7 @@ "hash" : "jr 12/15/2020 23:33", "initializeSnapshot:of:with:" : "jr 7/18/2021 00:00", "is:comparableTo:" : "jr 7/18/2021 20:15", + "newDiffFrom:to:" : "jr 7/30/2021 20:15", "newShadowObject" : "jr 7/25/2021 18:46", "referencesFrom:" : "jr 12/16/2020 01:51", "reflectIndexableField:in:" : "jr 12/16/2020 00:04", diff --git a/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st b/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st index 912ed96c5..10c0f5cd7 100644 --- a/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st +++ b/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st @@ -1,8 +1,9 @@ comparing squotDiffAgainst: aTrackedObjectMetadata - | walk diffs | + | walk diff diffs | diffs := Dictionary new. - walk := SquotGraphComparisonWalk startingFrom: self and: aTrackedObjectMetadata. + walk := SquotGraphComparisonWalk new. + diff := walk startFrom: self and: aTrackedObjectMetadata. walk checkPathsTo: self ifMultiple: []; checkPathsTo: aTrackedObjectMetadata ifMultiple: ["Same object." ^ SquotDiffOfEqualObjects instance]. walk do: @@ -18,4 +19,5 @@ squotDiffAgainst: aTrackedObjectMetadata [walk addLeft: leftValue right: rightValue reachedVia: commonPath last]] ifOnlyLeft: [:removed :oldPath | diffs at: oldPath put: (SquotReferenceRemoval of: removed from: left reference: oldPath last rightObject: right)] ifOnlyRight: [:added :newPath | diffs at: newPath put: (SquotReferenceAddition to: left reference: newPath last target: added rightOwner: right)]]. - ^ SquotTrackedObjectMetadataDiff left: self right: aTrackedObjectMetadata diffs: diffs \ No newline at end of file + diff setLeft: self right: aTrackedObjectMetadata diffs: diffs. + ^ diff \ No newline at end of file diff --git a/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json b/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json index f0cc5841a..ccce93d24 100644 --- a/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json +++ b/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json @@ -32,6 +32,6 @@ "serializer:" : "jr 7/16/2017 12:28", "slotOverrideFor:in:ifFound:ifNone:" : "jr 7/16/2017 13:50", "slotOverrides" : "jr 7/16/2017 12:21", - "squotDiffAgainst:" : "jr 7/18/2021 20:23", + "squotDiffAgainst:" : "jr 7/30/2021 19:31", "squotMergeWith:basedOn:" : "jr 7/18/2021 20:23", "updateFrom:" : "jr 12/13/2020 21:51" } } diff --git a/src/Squot.package/SquotTrackedObjectMetadataMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotTrackedObjectMetadataMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..f03b4cc78 --- /dev/null +++ b/src/Squot.package/SquotTrackedObjectMetadataMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,3 @@ +comparing +newDiffFrom: aSquotTrackedObjectMetadata to: aSquotTrackedObjectMetadata2 + ^ SquotTrackedObjectMetadataDiff new \ No newline at end of file diff --git a/src/Squot.package/SquotTrackedObjectMetadataMirror.class/methodProperties.json b/src/Squot.package/SquotTrackedObjectMetadataMirror.class/methodProperties.json index b608bfb19..f655b2ba8 100644 --- a/src/Squot.package/SquotTrackedObjectMetadataMirror.class/methodProperties.json +++ b/src/Squot.package/SquotTrackedObjectMetadataMirror.class/methodProperties.json @@ -4,5 +4,6 @@ "instance" : { "is:comparableTo:" : "jr 7/18/2021 20:12", "mirrorOf:reachedVia:from:" : "jr 4/11/2021 20:46", + "newDiffFrom:to:" : "jr 7/30/2021 19:30", "referencesFrom:" : "jr 4/8/2021 00:51", "reflectElement:of:put:" : "jr 4/8/2021 00:48" } } diff --git a/src/Squot.package/TSquotDiffable.trait/instance/squotDiffAgainst.with..st b/src/Squot.package/TSquotDiffable.trait/instance/squotDiffAgainst.with..st index 659811b88..c0c35f6bb 100644 --- a/src/Squot.package/TSquotDiffable.trait/instance/squotDiffAgainst.with..st +++ b/src/Squot.package/TSquotDiffable.trait/instance/squotDiffAgainst.with..st @@ -1,4 +1,4 @@ Squot-diffing squotDiffAgainst: otherContent with: aDiffBuilder "Answer an object that describes the differences between me and otherContent." - self shouldBeImplemented. \ No newline at end of file + self deprecated: 'Implement newDiffFrom:to: in the SquotMirror of self to create a new diff object. Implement initializeFrom:to: in that diff object. Do not compare objects referenced from self in these methods.' \ No newline at end of file diff --git a/src/Squot.package/TSquotDiffable.trait/methodProperties.json b/src/Squot.package/TSquotDiffable.trait/methodProperties.json index 98c7f6de5..51247603c 100644 --- a/src/Squot.package/TSquotDiffable.trait/methodProperties.json +++ b/src/Squot.package/TSquotDiffable.trait/methodProperties.json @@ -2,4 +2,4 @@ "class" : { }, "instance" : { - "squotDiffAgainst:with:" : "jr 6/17/2017 23:17" } } + "squotDiffAgainst:with:" : "jr 7/30/2021 19:49" } } diff --git a/src/Squot.package/TSquotDiffableShadow.trait/instance/squotDiffAgainst..st b/src/Squot.package/TSquotDiffableShadow.trait/instance/squotDiffAgainst..st deleted file mode 100644 index ab14e7d52..000000000 --- a/src/Squot.package/TSquotDiffableShadow.trait/instance/squotDiffAgainst..st +++ /dev/null @@ -1,5 +0,0 @@ -Squot-shadow-diffing -squotDiffAgainst: otherContent - "Answer an object that describes the differences between me and otherContent." - self isThisEverCalled. - ^ self squotDiffAgainst: otherContent with: SquotDiffBuilder new \ No newline at end of file diff --git a/src/Squot.package/TSquotDiffableShadow.trait/instance/squotDiffAgainst.with..st b/src/Squot.package/TSquotDiffableShadow.trait/instance/squotDiffAgainst.with..st index f9482147b..0aed81690 100644 --- a/src/Squot.package/TSquotDiffableShadow.trait/instance/squotDiffAgainst.with..st +++ b/src/Squot.package/TSquotDiffableShadow.trait/instance/squotDiffAgainst.with..st @@ -1,6 +1,7 @@ Squot-shadow-diffing squotDiffAgainst: otherShadow with: aDiffBuilder "Answer an object that describes the differences between me and otherContent." + self deprecated: 'Implement newDiffFrom:to: in the SquotMirror of self to create a new diff object. Implement initializeFrom:to: in that diff object. Do not compare objects referenced from self in these methods.'. ^ aDiffBuilder diffFrom: self to: otherShadow ifNew: [self shouldBeImplemented] andInitialize: [:diff | self shouldBeImplemented. diff --git a/src/Squot.package/TSquotDiffableShadow.trait/methodProperties.json b/src/Squot.package/TSquotDiffableShadow.trait/methodProperties.json index 814eb93bb..51247603c 100644 --- a/src/Squot.package/TSquotDiffableShadow.trait/methodProperties.json +++ b/src/Squot.package/TSquotDiffableShadow.trait/methodProperties.json @@ -2,5 +2,4 @@ "class" : { }, "instance" : { - "squotDiffAgainst:" : "jr 9/13/2019 10:59", - "squotDiffAgainst:with:" : "jr 10/25/2017 00:07" } } + "squotDiffAgainst:with:" : "jr 7/30/2021 19:49" } } From 822d58cecff9cae8332375bcf5e608d48f0ef7fc Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Fri, 30 Jul 2021 20:49:03 +0200 Subject: [PATCH 25/43] Remove unused variable --- src/Squot.package/SquotDiffBuilder.class/properties.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Squot.package/SquotDiffBuilder.class/properties.json b/src/Squot.package/SquotDiffBuilder.class/properties.json index 8a6a693de..39a6ef0f8 100644 --- a/src/Squot.package/SquotDiffBuilder.class/properties.json +++ b/src/Squot.package/SquotDiffBuilder.class/properties.json @@ -13,7 +13,6 @@ "shadowNames", "toBeVisited", "visited", - "diffedPair", "objectsWithChanges", "referrers", "graphDiff", From 1be24c7b860e0be9967501e87346d8f1620c9a32 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Fri, 30 Jul 2021 20:49:45 +0200 Subject: [PATCH 26/43] SquotGraphWalk is not only used for capturing anymore --- src/Squot.package/SquotGraphWalk.class/properties.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Squot.package/SquotGraphWalk.class/properties.json b/src/Squot.package/SquotGraphWalk.class/properties.json index 114231a90..00253503b 100644 --- a/src/Squot.package/SquotGraphWalk.class/properties.json +++ b/src/Squot.package/SquotGraphWalk.class/properties.json @@ -1,5 +1,5 @@ { - "category" : "Squot-Capturing", + "category" : "Squot-Reflection", "classinstvars" : [ ], "classvars" : [ From b455c3d0ace054b26cfb90b5a83ad4f2c4293721 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Fri, 30 Jul 2021 20:50:31 +0200 Subject: [PATCH 27/43] Use a proper shadow in a dummy shadow graph --- .../instance/testMetadataModification.st | 2 +- .../SquotFileStoreTest.class/methodProperties.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Squot.package/SquotFileStoreTest.class/instance/testMetadataModification.st b/src/Squot.package/SquotFileStoreTest.class/instance/testMetadataModification.st index e9e0c5f99..f2c3f64fd 100644 --- a/src/Squot.package/SquotFileStoreTest.class/instance/testMetadataModification.st +++ b/src/Squot.package/SquotFileStoreTest.class/instance/testMetadataModification.st @@ -8,7 +8,7 @@ testMetadataModification serializer: SquotStonFileCodec. fileStore add: (SquotArtifact new path: 'example'; - content: (SquotShadowGraph new startShadow: true); + content: (SquotShadowGraph new startShadow: true captureWithSquot); storeInfo: metadata; yourself). changed := (fileStore artifactAt: 'example') snapshot copy. diff --git a/src/Squot.package/SquotFileStoreTest.class/methodProperties.json b/src/Squot.package/SquotFileStoreTest.class/methodProperties.json index 8bedc8f88..b38882401 100644 --- a/src/Squot.package/SquotFileStoreTest.class/methodProperties.json +++ b/src/Squot.package/SquotFileStoreTest.class/methodProperties.json @@ -12,7 +12,7 @@ "testDeleteMethod" : "jr 12/3/2019 00:08", "testLazySnapshot" : "jr 10/3/2017 00:36", "testLoadOrderIsPreserved" : "jr 8/18/2018 18:17", - "testMetadataModification" : "jr 12/14/2020 22:56", + "testMetadataModification" : "jr 7/30/2021 20:17", "testPatchDeleteArtifact" : "jr 7/22/2017 02:25", "testPatchDeleteFolderArtifact" : "jr 7/22/2017 02:29", "testPatchDeleteMethod" : "jr 7/22/2017 01:33", From 4fab1d9e5232ed57934d678e048cbce0031b7148 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Fri, 30 Jul 2021 21:03:22 +0200 Subject: [PATCH 28/43] fixup! Split diff creation from diff initialization more thoroughly --- .../instance/squotDiffAgainst..st | 5 ++++- .../SquotBitsObjectShadow.class/methodProperties.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Squot.package/SquotBitsObjectShadow.class/instance/squotDiffAgainst..st b/src/Squot.package/SquotBitsObjectShadow.class/instance/squotDiffAgainst..st index adcc1243a..abbf77714 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/instance/squotDiffAgainst..st +++ b/src/Squot.package/SquotBitsObjectShadow.class/instance/squotDiffAgainst..st @@ -1,3 +1,6 @@ Squot-shadow-diffing squotDiffAgainst: otherShadow - ^ (otherShadow ifNil: [value class new: 0]) squotWith: nil diffFromSequence: value \ No newline at end of file + ^ GenericDiff squotDiffClass new + file1: value; + file2: (otherShadow value ifNil: [value class new: 0]); + yourself \ No newline at end of file diff --git a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json index bcc0b60fd..0b3b1c80f 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json +++ b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json @@ -12,7 +12,7 @@ "privateApplySequenceDiff:with:" : "jr 10/24/2017 23:42", "references" : "jr 7/25/2021 19:34", "sameIn:withName:ifAbsent:" : "jr 9/6/2019 22:33", - "squotDiffAgainst:" : "jr 6/27/2017 17:02", + "squotDiffAgainst:" : "jr 7/30/2021 19:39", "squotDiffAgainst:with:" : "jr 7/30/2021 19:51", "squotMaterializeWith:" : "jr 6/27/2017 17:03", "squotPreferredSerializer" : "jr 9/20/2017 19:40", From 09164b5fbc29389d20579d8b91f0e16768e42090 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Fri, 30 Jul 2021 21:18:58 +0200 Subject: [PATCH 29/43] Capture BoxedFloat64 as opaque value on 32 bit systems --- .../BoxedFloat64.extension/class/squotMirror.st | 3 +++ .../BoxedFloat64.extension/methodProperties.json | 5 +++++ src/Squot.package/BoxedFloat64.extension/properties.json | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 src/Squot.package/BoxedFloat64.extension/class/squotMirror.st create mode 100644 src/Squot.package/BoxedFloat64.extension/methodProperties.json create mode 100644 src/Squot.package/BoxedFloat64.extension/properties.json diff --git a/src/Squot.package/BoxedFloat64.extension/class/squotMirror.st b/src/Squot.package/BoxedFloat64.extension/class/squotMirror.st new file mode 100644 index 000000000..3e3a5fb0e --- /dev/null +++ b/src/Squot.package/BoxedFloat64.extension/class/squotMirror.st @@ -0,0 +1,3 @@ +*Squot-trackable +squotMirror + ^ SquotOpaqueValueMirror new \ No newline at end of file diff --git a/src/Squot.package/BoxedFloat64.extension/methodProperties.json b/src/Squot.package/BoxedFloat64.extension/methodProperties.json new file mode 100644 index 000000000..62c2e0579 --- /dev/null +++ b/src/Squot.package/BoxedFloat64.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + "squotMirror" : "jr 7/30/2021 21:17" }, + "instance" : { + } } diff --git a/src/Squot.package/BoxedFloat64.extension/properties.json b/src/Squot.package/BoxedFloat64.extension/properties.json new file mode 100644 index 000000000..b3ba4bdb0 --- /dev/null +++ b/src/Squot.package/BoxedFloat64.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "BoxedFloat64" } From 9e796be5a476067a2d45f9aeec138879668689c0 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sat, 31 Jul 2021 16:18:30 +0200 Subject: [PATCH 30/43] More helpful Inspector for object diff It shows what happens to the slots. The print string that shows whether something is reassigned, added, or removed is not visible in the column view of the ObjectExplorer. That is because the slot diffs are the Associations of the slotDiffs dictionary. --- .../instance/inspectorClass.st | 3 +++ .../SquotObjectDiff.class/methodProperties.json | 1 + .../SquotObjectDiffInspector.class/README.md | 0 .../instance/fieldForReferenceDiff..st | 6 ++++++ .../instance/streamFieldsOn..st | 5 +++++ .../methodProperties.json | 6 ++++++ .../SquotObjectDiffInspector.class/properties.json | 14 ++++++++++++++ src/Squot.package/monticello.meta/categories.st | 1 + 8 files changed, 36 insertions(+) create mode 100644 src/Squot.package/SquotObjectDiff.class/instance/inspectorClass.st create mode 100644 src/Squot.package/SquotObjectDiffInspector.class/README.md create mode 100644 src/Squot.package/SquotObjectDiffInspector.class/instance/fieldForReferenceDiff..st create mode 100644 src/Squot.package/SquotObjectDiffInspector.class/instance/streamFieldsOn..st create mode 100644 src/Squot.package/SquotObjectDiffInspector.class/methodProperties.json create mode 100644 src/Squot.package/SquotObjectDiffInspector.class/properties.json diff --git a/src/Squot.package/SquotObjectDiff.class/instance/inspectorClass.st b/src/Squot.package/SquotObjectDiff.class/instance/inspectorClass.st new file mode 100644 index 000000000..2cbf7d579 --- /dev/null +++ b/src/Squot.package/SquotObjectDiff.class/instance/inspectorClass.st @@ -0,0 +1,3 @@ +*Squot-Dev-Tools +inspectorClass + ^ SquotObjectDiffInspector \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiff.class/methodProperties.json b/src/Squot.package/SquotObjectDiff.class/methodProperties.json index 404754351..ef1534ee1 100644 --- a/src/Squot.package/SquotObjectDiff.class/methodProperties.json +++ b/src/Squot.package/SquotObjectDiff.class/methodProperties.json @@ -14,6 +14,7 @@ "initialize" : "jr 6/17/2021 00:57", "initializeFrom:to:" : "jr 7/30/2021 19:19", "initializeSquotDiffNodes:with:" : "jr 11/18/2017 22:41", + "inspectorClass" : "jr 7/30/2021 21:44", "newSquotDiffNodes" : "jr 11/18/2017 22:29", "postCopy" : "jr 9/9/2017 12:48", "printOn:" : "jr 6/25/2017 14:49", diff --git a/src/Squot.package/SquotObjectDiffInspector.class/README.md b/src/Squot.package/SquotObjectDiffInspector.class/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/Squot.package/SquotObjectDiffInspector.class/instance/fieldForReferenceDiff..st b/src/Squot.package/SquotObjectDiffInspector.class/instance/fieldForReferenceDiff..st new file mode 100644 index 000000000..97aa20f2a --- /dev/null +++ b/src/Squot.package/SquotObjectDiffInspector.class/instance/fieldForReferenceDiff..st @@ -0,0 +1,6 @@ +as yet unclassified +fieldForReferenceDiff: aReferenceDiff + ^ (self newFieldForType: #diff key: aReferenceDiff) + name: aReferenceDiff asString; + valueGetter: [:diff | aReferenceDiff]; + yourself \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiffInspector.class/instance/streamFieldsOn..st b/src/Squot.package/SquotObjectDiffInspector.class/instance/streamFieldsOn..st new file mode 100644 index 000000000..09dcf3bc2 --- /dev/null +++ b/src/Squot.package/SquotObjectDiffInspector.class/instance/streamFieldsOn..st @@ -0,0 +1,5 @@ +as yet unclassified +streamFieldsOn: aStream + super streamFieldsOn: aStream. + self object referenceDiffsWithDefaultOwners: {nil. nil} reflectedIn: SquotSystemSingletonMirror new + do: [:each | aStream nextPut: (self fieldForReferenceDiff: each)]. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectDiffInspector.class/methodProperties.json b/src/Squot.package/SquotObjectDiffInspector.class/methodProperties.json new file mode 100644 index 000000000..4b8025b54 --- /dev/null +++ b/src/Squot.package/SquotObjectDiffInspector.class/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "fieldForReferenceDiff:" : "jr 7/30/2021 22:24", + "streamFieldsOn:" : "jr 7/30/2021 22:28" } } diff --git a/src/Squot.package/SquotObjectDiffInspector.class/properties.json b/src/Squot.package/SquotObjectDiffInspector.class/properties.json new file mode 100644 index 000000000..7a0aae8a3 --- /dev/null +++ b/src/Squot.package/SquotObjectDiffInspector.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Squot-Dev-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "SquotObjectDiffInspector", + "pools" : [ + ], + "super" : "Inspector", + "type" : "normal" } diff --git a/src/Squot.package/monticello.meta/categories.st b/src/Squot.package/monticello.meta/categories.st index 397ed1a8d..ffdd1aee2 100644 --- a/src/Squot.package/monticello.meta/categories.st +++ b/src/Squot.package/monticello.meta/categories.st @@ -18,6 +18,7 @@ SystemOrganization addCategory: #'Squot-Serialization-Cypress'! SystemOrganization addCategory: #'Squot-Tools'! SystemOrganization addCategory: #'Squot-Tools-Packages'! SystemOrganization addCategory: #'Squot-Tools-Support'! +SystemOrganization addCategory: #'Squot-Dev-Tools'! SystemOrganization addCategory: #'Squot-Monticello-Converter'! SystemOrganization addCategory: #'Squot-Deprecated'! SystemOrganization addCategory: #'Squot-Tests'! From 88843497a9369c088f55eb7955b2bba66286fb4f Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sat, 31 Jul 2021 16:23:36 +0200 Subject: [PATCH 31/43] WIP: Prevent earlier that the same object is walked by twice when comparing There are some issues with the equality comparison: the = message gets dispatched through the SqoutNameDecorator, which answers true if the two objects have the same name. This is not what we want here. ~= is not implemented by the decorator, and thus gets forwarded to the decorated object. The other side of the comparison is not undecorated though, so this does not work as intended yet. Undecorate objects before checking whether they have been reached before. Otherwise an object could be walked by again if it appears decorated in one place and undecorated in another place of the graph. --- ...sTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st | 2 +- .../instance/searchOnceFor.ifNew.ifFound..st | 2 +- .../SquotDiffBuilder.class/instance/startFromLeft.right..st | 1 + .../SquotDiffBuilder.class/methodProperties.json | 6 +++--- .../instance/addLeft.right.reachedVia..st | 1 + .../SquotGraphComparisonWalk.class/methodProperties.json | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st b/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st index 83515b731..cc864b861 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/addChangesTo.when.reachedFrom.isDifferentFrom.reachedFrom.via..st @@ -8,7 +8,7 @@ addChangesTo: diff when: leftValue reachedFrom: leftShadow isDifferentFrom: righ ifTrue: "The reference itself did not change, but we might later find out that the value has some differences." [| alreadyVisited | alreadyVisited := false. - walk checkPathsTo: leftValue ifMultiple: [alreadyVisited := true]. + walk checkPathsTo: leftValue undecorated ifMultiple: [alreadyVisited := true]. alreadyVisited ifTrue: [(objectsWithChanges includes: leftValue undecorated) diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/searchOnceFor.ifNew.ifFound..st b/src/Squot.package/SquotDiffBuilder.class/instance/searchOnceFor.ifNew.ifFound..st index 8fce01017..cd4b069a3 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/searchOnceFor.ifNew.ifFound..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/searchOnceFor.ifNew.ifFound..st @@ -1,7 +1,7 @@ private searchOnceFor: value ifNew: newBlock ifFound: foundBlock | name | - walk checkPathsTo: value ifMultiple: [^ self]. + walk checkPathsTo: value undecorated ifMultiple: [^ self]. name := self rememberNameOf: value. self searchFor: value named: name ifNew: [newBlock value: name] diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st b/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st index 65a003711..dc9372ae1 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/startFromLeft.right..st @@ -6,6 +6,7 @@ startFromLeft: leftStartShadow right: rightStartShadow graphDiff left: left; right: right. walk := SquotGraphComparisonWalk new. objectDiffs at: leftStartShadow undecorated put: (walk startFrom: leftStartShadow and: rightStartShadow). + walk checkPathsTo: leftStartShadow undecorated ifMultiple: []. "Make sure the leftStartShadow is not compared multiple times." self rememberStartObjectNamesLeft: leftStartShadow right: rightStartShadow. self detectStartObjectReplacement: leftStartShadow with: rightStartShadow. walk diff --git a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json index 6e06613e1..5acb7c9bf 100644 --- a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json +++ b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "addChangesTo:when:reachedFrom:isDifferentFrom:reachedFrom:via:" : "jr 7/30/2021 20:27", + "addChangesTo:when:reachedFrom:isDifferentFrom:reachedFrom:via:" : "jr 7/30/2021 21:37", "addDiffsToGraphDiff" : "jr 7/25/2021 21:15", "addedObject:withName:reachedVia:" : "jr 7/25/2021 20:54", "compare:reachedFrom:with:reachedFrom:via:" : "jr 7/30/2021 20:27", @@ -22,5 +22,5 @@ "right:" : "jr 9/21/2019 21:03", "searchAndFollowOnce:reachedVia:" : "jr 7/30/2021 20:28", "searchFor:named:ifNew:ifFound:" : "jr 7/25/2021 22:03", - "searchOnceFor:ifNew:ifFound:" : "jr 7/25/2021 21:57", - "startFromLeft:right:" : "jr 7/30/2021 19:16" } } + "searchOnceFor:ifNew:ifFound:" : "jr 7/30/2021 21:37", + "startFromLeft:right:" : "jr 7/30/2021 21:37" } } diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st index cf183b6bd..37f6ec442 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st @@ -3,6 +3,7 @@ addLeft: nextLeft right: nextRight reachedVia: aReference "Enqueue the pair of nextLeft and nextRight to the walk." "The mirror for nextLeft can be missing if nextRight is now closer to the start object than before." | diff | + nextLeft ~= nextRight ifFalse: "Nothing to be compared" [^ SquotDiffOfEqualObjects instance]. (mirrors includesKey: nextLeft undecorated) ifFalse: ["Workaround: use the mirror for nextRight. Since both are supposed to be editions of the same object, they should be of the same kind and so it should be no problem to use the same mirror for them." mirrors at: nextLeft undecorated put: (mirrors at: nextRight undecorated)]. diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json index 048ce7aac..d111e4a2c 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json +++ b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "addLeft:right:reachedVia:" : "jr 7/30/2021 18:58", + "addLeft:right:reachedVia:" : "jr 7/30/2021 22:34", "addNewObject:reachedVia:" : "jr 7/18/2021 16:19", "checkPathsTo:ifMultiple:" : "jr 7/18/2021 17:05", "do:" : "jr 7/25/2021 21:10", From acbaf87f8a7e2156cc2ff2a1ba8e836586cd5842 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sat, 31 Jul 2021 16:26:27 +0200 Subject: [PATCH 32/43] Refine tests for consistent shadow graph patching Issues appear again in testTrackingText for the in-memory repository. An object that did not change at all still gets another shadow in the newly captured graph, but the dictionary for the names does not get to know the new shadow (that is equal to the previous one). Move patching from setUp into the test methods because otherwise one cannot debug the patching by debugging the test from the browser. --- .../instance/expectedFailures.st | 2 +- .../instance/patchGraph.st | 11 +++++++++++ .../instance/patched.asIn..st | 2 +- .../instance/setUp.st | 8 +------- .../instance/testPatchesShadowsCorrectly.st | 1 + .../testUpdatesNameMappingConsistently.st | 16 ++++++++++++++++ .../testUpdatesReferencesOfChangedShadows.st | 1 + .../methodProperties.json | 12 +++++++----- .../properties.json | 1 + 9 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 src/Squot.package/SquotShadowPatchingTest.class/instance/patchGraph.st create mode 100644 src/Squot.package/SquotShadowPatchingTest.class/instance/testUpdatesNameMappingConsistently.st diff --git a/src/Squot.package/SquotShadowPatchingTest.class/instance/expectedFailures.st b/src/Squot.package/SquotShadowPatchingTest.class/instance/expectedFailures.st index bc764ad87..b4416ea7b 100644 --- a/src/Squot.package/SquotShadowPatchingTest.class/instance/expectedFailures.st +++ b/src/Squot.package/SquotShadowPatchingTest.class/instance/expectedFailures.st @@ -1,3 +1,3 @@ tests expectedFailures - ^ #(testUpdatesReferencesOfChangedShadows "not implemented yet") \ No newline at end of file + ^ #("testUpdatesReferencesOfChangedShadows" "testUpdatesNameMappingConsistently" "not implemented yet") \ No newline at end of file diff --git a/src/Squot.package/SquotShadowPatchingTest.class/instance/patchGraph.st b/src/Squot.package/SquotShadowPatchingTest.class/instance/patchGraph.st new file mode 100644 index 000000000..030175ca0 --- /dev/null +++ b/src/Squot.package/SquotShadowPatchingTest.class/instance/patchGraph.st @@ -0,0 +1,11 @@ +tests +patchGraph + | source | + sharedObject := ValueHolder new contents: 1; yourself. + source := Array with: sharedObject with: (Array with: sharedObject) with: Array new. + patchedGraph := self patched: source asIn: + [sharedObject contents: 2. + source at: 3 put: (Array with: (source at: 3))]. + nameOfSharedObject := objectRegistry nameOf: sharedObject. + patchedShadowOfSharedObject := patchedGraph shadowNamed: nameOfSharedObject. + ^ patchedGraph \ No newline at end of file diff --git a/src/Squot.package/SquotShadowPatchingTest.class/instance/patched.asIn..st b/src/Squot.package/SquotShadowPatchingTest.class/instance/patched.asIn..st index d255d1fc2..11aa3f69d 100644 --- a/src/Squot.package/SquotShadowPatchingTest.class/instance/patched.asIn..st +++ b/src/Squot.package/SquotShadowPatchingTest.class/instance/patched.asIn..st @@ -1,6 +1,6 @@ tests patched: anObject asIn: aBlock - | diff patched originalGraph changedGraph | + | patched originalGraph changedGraph | originalGraph := (capturer captureGraph: anObject) asShadowGraph. aBlock value. changedGraph := (capturer captureGraph: anObject) asShadowGraph. diff --git a/src/Squot.package/SquotShadowPatchingTest.class/instance/setUp.st b/src/Squot.package/SquotShadowPatchingTest.class/instance/setUp.st index 761cca6a2..29e271998 100644 --- a/src/Squot.package/SquotShadowPatchingTest.class/instance/setUp.st +++ b/src/Squot.package/SquotShadowPatchingTest.class/instance/setUp.st @@ -1,11 +1,5 @@ running setUp - | source | capturer := SquotObjectCapturer new. objectRegistry := SquotObjectRegistry new. - capturer registry: objectRegistry. - sharedObject := ValueHolder new contents: 1; yourself. - source := Array with: sharedObject with: (Array with: sharedObject). - patchedGraph := self patched: source asIn: [sharedObject contents: 2]. - nameOfSharedObject := objectRegistry nameOf: sharedObject. - patchedShadowOfSharedObject := patchedGraph shadowNamed: nameOfSharedObject. \ No newline at end of file + capturer registry: objectRegistry. \ No newline at end of file diff --git a/src/Squot.package/SquotShadowPatchingTest.class/instance/testPatchesShadowsCorrectly.st b/src/Squot.package/SquotShadowPatchingTest.class/instance/testPatchesShadowsCorrectly.st index 536407da3..dfced73a3 100644 --- a/src/Squot.package/SquotShadowPatchingTest.class/instance/testPatchesShadowsCorrectly.st +++ b/src/Squot.package/SquotShadowPatchingTest.class/instance/testPatchesShadowsCorrectly.st @@ -1,5 +1,6 @@ tests testPatchesShadowsCorrectly + self patchGraph. self assert: ((patchedGraph shadowNamed: (objectRegistry nameOf: sharedObject)) slots at: 'contents') = 2 captureWithSquot diff --git a/src/Squot.package/SquotShadowPatchingTest.class/instance/testUpdatesNameMappingConsistently.st b/src/Squot.package/SquotShadowPatchingTest.class/instance/testUpdatesNameMappingConsistently.st new file mode 100644 index 000000000..fb43381a4 --- /dev/null +++ b/src/Squot.package/SquotShadowPatchingTest.class/instance/testUpdatesNameMappingConsistently.st @@ -0,0 +1,16 @@ +tests +testUpdatesNameMappingConsistently + | unchangedArray original name decoratorName | + self patchGraph. + unchangedArray := (patchedGraph startShadow slots at: 3) slots at: 1. + original := diff left startShadow slots at: 3. + name := diff left nameOf: original undecorated. + decoratorName := unchangedArray name. + self assert: (patchedGraph shadowNamed: name) == unchangedArray undecorated + description: 'name mapping should be consistent with graph'; + assert: (patchedGraph shadowNamed: decoratorName) == unchangedArray undecorated + description: 'decorated objects should be retrievable by name'; + assert: (patchedGraph nameOf: unchangedArray undecorated ifAbsent: []) notNil + description: 'must be possible to look up the name of a reached object'; + assert: decoratorName equals: (patchedGraph nameOf: unchangedArray undecorated ifAbsent: []) + description: 'names should be consistent with the decoration'. \ No newline at end of file diff --git a/src/Squot.package/SquotShadowPatchingTest.class/instance/testUpdatesReferencesOfChangedShadows.st b/src/Squot.package/SquotShadowPatchingTest.class/instance/testUpdatesReferencesOfChangedShadows.st index 81f63a7a1..7f708d254 100644 --- a/src/Squot.package/SquotShadowPatchingTest.class/instance/testUpdatesReferencesOfChangedShadows.st +++ b/src/Squot.package/SquotShadowPatchingTest.class/instance/testUpdatesReferencesOfChangedShadows.st @@ -1,5 +1,6 @@ tests testUpdatesReferencesOfChangedShadows + self patchGraph. self assert: (patchedGraph startShadow slots at: 1) value undecorated == patchedShadowOfSharedObject diff --git a/src/Squot.package/SquotShadowPatchingTest.class/methodProperties.json b/src/Squot.package/SquotShadowPatchingTest.class/methodProperties.json index 7359ac767..12abe7dc8 100644 --- a/src/Squot.package/SquotShadowPatchingTest.class/methodProperties.json +++ b/src/Squot.package/SquotShadowPatchingTest.class/methodProperties.json @@ -2,8 +2,10 @@ "class" : { }, "instance" : { - "expectedFailures" : "jr 9/23/2019 18:52", - "patched:asIn:" : "jr 9/23/2019 23:35", - "setUp" : "jr 9/23/2019 23:45", - "testPatchesShadowsCorrectly" : "jr 9/23/2019 23:44", - "testUpdatesReferencesOfChangedShadows" : "jr 9/23/2019 23:45" } } + "expectedFailures" : "jr 7/31/2021 16:14", + "patchGraph" : "jr 7/31/2021 16:03", + "patched:asIn:" : "jr 7/31/2021 15:48", + "setUp" : "jr 7/31/2021 16:01", + "testPatchesShadowsCorrectly" : "jr 7/31/2021 16:02", + "testUpdatesNameMappingConsistently" : "jr 7/31/2021 16:13", + "testUpdatesReferencesOfChangedShadows" : "jr 7/31/2021 16:02" } } diff --git a/src/Squot.package/SquotShadowPatchingTest.class/properties.json b/src/Squot.package/SquotShadowPatchingTest.class/properties.json index 403888f4f..38ebfb8bf 100644 --- a/src/Squot.package/SquotShadowPatchingTest.class/properties.json +++ b/src/Squot.package/SquotShadowPatchingTest.class/properties.json @@ -10,6 +10,7 @@ "objectRegistry", "materializedObject", "sharedObject", + "diff", "patchedGraph", "nameOfSharedObject", "patchedShadowOfSharedObject" ], From e41ca35c8af25bb09597e00c714d54f215b1f3f4 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 8 Aug 2021 16:38:53 +0200 Subject: [PATCH 33/43] Patched object graphs are still inconsistent After saving the changed Text in testTrackingText, when merging the working copy with the actually saved snapshot to get back any metadata changes effected by the repository, the "incoming" object graph (i. e. that of the saved version) is inconsistent because these two pseudo-expressions have different results: - graph startShadow runs values at: 1 - graph shadowNamed: (graph nameOf: (startShadow runs values at: 1)) Both answer a shadow of an Array and these are equal, but not the same. Thus, when computing the diff between the Snapshot to be saved to the actually saved Version, the lookup of the name of that Array fails in the incoming object graph. An addition for the Array gets recorded where there should be none. Funnily enough, this later leads to a "should not add merges without changes" assertion failure. For future reference: - The snapshot captured from the live object prior to saving is consistent. - The base snapshot (from the previous version) is consistent. - The right side of the patch used for saving is consistent. - The snapshot that results from applying the patch to the snapshot of the parent version is inconsistent. For in-memory repos this error stays in the snapshot of the version. - The RunArray in `runs` is a new one, thus it gets assigned to the Text shadow, which also makes that shadow refer indirectly to all the shadows referenced by the RunArray shadow. There is also an ObjectAddition for the RunArray shadow, which updates the name mapping in the patched graph. - The runs values Array is also new. It therefore also has an addition and the name mapping gets updated. - But the runs values at: 1 Array is still the same, thus there is no object addition for it in the graph diff. Thus, nothing updates the mapping of its name, and the destination graph will still resolve the name to the old shadow. But the new RunArray shadow refers indirectly to an equal shadow that is not the same. Thus the graph will fail to look up the name of the Array in runs values at: 1 later. We could avoid the problem by not applying the diffs to the shadows again, but rather just use the right side of the already computed patch. Unfortunately there is one piece of code where a patch is created without a right side: SquotObjectGraphMerge privateResolvedPatch. And since merging currently is mix-and-matching of two changesets, this would be a place were the patching of shadow graphs would be somehow required anyway; so it does not allow us to ignore the problem forever. --- .../instance/expectedFailures.st | 6 ++++++ .../methodProperties.json | 1 + .../instance/squotApplyTo..st | 12 +++++++++--- .../SquotObjectGraphDiff.class/methodProperties.json | 2 +- .../instance/expectedFailures.st | 2 +- .../methodProperties.json | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st diff --git a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st new file mode 100644 index 000000000..bdb7f1a0c --- /dev/null +++ b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st @@ -0,0 +1,6 @@ +failures +expectedFailures + | bugs | + bugs := #(testTrackingText "Because patched object graphs are inconsistent: the list of object names does not use the same instances as the referenced objects."). + bugs flag: #todo. "Fix them" + ^ super expectedFailures, bugs \ No newline at end of file diff --git a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json index 217feabd2..8e52995f8 100644 --- a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json +++ b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json @@ -2,6 +2,7 @@ "class" : { }, "instance" : { + "expectedFailures" : "jr 7/17/2021 21:57", "newRepository" : "jr 2/4/2017 01:58", "testImmutabilityOfSnapshots" : "jr 1/26/2020 22:58", "testVersionsDoNotContainWorkingCopyArtifacts" : "jr 11/18/2020 21:35" } } diff --git a/src/Squot.package/SquotObjectGraphDiff.class/instance/squotApplyTo..st b/src/Squot.package/SquotObjectGraphDiff.class/instance/squotApplyTo..st index ade7191d0..74ea54664 100644 --- a/src/Squot.package/SquotObjectGraphDiff.class/instance/squotApplyTo..st +++ b/src/Squot.package/SquotObjectGraphDiff.class/instance/squotApplyTo..st @@ -1,9 +1,15 @@ Squot-diff-patching squotApplyTo: anObjectGraph - | newGraph | + | newGraph oldImplementation newImplementation | self hasChanges ifFalse: [^ anObjectGraph]. newGraph := anObjectGraph mutableCopy. - diffs keysAndValuesDo: - [:name :diff | newGraph applyDiff: diff toShadowNamed: name]. + oldImplementation := + [diffs keysAndValuesDo: + [:name :diff | newGraph applyDiff: diff toShadowNamed: name]]. + newImplementation := "Does not work until object graph merges compute the right side of the resolved patch by themselves. Moreover it touches all remaining objects rather than just the changed ones and their referrers." + [right shadows + do: [:each | newGraph assign: (right nameOf: each) toShadow: each]. + newGraph evictObjectNames]. + oldImplementation value flag: #todo. newGraph refreshStartShadow. ^ newGraph asShadowGraph \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphDiff.class/methodProperties.json b/src/Squot.package/SquotObjectGraphDiff.class/methodProperties.json index 174dd8e91..1b219f9bf 100644 --- a/src/Squot.package/SquotObjectGraphDiff.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphDiff.class/methodProperties.json @@ -24,7 +24,7 @@ "right" : "jr 9/21/2019 22:34", "right:" : "jr 9/21/2019 22:34", "roots" : "jr 6/20/2021 23:12", - "squotApplyTo:" : "jr 12/13/2020 16:20", + "squotApplyTo:" : "jr 8/8/2021 15:19", "squotApplyToLoaded:" : "jr 7/17/2021 02:11", "squotChangeAsStringOrText" : "jr 11/25/2020 21:15", "squotHasChanges" : "jr 6/22/2017 14:03", diff --git a/src/Squot.package/SquotShadowPatchingTest.class/instance/expectedFailures.st b/src/Squot.package/SquotShadowPatchingTest.class/instance/expectedFailures.st index b4416ea7b..de5778bee 100644 --- a/src/Squot.package/SquotShadowPatchingTest.class/instance/expectedFailures.st +++ b/src/Squot.package/SquotShadowPatchingTest.class/instance/expectedFailures.st @@ -1,3 +1,3 @@ tests expectedFailures - ^ #("testUpdatesReferencesOfChangedShadows" "testUpdatesNameMappingConsistently" "not implemented yet") \ No newline at end of file + ^ #(testUpdatesReferencesOfChangedShadows testUpdatesNameMappingConsistently "not implemented yet") \ No newline at end of file diff --git a/src/Squot.package/SquotShadowPatchingTest.class/methodProperties.json b/src/Squot.package/SquotShadowPatchingTest.class/methodProperties.json index 12abe7dc8..7a0f3a7e7 100644 --- a/src/Squot.package/SquotShadowPatchingTest.class/methodProperties.json +++ b/src/Squot.package/SquotShadowPatchingTest.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "expectedFailures" : "jr 7/31/2021 16:14", + "expectedFailures" : "jr 8/8/2021 15:21", "patchGraph" : "jr 7/31/2021 16:03", "patched:asIn:" : "jr 7/31/2021 15:48", "setUp" : "jr 7/31/2021 16:01", From e50a58eff80d2e208a0f293979564994c59dc9ab Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 8 Aug 2021 16:58:40 +0200 Subject: [PATCH 34/43] Fix comparison errors due to the = of SquotNameDecorator Let the senders of addLeft:right:reachedVia: decide whether or not to use this optimization, so if it turns out to be incorrect in some cases, the = comparison can possibly be skipped. This happens to fix testTrackedText again for practical reasons, but the issue with inconsistent object graphs after patching still persists. --- .../instance/compareLater.with.reachedVia..st | 1 + src/Squot.package/SquotDiffBuilder.class/methodProperties.json | 2 +- .../instance/addLeft.right.reachedVia..st | 3 +-- .../SquotGraphComparisonWalk.class/methodProperties.json | 2 +- .../instance/expectedFailures.st | 2 +- .../methodProperties.json | 2 +- .../instance/squotDiffAgainst..st | 3 ++- .../SquotTrackedObjectMetadata.class/methodProperties.json | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st b/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st index 65047937c..f42760fcd 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st @@ -1,5 +1,6 @@ private compareLater: leftValue with: rightValue reachedVia: aReference | newDiff | + leftValue undecorated = rightValue undecorated ifTrue: [^ self]. newDiff := walk addLeft: leftValue right: rightValue reachedVia: aReference. objectDiffs at: leftValue undecorated put: newDiff. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json index 5acb7c9bf..58dec035c 100644 --- a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json +++ b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json @@ -6,7 +6,7 @@ "addDiffsToGraphDiff" : "jr 7/25/2021 21:15", "addedObject:withName:reachedVia:" : "jr 7/25/2021 20:54", "compare:reachedFrom:with:reachedFrom:via:" : "jr 7/30/2021 20:27", - "compareLater:with:reachedVia:" : "jr 7/30/2021 20:27", + "compareLater:with:reachedVia:" : "jr 8/8/2021 16:53", "detectStartObjectReplacement:with:" : "jr 7/30/2021 19:12", "diffFrom:to:ifNew:andInitialize:" : "jr 7/30/2021 19:53", "followNewObject:" : "jr 7/25/2021 22:00", diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st b/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st index 37f6ec442..cbacf11fa 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st +++ b/src/Squot.package/SquotGraphComparisonWalk.class/instance/addLeft.right.reachedVia..st @@ -1,9 +1,8 @@ enumerating addLeft: nextLeft right: nextRight reachedVia: aReference - "Enqueue the pair of nextLeft and nextRight to the walk." + "Enqueue the pair of nextLeft and nextRight to the walk. Answer the not-yet-initialized diff between nextLeft and nextRight." "The mirror for nextLeft can be missing if nextRight is now closer to the start object than before." | diff | - nextLeft ~= nextRight ifFalse: "Nothing to be compared" [^ SquotDiffOfEqualObjects instance]. (mirrors includesKey: nextLeft undecorated) ifFalse: ["Workaround: use the mirror for nextRight. Since both are supposed to be editions of the same object, they should be of the same kind and so it should be no problem to use the same mirror for them." mirrors at: nextLeft undecorated put: (mirrors at: nextRight undecorated)]. diff --git a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json index d111e4a2c..57b0b50ab 100644 --- a/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json +++ b/src/Squot.package/SquotGraphComparisonWalk.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "addLeft:right:reachedVia:" : "jr 7/30/2021 22:34", + "addLeft:right:reachedVia:" : "jr 8/8/2021 16:53", "addNewObject:reachedVia:" : "jr 7/18/2021 16:19", "checkPathsTo:ifMultiple:" : "jr 7/18/2021 17:05", "do:" : "jr 7/25/2021 21:10", diff --git a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st index bdb7f1a0c..7e0bacdf4 100644 --- a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st +++ b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/instance/expectedFailures.st @@ -1,6 +1,6 @@ failures expectedFailures | bugs | - bugs := #(testTrackingText "Because patched object graphs are inconsistent: the list of object names does not use the same instances as the referenced objects."). + bugs := #("testTrackingText" "Because patched object graphs are inconsistent: the list of object names does not use the same instances as the referenced objects. The test currently works due to the optimization that objects that compare equal with #= are not further walked in SquotDiffBuilder, but the issue remains. See SquotShadowPatchingTest testUpdatesNameMappingConsistently."). bugs flag: #todo. "Fix them" ^ super expectedFailures, bugs \ No newline at end of file diff --git a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json index 8e52995f8..de6a466c2 100644 --- a/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json +++ b/src/Squot.package/SquotInMemoryRepositoryWorkingCopyTest.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "expectedFailures" : "jr 7/17/2021 21:57", + "expectedFailures" : "jr 8/8/2021 16:55", "newRepository" : "jr 2/4/2017 01:58", "testImmutabilityOfSnapshots" : "jr 1/26/2020 22:58", "testVersionsDoNotContainWorkingCopyArtifacts" : "jr 11/18/2020 21:35" } } diff --git a/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st b/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st index 10c0f5cd7..6a378993b 100644 --- a/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st +++ b/src/Squot.package/SquotTrackedObjectMetadata.class/instance/squotDiffAgainst..st @@ -16,7 +16,8 @@ squotDiffAgainst: aTrackedObjectMetadata walk checkPathsTo: leftValue ifMultiple: [alreadyVisited := true]; checkPathsTo: rightValue ifMultiple: [alreadyVisited := true]. alreadyVisited ifFalse: - [walk addLeft: leftValue right: rightValue reachedVia: commonPath last]] + [leftValue ~= rightValue ifTrue: + [walk addLeft: leftValue right: rightValue reachedVia: commonPath last]]] ifOnlyLeft: [:removed :oldPath | diffs at: oldPath put: (SquotReferenceRemoval of: removed from: left reference: oldPath last rightObject: right)] ifOnlyRight: [:added :newPath | diffs at: newPath put: (SquotReferenceAddition to: left reference: newPath last target: added rightOwner: right)]]. diff setLeft: self right: aTrackedObjectMetadata diffs: diffs. diff --git a/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json b/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json index ccce93d24..1ed920022 100644 --- a/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json +++ b/src/Squot.package/SquotTrackedObjectMetadata.class/methodProperties.json @@ -32,6 +32,6 @@ "serializer:" : "jr 7/16/2017 12:28", "slotOverrideFor:in:ifFound:ifNone:" : "jr 7/16/2017 13:50", "slotOverrides" : "jr 7/16/2017 12:21", - "squotDiffAgainst:" : "jr 7/30/2021 19:31", + "squotDiffAgainst:" : "jr 8/8/2021 16:53", "squotMergeWith:basedOn:" : "jr 7/18/2021 20:23", "updateFrom:" : "jr 12/13/2020 21:51" } } From f3abf142b03f7b553504997b7ad30fda4c5e920f Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 8 Aug 2021 17:24:27 +0200 Subject: [PATCH 35/43] Test cycles among two objects, add note of caution --- .../instance/compareLater.with.reachedVia..st | 1 + .../methodProperties.json | 2 +- .../instance/testCyclicReferences2.st | 30 +++++++++++++++++++ .../methodProperties.json | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/Squot.package/SquotObjectPatchingTest.class/instance/testCyclicReferences2.st diff --git a/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st b/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st index f42760fcd..baeda6f61 100644 --- a/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st +++ b/src/Squot.package/SquotDiffBuilder.class/instance/compareLater.with.reachedVia..st @@ -2,5 +2,6 @@ private compareLater: leftValue with: rightValue reachedVia: aReference | newDiff | leftValue undecorated = rightValue undecorated ifTrue: [^ self]. + "Attention: the comparison above might not return if shadows implement comparing and do not watch out for cycles in the object graph." newDiff := walk addLeft: leftValue right: rightValue reachedVia: aReference. objectDiffs at: leftValue undecorated put: newDiff. \ No newline at end of file diff --git a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json index 58dec035c..37fded481 100644 --- a/src/Squot.package/SquotDiffBuilder.class/methodProperties.json +++ b/src/Squot.package/SquotDiffBuilder.class/methodProperties.json @@ -6,7 +6,7 @@ "addDiffsToGraphDiff" : "jr 7/25/2021 21:15", "addedObject:withName:reachedVia:" : "jr 7/25/2021 20:54", "compare:reachedFrom:with:reachedFrom:via:" : "jr 7/30/2021 20:27", - "compareLater:with:reachedVia:" : "jr 8/8/2021 16:53", + "compareLater:with:reachedVia:" : "jr 8/8/2021 17:15", "detectStartObjectReplacement:with:" : "jr 7/30/2021 19:12", "diffFrom:to:ifNew:andInitialize:" : "jr 7/30/2021 19:53", "followNewObject:" : "jr 7/25/2021 22:00", diff --git a/src/Squot.package/SquotObjectPatchingTest.class/instance/testCyclicReferences2.st b/src/Squot.package/SquotObjectPatchingTest.class/instance/testCyclicReferences2.st new file mode 100644 index 000000000..9b213342a --- /dev/null +++ b/src/Squot.package/SquotObjectPatchingTest.class/instance/testCyclicReferences2.st @@ -0,0 +1,30 @@ +testing +testCyclicReferences2 + | array1 array2 original target diff | + array1 := Array new: 2. + array2 := Array new: 2. + array1 + at: 1 put: array2; + at: 2 put: 2. + array2 + at: 1 put: 1; + at: 2 put: array1. + original := capturer captureGraph: array1. + array1 at: 2 put: 3. + array2 at: 1 put: 4. + target := capturer captureGraph: array1. + "Cannot use become: with two different self-referencing arrays because it would mix them. 1->2->1->2->..." + array1 at: 2 put: 2. + array2 at: 1 put: 1. + self assert: (original startObject at: 1) == array2; + assert: ((original startObject at: 1) at: 2) == array1. + self assert: 2 equals: (original startObject at: 2); + assert: 1 equals: ((original startObject at: 1) at: 1). + "when" + diff := original squotDiffAgainst: target. + patcher apply: diff toLoadedGraph: original mutableCopy. + "then" + self assert: (array1 at: 1) == array2; + assert: (array2 at: 2) == array1. + self assert: 3 equals: (array1 at: 2); + assert: 4 equals: (array2 at: 1). \ No newline at end of file diff --git a/src/Squot.package/SquotObjectPatchingTest.class/methodProperties.json b/src/Squot.package/SquotObjectPatchingTest.class/methodProperties.json index 7a52b491e..59337af09 100644 --- a/src/Squot.package/SquotObjectPatchingTest.class/methodProperties.json +++ b/src/Squot.package/SquotObjectPatchingTest.class/methodProperties.json @@ -14,6 +14,7 @@ "testArrayShrink" : "jr 6/27/2017 17:21", "testArraySwap" : "jr 7/29/2017 17:16", "testCyclicReferences" : "jr 6/13/2021 23:11", + "testCyclicReferences2" : "jr 8/8/2021 17:06", "testDictionary" : "jr 7/7/2021 23:00", "testNestedArray" : "jr 9/23/2019 19:29", "testRemoveComplexValueObject" : "jr 7/7/2021 23:03", From f41b036278f44cd81778337170a0fb3aaa9122f8 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 8 Aug 2021 18:43:22 +0200 Subject: [PATCH 36/43] Further notes and tests for strange comparisons --- .../instance/newDiffFrom.to..st | 2 ++ .../methodProperties.json | 2 +- .../instance/testReplacedObject.st | 13 +++++++++++++ .../methodProperties.json | 1 + .../instance/newDiffFrom.to..st | 2 +- .../methodProperties.json | 2 +- 6 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/Squot.package/SquotObjectPatchingTest.class/instance/testReplacedObject.st diff --git a/src/Squot.package/SquotDiskProxyMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotDiskProxyMirror.class/instance/newDiffFrom.to..st index 57c4782c3..d7c81f929 100644 --- a/src/Squot.package/SquotDiskProxyMirror.class/instance/newDiffFrom.to..st +++ b/src/Squot.package/SquotDiskProxyMirror.class/instance/newDiffFrom.to..st @@ -1,5 +1,7 @@ comparing newDiffFrom: aDiskProxyShadow to: aDiskProxyShadow2 + self isThisEverCalled. + "Should only be called if the DiskProxies were the roots of the object graph (which would not make much sense, to track something that is then proxied to hide any details). Otherwise, if the DiskProxy is different, the target of the reference from which it was reached is also likely to have a different identity, so the DiskProxy versions would not be compared with each other." ^ aDiskProxyShadow = aDiskProxyShadow2 ifTrue: [SquotDiffOfEqualObjects instance] ifFalse: [self isThisEverCalled. SquotObjectReplacement left: aDiskProxyShadow right: aDiskProxyShadow2] \ No newline at end of file diff --git a/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json b/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json index 77e94097f..69e0ace7f 100644 --- a/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json +++ b/src/Squot.package/SquotDiskProxyMirror.class/methodProperties.json @@ -3,5 +3,5 @@ }, "instance" : { "capture:with:ifReplaced:" : "jr 7/17/2021 23:57", - "newDiffFrom:to:" : "jr 7/30/2021 19:45", + "newDiffFrom:to:" : "jr 8/8/2021 18:42", "shouldObjectHaveNameAssigned:" : "jr 4/8/2021 22:05" } } diff --git a/src/Squot.package/SquotObjectPatchingTest.class/instance/testReplacedObject.st b/src/Squot.package/SquotObjectPatchingTest.class/instance/testReplacedObject.st new file mode 100644 index 000000000..73812ce85 --- /dev/null +++ b/src/Squot.package/SquotObjectPatchingTest.class/instance/testReplacedObject.st @@ -0,0 +1,13 @@ +testing +testReplacedObject + | holder1 holder2 diff graphAfter graphBefore | + holder1 := ValueHolder new contents: (Smalltalk globals bindingOf: #Object); yourself. + holder2 := ValueHolder new contents: (Smalltalk globals bindingOf: #SmallInteger); yourself. + graphBefore := capturer captureGraph: holder1. + objectRegistry assign: (objectRegistry nameOf: holder1) to: holder2. + graphAfter := capturer captureGraph: holder2. + diff := graphBefore squotDiffAgainst: graphAfter. + "when" + self apply: diff to: holder1. + "then" + self assert: holder1 contents == holder2 contents. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectPatchingTest.class/methodProperties.json b/src/Squot.package/SquotObjectPatchingTest.class/methodProperties.json index 59337af09..a4b5061c1 100644 --- a/src/Squot.package/SquotObjectPatchingTest.class/methodProperties.json +++ b/src/Squot.package/SquotObjectPatchingTest.class/methodProperties.json @@ -18,6 +18,7 @@ "testDictionary" : "jr 7/7/2021 23:00", "testNestedArray" : "jr 9/23/2019 19:29", "testRemoveComplexValueObject" : "jr 7/7/2021 23:03", + "testReplacedObject" : "jr 8/8/2021 17:57", "testReplacedObject2" : "jr 7/20/2017 17:02", "testSet" : "jr 7/7/2021 23:05", "testTypeChange" : "jr 6/15/2017 16:23", diff --git a/src/Squot.package/SquotOpaqueValueMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotOpaqueValueMirror.class/instance/newDiffFrom.to..st index a662a1feb..de1c7e45f 100644 --- a/src/Squot.package/SquotOpaqueValueMirror.class/instance/newDiffFrom.to..st +++ b/src/Squot.package/SquotOpaqueValueMirror.class/instance/newDiffFrom.to..st @@ -1,4 +1,4 @@ comparing newDiffFrom: aSquotPrimitiveValue to: aSquotPrimitiveValue2 - "Usually called for two equal primitive values and it is later determined that there is no difference to be recorded." + "Usually this is only called when comparing two SquotTrackedObjectMetadata values. This answer may not actually be correct in that case, but SquotTrackedObjectMetadata does not use the diffs returned from here anyway, so better use a singleton instead of creating an accurate wasted diff." ^ SquotDiffOfEqualObjects instance \ No newline at end of file diff --git a/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json b/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json index 637bded3a..c9efec51d 100644 --- a/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json +++ b/src/Squot.package/SquotOpaqueValueMirror.class/methodProperties.json @@ -7,6 +7,6 @@ "capture:with:ifReplaced:" : "jr 7/17/2021 23:58", "hash" : "jr 4/8/2021 20:16", "is:comparableTo:" : "jr 7/18/2021 20:14", - "newDiffFrom:to:" : "jr 7/30/2021 20:38", + "newDiffFrom:to:" : "jr 8/8/2021 17:30", "referencesFrom:" : "jr 4/8/2021 20:14", "shouldObjectHaveNameAssigned:" : "jr 4/8/2021 20:15" } } From ee8b5d6b72ac6d7dfb41c8a6427589d2d3bb42df Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sun, 15 Aug 2021 13:48:25 +0200 Subject: [PATCH 37/43] Use smalltalk-image instead of deprecated smalltalk-version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c8dc4919..12248bb91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v2 - uses: hpi-swa/setup-smalltalkCI@v1 with: - smalltalk-version: ${{ matrix.smalltalk }} + smalltalk-image: ${{ matrix.smalltalk }} - run: smalltalkci -s ${{ matrix.smalltalk }} shell: bash timeout-minutes: 15 From fb0b227c33a7429158418e8c7a16cdaa86f1e370 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Wed, 25 Aug 2021 12:09:00 +0200 Subject: [PATCH 38/43] Fix up metadata in Squot's own repository --- src/BaselineOfSquot.package/.squot-contents | 2 +- src/FileSystem-Git.package/.squot-contents | 2 +- src/Squit.package/.squot-contents | 2 +- src/Squot.package/.squot-contents | 2 +- src/SquotTonel-Core.package/.squot-contents | 2 +- src/SquotTonel-Tests.package/.squot-contents | 2 +- src/VersionControl.package/.squot-contents | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/BaselineOfSquot.package/.squot-contents b/src/BaselineOfSquot.package/.squot-contents index b5d4d4099..4b0df335b 100644 --- a/src/BaselineOfSquot.package/.squot-contents +++ b/src/BaselineOfSquot.package/.squot-contents @@ -1,6 +1,6 @@ SquotTrackedObjectMetadata { #objectClassName : #PackageInfo, + #slotOverrides : { }, #objectsReplacedByNames : true, - #slotOverrides : IdentityDictionary { }, #serializer : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/src/FileSystem-Git.package/.squot-contents b/src/FileSystem-Git.package/.squot-contents index b5d4d4099..4b0df335b 100644 --- a/src/FileSystem-Git.package/.squot-contents +++ b/src/FileSystem-Git.package/.squot-contents @@ -1,6 +1,6 @@ SquotTrackedObjectMetadata { #objectClassName : #PackageInfo, + #slotOverrides : { }, #objectsReplacedByNames : true, - #slotOverrides : IdentityDictionary { }, #serializer : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/src/Squit.package/.squot-contents b/src/Squit.package/.squot-contents index b5d4d4099..4b0df335b 100644 --- a/src/Squit.package/.squot-contents +++ b/src/Squit.package/.squot-contents @@ -1,6 +1,6 @@ SquotTrackedObjectMetadata { #objectClassName : #PackageInfo, + #slotOverrides : { }, #objectsReplacedByNames : true, - #slotOverrides : IdentityDictionary { }, #serializer : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/src/Squot.package/.squot-contents b/src/Squot.package/.squot-contents index b5d4d4099..4b0df335b 100644 --- a/src/Squot.package/.squot-contents +++ b/src/Squot.package/.squot-contents @@ -1,6 +1,6 @@ SquotTrackedObjectMetadata { #objectClassName : #PackageInfo, + #slotOverrides : { }, #objectsReplacedByNames : true, - #slotOverrides : IdentityDictionary { }, #serializer : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/src/SquotTonel-Core.package/.squot-contents b/src/SquotTonel-Core.package/.squot-contents index b5d4d4099..4b0df335b 100644 --- a/src/SquotTonel-Core.package/.squot-contents +++ b/src/SquotTonel-Core.package/.squot-contents @@ -1,6 +1,6 @@ SquotTrackedObjectMetadata { #objectClassName : #PackageInfo, + #slotOverrides : { }, #objectsReplacedByNames : true, - #slotOverrides : IdentityDictionary { }, #serializer : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/src/SquotTonel-Tests.package/.squot-contents b/src/SquotTonel-Tests.package/.squot-contents index b5d4d4099..4b0df335b 100644 --- a/src/SquotTonel-Tests.package/.squot-contents +++ b/src/SquotTonel-Tests.package/.squot-contents @@ -1,6 +1,6 @@ SquotTrackedObjectMetadata { #objectClassName : #PackageInfo, + #slotOverrides : { }, #objectsReplacedByNames : true, - #slotOverrides : IdentityDictionary { }, #serializer : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/src/VersionControl.package/.squot-contents b/src/VersionControl.package/.squot-contents index b5d4d4099..4b0df335b 100644 --- a/src/VersionControl.package/.squot-contents +++ b/src/VersionControl.package/.squot-contents @@ -1,6 +1,6 @@ SquotTrackedObjectMetadata { #objectClassName : #PackageInfo, + #slotOverrides : { }, #objectsReplacedByNames : true, - #slotOverrides : IdentityDictionary { }, #serializer : #SquotCypressCodeSerializer } \ No newline at end of file From eb8569b13399073a5f53909c3a1a9bfea4f93ba5 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Wed, 25 Aug 2021 10:06:34 +0200 Subject: [PATCH 39/43] Fix #341: Prevent that errors are hidden during commits The ifRejected: [nil] in actionCommit turned the effective Promise for the save into one that always gets resolved rather than rejected. But the promise is also rejected if the user cancels the save dialog. Now waitFor: will signal either the inner Error (or rather a copy of it) or the BrokenPromise if it was not rejected with an Error. --- .../SquitBrowser.class/instance/actionCommit.st | 5 ++--- src/Squit.package/SquitBrowser.class/methodProperties.json | 2 +- .../instance/ifError.ifNotError..st | 7 +++++++ .../BrokenPromise.extension/instance/ifNotError..st | 7 +------ .../BrokenPromise.extension/instance/reason.st | 6 ++++++ .../BrokenPromise.extension/methodProperties.json | 4 +++- src/Squot.package/SquotGUI.class/class/waitFor..st | 4 +++- src/Squot.package/SquotGUI.class/methodProperties.json | 2 +- 8 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 src/Squot.package/BrokenPromise.extension/instance/ifError.ifNotError..st create mode 100644 src/Squot.package/BrokenPromise.extension/instance/reason.st diff --git a/src/Squit.package/SquitBrowser.class/instance/actionCommit.st b/src/Squit.package/SquitBrowser.class/instance/actionCommit.st index e7892551f..cb13742c6 100644 --- a/src/Squit.package/SquitBrowser.class/instance/actionCommit.st +++ b/src/Squit.package/SquitBrowser.class/instance/actionCommit.st @@ -8,6 +8,5 @@ actionCommit ((workingCopy newInteractiveSaveOperation title: 'Select changes and message for the new version'; applyToWorkingCopy) - then: [:result | self refresh] - ifRejected: [:reason | nil])] - on: BrokenPromise do: [:e | e ifNotError: []]]. \ No newline at end of file + then: [:result | self refresh])] + on: BrokenPromise do: [:e | "cancelled" e return]]. \ No newline at end of file diff --git a/src/Squit.package/SquitBrowser.class/methodProperties.json b/src/Squit.package/SquitBrowser.class/methodProperties.json index 4660b3b02..9907900e2 100644 --- a/src/Squit.package/SquitBrowser.class/methodProperties.json +++ b/src/Squit.package/SquitBrowser.class/methodProperties.json @@ -34,7 +34,7 @@ "actionBranchUnsetUpstream" : "jr 7/20/2020 13:02", "actionBrowseWorkingCopy" : "jr 8/14/2018 10:25", "actionClearSearch" : "fn 4/11/2017 18:49", - "actionCommit" : "jr 8/9/2020 22:44", + "actionCommit" : "jr 8/25/2021 09:57", "actionCommitCherryPick" : "jr 8/8/2020 15:53", "actionCommitDiffWithNextSelected" : "jr 7/2/2017 19:30", "actionCommitDiffWithParent" : "jr 2/27/2020 01:00", diff --git a/src/Squot.package/BrokenPromise.extension/instance/ifError.ifNotError..st b/src/Squot.package/BrokenPromise.extension/instance/ifError.ifNotError..st new file mode 100644 index 000000000..f7763a8c8 --- /dev/null +++ b/src/Squot.package/BrokenPromise.extension/instance/ifError.ifNotError..st @@ -0,0 +1,7 @@ +*Squot-Tools +ifError: errorBlock ifNotError: rejectedBlock + | reason | + reason := self reason. + ^ (reason isKindOf: Error) + ifTrue: [errorBlock cull: reason] + ifFalse: [rejectedBlock cull: reason] \ No newline at end of file diff --git a/src/Squot.package/BrokenPromise.extension/instance/ifNotError..st b/src/Squot.package/BrokenPromise.extension/instance/ifNotError..st index e7b603009..983cb728d 100644 --- a/src/Squot.package/BrokenPromise.extension/instance/ifNotError..st +++ b/src/Squot.package/BrokenPromise.extension/instance/ifNotError..st @@ -1,12 +1,7 @@ *Squot-Tools ifNotError: aBlock "Workaround for bad Promise implementation up to Squeak 5.3: value of ifRejected: blocks is not used to resolve the then-Promise, but to reject it. Also Promises in Squeak 5.3 do not take on the outcome of nested promises, they just nest the rejected promise as the error reason. Check whether the promise error is a real Error exception or whether it is a custom error reason. If it is a real Error, pass the BrokenPromise on. Otherwise evaluate the block to run business logic." - | nested | - nested := promise. - [(nested isKindOf: Promise) and: [nested isRejected]] whileTrue: [nested := nested error]. - (nested isKindOf: Error) - ifTrue: [self pass] - ifFalse: [^ aBlock cull: nested]. + ^ self ifError: [self pass] ifNotError: [:reason | aBlock cull: reason] "[Promise new rejectWith: 42; wait] on: BrokenPromise do: [:e | e ifNotError: []]" "expected: nil" "[((Promise new rejectWith: 42) then: [:x|] ifRejected: [:x | nil]) wait] diff --git a/src/Squot.package/BrokenPromise.extension/instance/reason.st b/src/Squot.package/BrokenPromise.extension/instance/reason.st new file mode 100644 index 000000000..e3463882e --- /dev/null +++ b/src/Squot.package/BrokenPromise.extension/instance/reason.st @@ -0,0 +1,6 @@ +*Squot-Tools +reason + | nested | + nested := promise. + [(nested isKindOf: Promise) and: [nested isRejected]] whileTrue: [nested := nested error]. + ^ nested \ No newline at end of file diff --git a/src/Squot.package/BrokenPromise.extension/methodProperties.json b/src/Squot.package/BrokenPromise.extension/methodProperties.json index b2efe80fc..7508b3994 100644 --- a/src/Squot.package/BrokenPromise.extension/methodProperties.json +++ b/src/Squot.package/BrokenPromise.extension/methodProperties.json @@ -2,4 +2,6 @@ "class" : { }, "instance" : { - "ifNotError:" : "jr 8/9/2020 23:42" } } + "ifError:ifNotError:" : "jr 8/25/2021 09:49", + "ifNotError:" : "jr 8/25/2021 09:50", + "reason" : "jr 8/25/2021 09:48" } } diff --git a/src/Squot.package/SquotGUI.class/class/waitFor..st b/src/Squot.package/SquotGUI.class/class/waitFor..st index c2b307b2b..3d3a308d2 100644 --- a/src/Squot.package/SquotGUI.class/class/waitFor..st +++ b/src/Squot.package/SquotGUI.class/class/waitFor..st @@ -8,8 +8,10 @@ waitFor: aWaitable Project current spawnNewProcess. "Start another process that waits in the background, then reinstantes oldProcess as UI process. The oldProcess waits until all of this is over. The reason for a third process is that oldProcess must be suspended temporarily before it can be reinstated in Project class>>resumeProcess:." [[[answer := aWaitable wait] + on: BrokenPromise do: + [:bp | bp ifError: [:error | exception := error. bp return] ifNotError: [bp pass]] on: Error do: - [:e | exception := e]] + [:e | exception := e. e return]] ensure: [| canContinue | newProcess := Project uiProcess. diff --git a/src/Squot.package/SquotGUI.class/methodProperties.json b/src/Squot.package/SquotGUI.class/methodProperties.json index b55547202..84a62e1c9 100644 --- a/src/Squot.package/SquotGUI.class/methodProperties.json +++ b/src/Squot.package/SquotGUI.class/methodProperties.json @@ -16,6 +16,6 @@ "requestPassword:" : "jr 7/24/2020 10:04", "runInUiProcess:" : "jr 7/24/2020 09:59", "updateProgress:text:" : "jr 9/13/2020 18:23", - "waitFor:" : "jr 5/14/2021 17:16" }, + "waitFor:" : "jr 8/25/2021 09:56" }, "instance" : { } } From ca5de1fa1bdfb504f04ff4262e9b490eccba7dc9 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Fri, 10 Sep 2021 23:40:51 +0200 Subject: [PATCH 40/43] Squeak deprecates ifNotNilDo:, use ifNotNil: instead --- .../GitCommit.class/instance/printOn..st | 2 +- .../GitCommit.class/methodProperties.json | 2 +- .../GitFSCK.class/instance/validateHead.st | 2 +- .../GitFSCK.class/methodProperties.json | 2 +- .../instance/headerOfPackedObjectNamed.ifAbsent..st | 2 +- .../instance/packedObjectNamed.ifAbsent..st | 2 +- .../GitPackedObjectStore.class/methodProperties.json | 4 ++-- .../GitUnitOfWork.class/instance/tagNamed.ifAbsent..st | 2 +- .../GitUnitOfWork.class/methodProperties.json | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/FileSystem-Git.package/GitCommit.class/instance/printOn..st b/src/FileSystem-Git.package/GitCommit.class/instance/printOn..st index 71f06b60f..6ccdbf354 100644 --- a/src/FileSystem-Git.package/GitCommit.class/instance/printOn..st +++ b/src/FileSystem-Git.package/GitCommit.class/instance/printOn..st @@ -2,7 +2,7 @@ printing printOn: aStream super printOn: aStream. self message - ifNotNilDo: [ :msg| + ifNotNil: [ :msg| aStream nextPutAll: '('; nextPutAll: (integerHash ifNil: [''] ifNotNil: [integerHash asHexHash first: 7]); diff --git a/src/FileSystem-Git.package/GitCommit.class/methodProperties.json b/src/FileSystem-Git.package/GitCommit.class/methodProperties.json index 3f5edd896..bf6d37f0c 100644 --- a/src/FileSystem-Git.package/GitCommit.class/methodProperties.json +++ b/src/FileSystem-Git.package/GitCommit.class/methodProperties.json @@ -25,7 +25,7 @@ "mergeBaseWithAnyOf:" : "jr 4/6/2020 20:23", "parents" : "MaxLeske 2/26/2012 11:28", "parents:" : "MaxLeske 5/26/2010 20:04", - "printOn:" : "jr 5/2/2020 16:43", + "printOn:" : "jr 9/10/2021 20:27", "quickValidate" : "jr 4/13/2017 18:02", "storeFixedKeysOn:" : "jr 7/1/2017 00:36", "tags" : "jr 4/6/2020 20:23", diff --git a/src/FileSystem-Git.package/GitFSCK.class/instance/validateHead.st b/src/FileSystem-Git.package/GitFSCK.class/instance/validateHead.st index 20f4e5f85..680b78ee6 100644 --- a/src/FileSystem-Git.package/GitFSCK.class/instance/validateHead.st +++ b/src/FileSystem-Git.package/GitFSCK.class/instance/validateHead.st @@ -1,7 +1,7 @@ public-validating validateHead self validateHeadFile. - [ repository unitOfWork head ifNotNilDo: [ :head | self visit: head ] ] + [ repository unitOfWork head ifNotNil: [ :head | self visit: head ] ] on: GitError do: [ :error | self collectError: error for: repository ] \ No newline at end of file diff --git a/src/FileSystem-Git.package/GitFSCK.class/methodProperties.json b/src/FileSystem-Git.package/GitFSCK.class/methodProperties.json index 25accf6eb..e5efd7b73 100644 --- a/src/FileSystem-Git.package/GitFSCK.class/methodProperties.json +++ b/src/FileSystem-Git.package/GitFSCK.class/methodProperties.json @@ -14,7 +14,7 @@ "validate" : "MaxLeske 6/24/2012 15:32", "validate:" : "jr 11/20/2016 21:46", "validateBranches" : "jr 4/6/2020 23:06", - "validateHead" : "jr 4/6/2020 23:06", + "validateHead" : "jr 9/10/2021 20:27", "validateHeadFile" : "jr 4/6/2020 23:07", "validateObjects" : "CamilloBruni 6/21/2011 06:27", "validateTags" : "jr 4/6/2020 23:07", diff --git a/src/FileSystem-Git.package/GitPackedObjectStore.class/instance/headerOfPackedObjectNamed.ifAbsent..st b/src/FileSystem-Git.package/GitPackedObjectStore.class/instance/headerOfPackedObjectNamed.ifAbsent..st index a12bede7d..d5e7293cc 100644 --- a/src/FileSystem-Git.package/GitPackedObjectStore.class/instance/headerOfPackedObjectNamed.ifAbsent..st +++ b/src/FileSystem-Git.package/GitPackedObjectStore.class/instance/headerOfPackedObjectNamed.ifAbsent..st @@ -1,5 +1,5 @@ private headerOfPackedObjectNamed: aHexHash ifAbsent: aBlock self packsDo: [ :pack | - (pack headerOfObjectNamed: aHexHash) ifNotNilDo: [:header | ^ header]]. + (pack headerOfObjectNamed: aHexHash) ifNotNil: [:header | ^ header]]. ^ aBlock value \ No newline at end of file diff --git a/src/FileSystem-Git.package/GitPackedObjectStore.class/instance/packedObjectNamed.ifAbsent..st b/src/FileSystem-Git.package/GitPackedObjectStore.class/instance/packedObjectNamed.ifAbsent..st index 508afa9eb..cf65081df 100644 --- a/src/FileSystem-Git.package/GitPackedObjectStore.class/instance/packedObjectNamed.ifAbsent..st +++ b/src/FileSystem-Git.package/GitPackedObjectStore.class/instance/packedObjectNamed.ifAbsent..st @@ -1,6 +1,6 @@ private packedObjectNamed: aHexHash ifAbsent: aBlock self packsDo: [ :pack | - (pack objectNamed: aHexHash) ifNotNilDo: + (pack objectNamed: aHexHash) ifNotNil: [ :object | ^ object object ] ]. ^ aBlock value \ No newline at end of file diff --git a/src/FileSystem-Git.package/GitPackedObjectStore.class/methodProperties.json b/src/FileSystem-Git.package/GitPackedObjectStore.class/methodProperties.json index 30372736b..650cb0d70 100644 --- a/src/FileSystem-Git.package/GitPackedObjectStore.class/methodProperties.json +++ b/src/FileSystem-Git.package/GitPackedObjectStore.class/methodProperties.json @@ -7,13 +7,13 @@ "hasObject:" : "jr 3/4/2020 23:45", "hasPackedObject:" : "jr 6/28/2017 16:26", "headerOfObjectNamed:ifAbsent:" : "jr 2/12/2020 23:37", - "headerOfPackedObjectNamed:ifAbsent:" : "jr 3/6/2017 23:06", + "headerOfPackedObjectNamed:ifAbsent:" : "jr 9/10/2021 20:27", "objectNamed:" : "jr 2/17/2020 22:48", "objectNamed:ifAbsent:" : "jr 2/17/2020 22:47", "objectNamesDo:" : "jr 4/12/2020 11:40", "pack" : "jr 2/23/2020 23:21", "packedObjectNamed:" : "jr 2/17/2020 22:51", - "packedObjectNamed:ifAbsent:" : "jr 2/17/2020 21:30", + "packedObjectNamed:ifAbsent:" : "jr 9/10/2021 20:28", "packs" : "jr 3/4/2020 23:35", "packsDir" : "jr 2/12/2020 23:18", "packsDir:" : "jr 2/12/2020 23:18", diff --git a/src/FileSystem-Git.package/GitUnitOfWork.class/instance/tagNamed.ifAbsent..st b/src/FileSystem-Git.package/GitUnitOfWork.class/instance/tagNamed.ifAbsent..st index 29f0fd8ff..9805f961f 100644 --- a/src/FileSystem-Git.package/GitUnitOfWork.class/instance/tagNamed.ifAbsent..st +++ b/src/FileSystem-Git.package/GitUnitOfWork.class/instance/tagNamed.ifAbsent..st @@ -1,5 +1,5 @@ branches and tags tagNamed: aString ifAbsent: aBlock - (self resolveRef: 'refs/tags/', aString) ifNotNilDo: [ :tagRef| + (self resolveRef: 'refs/tags/', aString) ifNotNil: [ :tagRef| ^ self objectNamed: tagRef ifAbsent: aBlock ]. ^ aBlock value \ No newline at end of file diff --git a/src/FileSystem-Git.package/GitUnitOfWork.class/methodProperties.json b/src/FileSystem-Git.package/GitUnitOfWork.class/methodProperties.json index 760dbd4e7..813441dc5 100644 --- a/src/FileSystem-Git.package/GitUnitOfWork.class/methodProperties.json +++ b/src/FileSystem-Git.package/GitUnitOfWork.class/methodProperties.json @@ -75,7 +75,7 @@ "storeObject:" : "jr 4/20/2020 21:19", "streamObjectNamed:" : "jr 2/13/2020 00:25", "tagNamed:" : "Camillobruni 8/18/2011 16:53", - "tagNamed:ifAbsent:" : "MaxLeske 2/26/2012 12:17", + "tagNamed:ifAbsent:" : "jr 9/10/2021 20:28", "tagNames" : "jr 4/29/2020 23:49", "tags" : "jr 4/30/2020 00:03", "unitOfWork" : "jr 2/23/2020 23:13", From fc30e82212f28ff4adbf2b277612ff5579ac7182 Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Fri, 10 Sep 2021 23:53:45 +0200 Subject: [PATCH 41/43] Fix: incorrect package could be loaded during checkout All packages have #() as object name, and in one more place this caused a problem. A different package was found under that name in the object registry. Allow access to graphs and the object registry via mirrors. In the future one could use two different mirrors to access both shadows and the live objects in a SquotObjectGraph or -Registry. --- .../instance/sameIn.withName.ifAbsent..st | 2 +- .../methodProperties.json | 2 +- .../instance/sameIn.withName.ifAbsent..st | 2 +- .../methodProperties.json | 2 +- .../SquotGraphElementWithName.class/README.md | 0 .../SquotGraphElementWithName.class/class/name..st | 3 +++ .../instance/newNameFragment.st | 5 +++++ .../instance/reflect.in..st | 3 +++ .../instance/reflect.in.put..st | 5 +++++ .../instance/setName..st | 3 +++ .../methodProperties.json | 8 ++++++++ .../properties.json | 14 ++++++++++++++ src/Squot.package/SquotGraphMirror.class/README.md | 0 .../instance/reflectGraphElementWithName.in..st | 3 +++ .../instance/shouldObjectHaveNameAssigned..st | 2 +- .../SquotGraphMirror.class/methodProperties.json | 6 ++++++ .../SquotGraphMirror.class/properties.json | 14 ++++++++++++++ .../instance/reflectGraphElementWithName.in..st | 3 +++ .../methodProperties.json | 4 ++-- .../SquotObjectGraphMirror.class/properties.json | 2 +- .../SquotObjectRegistry.class/class/squotMirror.st | 3 +++ .../methodProperties.json | 2 +- .../SquotObjectRegistryMirror.class/README.md | 0 .../instance/canHaveReferences..st | 5 +++++ .../instance/capture.with.ifReplaced..st | 9 +++++++++ .../instance/is.comparableTo..st | 5 +++++ .../instance/newDiffFrom.to..st | 5 +++++ .../instance/referencesFrom..st | 5 +++++ .../instance/reflectGraphElementWithName.in..st | 3 +++ .../methodProperties.json | 10 ++++++++++ .../properties.json | 14 ++++++++++++++ .../instance/sameIn.withName.ifAbsent..st | 2 +- .../SquotObjectShadow.class/methodProperties.json | 2 +- .../instance/sameIn.withName.ifAbsent..st | 9 +++++---- .../SquotPackageShadow.class/methodProperties.json | 2 +- .../SquotShadowGraph.class/class/squotMirror.st | 3 +++ .../SquotShadowGraph.class/methodProperties.json | 1 + .../SquotShadowGraphMirror.class/README.md | 0 .../instance/canHaveReferences..st | 5 +++++ .../instance/capture.with.ifReplaced..st | 3 +++ .../instance/is.comparableTo..st | 5 +++++ .../instance/newDiffFrom.to..st | 5 +++++ .../instance/referencesFrom..st | 5 +++++ .../instance/reflectGraphElementWithName.in..st | 3 +++ .../methodProperties.json | 10 ++++++++++ .../SquotShadowGraphMirror.class/properties.json | 14 ++++++++++++++ .../instance/rematerializeGraph.into..st | 7 +++---- .../methodProperties.json | 2 +- 48 files changed, 201 insertions(+), 21 deletions(-) create mode 100644 src/Squot.package/SquotGraphElementWithName.class/README.md create mode 100644 src/Squot.package/SquotGraphElementWithName.class/class/name..st create mode 100644 src/Squot.package/SquotGraphElementWithName.class/instance/newNameFragment.st create mode 100644 src/Squot.package/SquotGraphElementWithName.class/instance/reflect.in..st create mode 100644 src/Squot.package/SquotGraphElementWithName.class/instance/reflect.in.put..st create mode 100644 src/Squot.package/SquotGraphElementWithName.class/instance/setName..st create mode 100644 src/Squot.package/SquotGraphElementWithName.class/methodProperties.json create mode 100644 src/Squot.package/SquotGraphElementWithName.class/properties.json create mode 100644 src/Squot.package/SquotGraphMirror.class/README.md create mode 100644 src/Squot.package/SquotGraphMirror.class/instance/reflectGraphElementWithName.in..st rename src/Squot.package/{SquotObjectGraphMirror.class => SquotGraphMirror.class}/instance/shouldObjectHaveNameAssigned..st (56%) create mode 100644 src/Squot.package/SquotGraphMirror.class/methodProperties.json create mode 100644 src/Squot.package/SquotGraphMirror.class/properties.json create mode 100644 src/Squot.package/SquotObjectGraphMirror.class/instance/reflectGraphElementWithName.in..st create mode 100644 src/Squot.package/SquotObjectRegistry.class/class/squotMirror.st create mode 100644 src/Squot.package/SquotObjectRegistryMirror.class/README.md create mode 100644 src/Squot.package/SquotObjectRegistryMirror.class/instance/canHaveReferences..st create mode 100644 src/Squot.package/SquotObjectRegistryMirror.class/instance/capture.with.ifReplaced..st create mode 100644 src/Squot.package/SquotObjectRegistryMirror.class/instance/is.comparableTo..st create mode 100644 src/Squot.package/SquotObjectRegistryMirror.class/instance/newDiffFrom.to..st create mode 100644 src/Squot.package/SquotObjectRegistryMirror.class/instance/referencesFrom..st create mode 100644 src/Squot.package/SquotObjectRegistryMirror.class/instance/reflectGraphElementWithName.in..st create mode 100644 src/Squot.package/SquotObjectRegistryMirror.class/methodProperties.json create mode 100644 src/Squot.package/SquotObjectRegistryMirror.class/properties.json create mode 100644 src/Squot.package/SquotShadowGraph.class/class/squotMirror.st create mode 100644 src/Squot.package/SquotShadowGraphMirror.class/README.md create mode 100644 src/Squot.package/SquotShadowGraphMirror.class/instance/canHaveReferences..st create mode 100644 src/Squot.package/SquotShadowGraphMirror.class/instance/capture.with.ifReplaced..st create mode 100644 src/Squot.package/SquotShadowGraphMirror.class/instance/is.comparableTo..st create mode 100644 src/Squot.package/SquotShadowGraphMirror.class/instance/newDiffFrom.to..st create mode 100644 src/Squot.package/SquotShadowGraphMirror.class/instance/referencesFrom..st create mode 100644 src/Squot.package/SquotShadowGraphMirror.class/instance/reflectGraphElementWithName.in..st create mode 100644 src/Squot.package/SquotShadowGraphMirror.class/methodProperties.json create mode 100644 src/Squot.package/SquotShadowGraphMirror.class/properties.json diff --git a/src/Squot.package/SquotBitsObjectShadow.class/instance/sameIn.withName.ifAbsent..st b/src/Squot.package/SquotBitsObjectShadow.class/instance/sameIn.withName.ifAbsent..st index e9581f869..fca17d669 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/instance/sameIn.withName.ifAbsent..st +++ b/src/Squot.package/SquotBitsObjectShadow.class/instance/sameIn.withName.ifAbsent..st @@ -2,4 +2,4 @@ accessing sameIn: aShadowGraph withName: aName ifAbsent: aBlock "Unlike objects of my superclass, I can have a name and an identity. Answer the object with the same name from the other graph." - ^ aShadowGraph shadowNamed: aName ifAbsent: aBlock \ No newline at end of file + ^ [aShadowGraph class squotMirror reflect: (SquotGraphElementWithName name: aName) of: aShadowGraph] on: KeyNotFound do: [:e | e return: aBlock value] \ No newline at end of file diff --git a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json index 0b3b1c80f..0f717b74f 100644 --- a/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json +++ b/src/Squot.package/SquotBitsObjectShadow.class/methodProperties.json @@ -11,7 +11,7 @@ "privateApplySequenceDiff:" : "jr 9/24/2019 00:24", "privateApplySequenceDiff:with:" : "jr 10/24/2017 23:42", "references" : "jr 7/25/2021 19:34", - "sameIn:withName:ifAbsent:" : "jr 9/6/2019 22:33", + "sameIn:withName:ifAbsent:" : "jr 9/11/2021 00:08", "squotDiffAgainst:" : "jr 7/30/2021 19:39", "squotDiffAgainst:with:" : "jr 7/30/2021 19:51", "squotMaterializeWith:" : "jr 6/27/2017 17:03", diff --git a/src/Squot.package/SquotDiskProxyShadow.class/instance/sameIn.withName.ifAbsent..st b/src/Squot.package/SquotDiskProxyShadow.class/instance/sameIn.withName.ifAbsent..st index 4ea0c52f7..5ce25c247 100644 --- a/src/Squot.package/SquotDiskProxyShadow.class/instance/sameIn.withName.ifAbsent..st +++ b/src/Squot.package/SquotDiskProxyShadow.class/instance/sameIn.withName.ifAbsent..st @@ -1,3 +1,3 @@ accessing sameIn: aShadowGraph withName: aName ifAbsent: aBlock - ^ aShadowGraph shadowNamed: aName ifAbsent: [aBlock value] \ No newline at end of file + ^ [aShadowGraph class squotMirror reflect: (SquotGraphElementWithName name: aName) of: aShadowGraph] on: KeyNotFound do: [:e | e return: aBlock value] \ No newline at end of file diff --git a/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json b/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json index ae31c4cd9..ebd468a93 100644 --- a/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json +++ b/src/Squot.package/SquotDiskProxyShadow.class/methodProperties.json @@ -7,7 +7,7 @@ "assumeOriginalClassOf:" : "jr 7/18/2021 00:07", "hash" : "jr 4/8/2021 22:22", "proxy" : "jr 4/8/2021 22:25", - "sameIn:withName:ifAbsent:" : "jr 8/31/2019 20:43", + "sameIn:withName:ifAbsent:" : "jr 9/11/2021 00:08", "setDiskProxy:" : "jr 4/8/2021 22:08", "squotDiffAgainst:with:" : "jr 7/30/2021 19:50", "squotMaterializeWith:" : "jr 4/8/2021 22:09", diff --git a/src/Squot.package/SquotGraphElementWithName.class/README.md b/src/Squot.package/SquotGraphElementWithName.class/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/Squot.package/SquotGraphElementWithName.class/class/name..st b/src/Squot.package/SquotGraphElementWithName.class/class/name..st new file mode 100644 index 000000000..f12f2863b --- /dev/null +++ b/src/Squot.package/SquotGraphElementWithName.class/class/name..st @@ -0,0 +1,3 @@ +instance creation +name: name + ^ self new setName: name; yourself \ No newline at end of file diff --git a/src/Squot.package/SquotGraphElementWithName.class/instance/newNameFragment.st b/src/Squot.package/SquotGraphElementWithName.class/instance/newNameFragment.st new file mode 100644 index 000000000..5a167e738 --- /dev/null +++ b/src/Squot.package/SquotGraphElementWithName.class/instance/newNameFragment.st @@ -0,0 +1,5 @@ +capturing +newNameFragment + "Answer a String to put into the non-identifying part of an object name." + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotGraphElementWithName.class/instance/reflect.in..st b/src/Squot.package/SquotGraphElementWithName.class/instance/reflect.in..st new file mode 100644 index 000000000..f81002aa9 --- /dev/null +++ b/src/Squot.package/SquotGraphElementWithName.class/instance/reflect.in..st @@ -0,0 +1,3 @@ +reflection +reflect: aGraph in: aMirror + ^ aMirror reflectGraphElementWithName: name in: aGraph \ No newline at end of file diff --git a/src/Squot.package/SquotGraphElementWithName.class/instance/reflect.in.put..st b/src/Squot.package/SquotGraphElementWithName.class/instance/reflect.in.put..st new file mode 100644 index 000000000..86464566e --- /dev/null +++ b/src/Squot.package/SquotGraphElementWithName.class/instance/reflect.in.put..st @@ -0,0 +1,5 @@ +reflection +reflect: anObject in: aMirror put: newValue + "Replace the value of this reference in anObject." + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotGraphElementWithName.class/instance/setName..st b/src/Squot.package/SquotGraphElementWithName.class/instance/setName..st new file mode 100644 index 000000000..afb3b9236 --- /dev/null +++ b/src/Squot.package/SquotGraphElementWithName.class/instance/setName..st @@ -0,0 +1,3 @@ +initialize-release +setName: newName + name := newName. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphElementWithName.class/methodProperties.json b/src/Squot.package/SquotGraphElementWithName.class/methodProperties.json new file mode 100644 index 000000000..7bbe1cc48 --- /dev/null +++ b/src/Squot.package/SquotGraphElementWithName.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + "name:" : "jr 9/10/2021 22:10" }, + "instance" : { + "newNameFragment" : "jr 9/10/2021 22:07", + "reflect:in:" : "jr 9/10/2021 22:09", + "reflect:in:put:" : "jr 9/10/2021 22:07", + "setName:" : "jr 9/10/2021 22:09" } } diff --git a/src/Squot.package/SquotGraphElementWithName.class/properties.json b/src/Squot.package/SquotGraphElementWithName.class/properties.json new file mode 100644 index 000000000..e7f27ebf4 --- /dev/null +++ b/src/Squot.package/SquotGraphElementWithName.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Squot-Reflection", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "name" ], + "name" : "SquotGraphElementWithName", + "pools" : [ + ], + "super" : "SquotReference", + "type" : "normal" } diff --git a/src/Squot.package/SquotGraphMirror.class/README.md b/src/Squot.package/SquotGraphMirror.class/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/Squot.package/SquotGraphMirror.class/instance/reflectGraphElementWithName.in..st b/src/Squot.package/SquotGraphMirror.class/instance/reflectGraphElementWithName.in..st new file mode 100644 index 000000000..03d0cede5 --- /dev/null +++ b/src/Squot.package/SquotGraphMirror.class/instance/reflectGraphElementWithName.in..st @@ -0,0 +1,3 @@ +reflection +reflectGraphElementWithName: name in: aGraph + self subclassResponsibility \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphMirror.class/instance/shouldObjectHaveNameAssigned..st b/src/Squot.package/SquotGraphMirror.class/instance/shouldObjectHaveNameAssigned..st similarity index 56% rename from src/Squot.package/SquotObjectGraphMirror.class/instance/shouldObjectHaveNameAssigned..st rename to src/Squot.package/SquotGraphMirror.class/instance/shouldObjectHaveNameAssigned..st index adffa6225..06598dc72 100644 --- a/src/Squot.package/SquotObjectGraphMirror.class/instance/shouldObjectHaveNameAssigned..st +++ b/src/Squot.package/SquotGraphMirror.class/instance/shouldObjectHaveNameAssigned..st @@ -1,4 +1,4 @@ testing -shouldObjectHaveNameAssigned: aGraphDiffOrGraph +shouldObjectHaveNameAssigned: anObject "Graphs or diffs of graphs do not get names." ^ false \ No newline at end of file diff --git a/src/Squot.package/SquotGraphMirror.class/methodProperties.json b/src/Squot.package/SquotGraphMirror.class/methodProperties.json new file mode 100644 index 000000000..bd411ea38 --- /dev/null +++ b/src/Squot.package/SquotGraphMirror.class/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "reflectGraphElementWithName:in:" : "jr 9/10/2021 22:19", + "shouldObjectHaveNameAssigned:" : "jr 9/10/2021 22:45" } } diff --git a/src/Squot.package/SquotGraphMirror.class/properties.json b/src/Squot.package/SquotGraphMirror.class/properties.json new file mode 100644 index 000000000..853fb10ce --- /dev/null +++ b/src/Squot.package/SquotGraphMirror.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Squot-Reflection", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "SquotGraphMirror", + "pools" : [ + ], + "super" : "SquotMirror", + "type" : "normal" } diff --git a/src/Squot.package/SquotObjectGraphMirror.class/instance/reflectGraphElementWithName.in..st b/src/Squot.package/SquotObjectGraphMirror.class/instance/reflectGraphElementWithName.in..st new file mode 100644 index 000000000..427780067 --- /dev/null +++ b/src/Squot.package/SquotObjectGraphMirror.class/instance/reflectGraphElementWithName.in..st @@ -0,0 +1,3 @@ +reflection +reflectGraphElementWithName: name in: aGraph + ^ aGraph objectNamed: name \ No newline at end of file diff --git a/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json b/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json index cada86579..5349a3cf3 100644 --- a/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json +++ b/src/Squot.package/SquotObjectGraphMirror.class/methodProperties.json @@ -5,5 +5,5 @@ "defaultMirrorOf:" : "jr 7/4/2021 19:40", "mirrorOf:reachedVia:from:" : "jr 7/17/2021 21:11", "referencesFrom:" : "jr 6/27/2021 22:20", - "search:for:" : "jr 7/4/2021 19:41", - "shouldObjectHaveNameAssigned:" : "jr 6/20/2021 18:52" } } + "reflectGraphElementWithName:in:" : "jr 9/10/2021 22:09", + "search:for:" : "jr 7/4/2021 19:41" } } diff --git a/src/Squot.package/SquotObjectGraphMirror.class/properties.json b/src/Squot.package/SquotObjectGraphMirror.class/properties.json index 4d53ef897..269fce85f 100644 --- a/src/Squot.package/SquotObjectGraphMirror.class/properties.json +++ b/src/Squot.package/SquotObjectGraphMirror.class/properties.json @@ -10,5 +10,5 @@ "name" : "SquotObjectGraphMirror", "pools" : [ ], - "super" : "SquotMirror", + "super" : "SquotGraphMirror", "type" : "normal" } diff --git a/src/Squot.package/SquotObjectRegistry.class/class/squotMirror.st b/src/Squot.package/SquotObjectRegistry.class/class/squotMirror.st new file mode 100644 index 000000000..25dcb1d6d --- /dev/null +++ b/src/Squot.package/SquotObjectRegistry.class/class/squotMirror.st @@ -0,0 +1,3 @@ +as yet unclassified +squotMirror + ^ SquotObjectRegistryMirror new \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRegistry.class/methodProperties.json b/src/Squot.package/SquotObjectRegistry.class/methodProperties.json index 6bf9719ab..ff95dcd99 100644 --- a/src/Squot.package/SquotObjectRegistry.class/methodProperties.json +++ b/src/Squot.package/SquotObjectRegistry.class/methodProperties.json @@ -1,6 +1,6 @@ { "class" : { - }, + "squotMirror" : "jr 9/10/2021 22:44" }, "instance" : { "anySatisfy:" : "jr 7/17/2021 01:55", "assign:to:" : "jr 7/30/2017 01:57", diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/README.md b/src/Squot.package/SquotObjectRegistryMirror.class/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/instance/canHaveReferences..st b/src/Squot.package/SquotObjectRegistryMirror.class/instance/canHaveReferences..st new file mode 100644 index 000000000..68b68d925 --- /dev/null +++ b/src/Squot.package/SquotObjectRegistryMirror.class/instance/canHaveReferences..st @@ -0,0 +1,5 @@ +testing +canHaveReferences: anObject + "Answer whether the kind of anObject is capable of having references to other objects." + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/instance/capture.with.ifReplaced..st b/src/Squot.package/SquotObjectRegistryMirror.class/instance/capture.with.ifReplaced..st new file mode 100644 index 000000000..4afbec81a --- /dev/null +++ b/src/Squot.package/SquotObjectRegistryMirror.class/instance/capture.with.ifReplaced..st @@ -0,0 +1,9 @@ +capturing +capture: anObject with: aSquotObjectCapturer ifReplaced: aBlock + "Answer a snapshot of the object. If it is supposed to be replaced by a proxy, evaluate aBlock with the proxy before creating the snapshot of the proxy." + + "For objects that might have cyclic references, do not attempt to capture the whole object subgraph! Instead enumerate the references, only create the new shadow object and prepare it, then announce the references to the capturer with: + aSquotObjectCapturer capture: referencedObject asValueOf: aReference from: anObject reflectedIn: aMirror + intoValueOf: shadowsReference from: shadowOfAnObject reflectedIn: aShadowMirror" + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/instance/is.comparableTo..st b/src/Squot.package/SquotObjectRegistryMirror.class/instance/is.comparableTo..st new file mode 100644 index 000000000..4632a68c6 --- /dev/null +++ b/src/Squot.package/SquotObjectRegistryMirror.class/instance/is.comparableTo..st @@ -0,0 +1,5 @@ +comparing +is: anObject comparableTo: anotherObject + "Answer true if anObject and anotherObject are of the same kind." + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotObjectRegistryMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..2ca4f5a19 --- /dev/null +++ b/src/Squot.package/SquotObjectRegistryMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,5 @@ +comparing +newDiffFrom: leftObject to: rightObject + "Answer a new instance of a diff suitable to be applied to leftObject." + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/instance/referencesFrom..st b/src/Squot.package/SquotObjectRegistryMirror.class/instance/referencesFrom..st new file mode 100644 index 000000000..82db87600 --- /dev/null +++ b/src/Squot.package/SquotObjectRegistryMirror.class/instance/referencesFrom..st @@ -0,0 +1,5 @@ +enumerating +referencesFrom: anObject + "Answer a collection of all references going out of anObject." + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/instance/reflectGraphElementWithName.in..st b/src/Squot.package/SquotObjectRegistryMirror.class/instance/reflectGraphElementWithName.in..st new file mode 100644 index 000000000..6e2930cdd --- /dev/null +++ b/src/Squot.package/SquotObjectRegistryMirror.class/instance/reflectGraphElementWithName.in..st @@ -0,0 +1,3 @@ +reflection +reflectGraphElementWithName: name in: aSquotObjectRegistry + ^ aSquotObjectRegistry objectNamed: name \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/methodProperties.json b/src/Squot.package/SquotObjectRegistryMirror.class/methodProperties.json new file mode 100644 index 000000000..4dbb77642 --- /dev/null +++ b/src/Squot.package/SquotObjectRegistryMirror.class/methodProperties.json @@ -0,0 +1,10 @@ +{ + "class" : { + }, + "instance" : { + "canHaveReferences:" : "jr 9/10/2021 22:44", + "capture:with:ifReplaced:" : "jr 9/10/2021 22:44", + "is:comparableTo:" : "jr 9/10/2021 22:44", + "newDiffFrom:to:" : "jr 9/10/2021 22:44", + "referencesFrom:" : "jr 9/10/2021 22:44", + "reflectGraphElementWithName:in:" : "jr 9/10/2021 22:45" } } diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/properties.json b/src/Squot.package/SquotObjectRegistryMirror.class/properties.json new file mode 100644 index 000000000..e979c7643 --- /dev/null +++ b/src/Squot.package/SquotObjectRegistryMirror.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Squot-Reflection", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "SquotObjectRegistryMirror", + "pools" : [ + ], + "super" : "SquotGraphMirror", + "type" : "normal" } diff --git a/src/Squot.package/SquotObjectShadow.class/instance/sameIn.withName.ifAbsent..st b/src/Squot.package/SquotObjectShadow.class/instance/sameIn.withName.ifAbsent..st index 4ea0c52f7..5ce25c247 100644 --- a/src/Squot.package/SquotObjectShadow.class/instance/sameIn.withName.ifAbsent..st +++ b/src/Squot.package/SquotObjectShadow.class/instance/sameIn.withName.ifAbsent..st @@ -1,3 +1,3 @@ accessing sameIn: aShadowGraph withName: aName ifAbsent: aBlock - ^ aShadowGraph shadowNamed: aName ifAbsent: [aBlock value] \ No newline at end of file + ^ [aShadowGraph class squotMirror reflect: (SquotGraphElementWithName name: aName) of: aShadowGraph] on: KeyNotFound do: [:e | e return: aBlock value] \ No newline at end of file diff --git a/src/Squot.package/SquotObjectShadow.class/methodProperties.json b/src/Squot.package/SquotObjectShadow.class/methodProperties.json index 0ab25777b..257c8992d 100644 --- a/src/Squot.package/SquotObjectShadow.class/methodProperties.json +++ b/src/Squot.package/SquotObjectShadow.class/methodProperties.json @@ -30,7 +30,7 @@ "references" : "jr 4/10/2021 12:23", "removeInstVarNamed:" : "jr 9/9/2017 14:22", "removeVariablePartSlot:" : "jr 7/20/2017 22:49", - "sameIn:withName:ifAbsent:" : "jr 8/31/2019 20:43", + "sameIn:withName:ifAbsent:" : "jr 9/11/2021 00:08", "setOriginalClass:capturedClass:" : "jr 1/10/2021 23:45", "slots" : "jr 6/17/2017 23:01", "squotDiffAgainst:" : "jr 9/16/2019 21:45", diff --git a/src/Squot.package/SquotPackageShadow.class/instance/sameIn.withName.ifAbsent..st b/src/Squot.package/SquotPackageShadow.class/instance/sameIn.withName.ifAbsent..st index bea4e6a60..ec1a25830 100644 --- a/src/Squot.package/SquotPackageShadow.class/instance/sameIn.withName.ifAbsent..st +++ b/src/Squot.package/SquotPackageShadow.class/instance/sameIn.withName.ifAbsent..st @@ -1,10 +1,11 @@ accessing -sameIn: aShadowGraph withName: aName ifAbsent: aBlock +sameIn: aGraph withName: aName ifAbsent: aBlock | otherEdition | - otherEdition := aShadowGraph shadowNamed: aName ifAbsent: [^ aBlock value]. + otherEdition := [aGraph class squotMirror reflect: (SquotGraphElementWithName name: aName) of: aGraph] on: KeyNotFound do: [:e | ^ aBlock value]. otherEdition packageName ~= packageName ifTrue: "Graph contained a different package." [^ aBlock value]. - self assert: aShadowGraph startShadow undecorated = otherEdition - description: 'Packages should be the source of a tracked object graph'. + (aGraph respondsTo: #startShadow) + ifTrue: [self assert: aGraph startShadow undecorated = otherEdition + description: 'Packages should be the source of a tracked object graph']. ^ otherEdition \ No newline at end of file diff --git a/src/Squot.package/SquotPackageShadow.class/methodProperties.json b/src/Squot.package/SquotPackageShadow.class/methodProperties.json index 4d86c2437..48aa63083 100644 --- a/src/Squot.package/SquotPackageShadow.class/methodProperties.json +++ b/src/Squot.package/SquotPackageShadow.class/methodProperties.json @@ -19,7 +19,7 @@ "monticelloPatcher" : "jr 9/25/2019 21:30", "packageName" : "jr 9/20/2017 21:06", "printOn:" : "jr 7/25/2021 14:23", - "sameIn:withName:ifAbsent:" : "jr 7/25/2021 14:34", + "sameIn:withName:ifAbsent:" : "jr 9/11/2021 00:10", "setPackageName:snapshot:tonelProperties:" : "jr 12/4/2020 20:22", "snapshot:" : "jr 6/6/2020 01:11", "squotDiffAgainst:" : "jr 9/25/2019 22:24", diff --git a/src/Squot.package/SquotShadowGraph.class/class/squotMirror.st b/src/Squot.package/SquotShadowGraph.class/class/squotMirror.st new file mode 100644 index 000000000..4e81ff8c5 --- /dev/null +++ b/src/Squot.package/SquotShadowGraph.class/class/squotMirror.st @@ -0,0 +1,3 @@ +reflecting +squotMirror + ^ SquotShadowGraphMirror new \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraph.class/methodProperties.json b/src/Squot.package/SquotShadowGraph.class/methodProperties.json index 820f9c24d..0508e3365 100644 --- a/src/Squot.package/SquotShadowGraph.class/methodProperties.json +++ b/src/Squot.package/SquotShadowGraph.class/methodProperties.json @@ -2,6 +2,7 @@ "class" : { "anonymousObjectName" : "jr 7/30/2017 18:11", "empty" : "jr 7/7/2021 21:17", + "squotMirror" : "jr 9/10/2021 22:54", "withSingleShadow:" : "jr 9/20/2017 21:14" }, "instance" : { "=" : "jr 3/16/2019 20:28", diff --git a/src/Squot.package/SquotShadowGraphMirror.class/README.md b/src/Squot.package/SquotShadowGraphMirror.class/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/Squot.package/SquotShadowGraphMirror.class/instance/canHaveReferences..st b/src/Squot.package/SquotShadowGraphMirror.class/instance/canHaveReferences..st new file mode 100644 index 000000000..68b68d925 --- /dev/null +++ b/src/Squot.package/SquotShadowGraphMirror.class/instance/canHaveReferences..st @@ -0,0 +1,5 @@ +testing +canHaveReferences: anObject + "Answer whether the kind of anObject is capable of having references to other objects." + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraphMirror.class/instance/capture.with.ifReplaced..st b/src/Squot.package/SquotShadowGraphMirror.class/instance/capture.with.ifReplaced..st new file mode 100644 index 000000000..f03689804 --- /dev/null +++ b/src/Squot.package/SquotShadowGraphMirror.class/instance/capture.with.ifReplaced..st @@ -0,0 +1,3 @@ +capturing +capture: anObject with: aSquotObjectCapturer ifReplaced: aBlock + self shouldNotImplement "graph is supposed to already consist of snapshots of objects" \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraphMirror.class/instance/is.comparableTo..st b/src/Squot.package/SquotShadowGraphMirror.class/instance/is.comparableTo..st new file mode 100644 index 000000000..4632a68c6 --- /dev/null +++ b/src/Squot.package/SquotShadowGraphMirror.class/instance/is.comparableTo..st @@ -0,0 +1,5 @@ +comparing +is: anObject comparableTo: anotherObject + "Answer true if anObject and anotherObject are of the same kind." + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraphMirror.class/instance/newDiffFrom.to..st b/src/Squot.package/SquotShadowGraphMirror.class/instance/newDiffFrom.to..st new file mode 100644 index 000000000..2ca4f5a19 --- /dev/null +++ b/src/Squot.package/SquotShadowGraphMirror.class/instance/newDiffFrom.to..st @@ -0,0 +1,5 @@ +comparing +newDiffFrom: leftObject to: rightObject + "Answer a new instance of a diff suitable to be applied to leftObject." + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraphMirror.class/instance/referencesFrom..st b/src/Squot.package/SquotShadowGraphMirror.class/instance/referencesFrom..st new file mode 100644 index 000000000..82db87600 --- /dev/null +++ b/src/Squot.package/SquotShadowGraphMirror.class/instance/referencesFrom..st @@ -0,0 +1,5 @@ +enumerating +referencesFrom: anObject + "Answer a collection of all references going out of anObject." + + self shouldBeImplemented \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraphMirror.class/instance/reflectGraphElementWithName.in..st b/src/Squot.package/SquotShadowGraphMirror.class/instance/reflectGraphElementWithName.in..st new file mode 100644 index 000000000..e7d5e83b1 --- /dev/null +++ b/src/Squot.package/SquotShadowGraphMirror.class/instance/reflectGraphElementWithName.in..st @@ -0,0 +1,3 @@ +reflection +reflectGraphElementWithName: name in: aGraph + ^ aGraph shadowNamed: name \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraphMirror.class/methodProperties.json b/src/Squot.package/SquotShadowGraphMirror.class/methodProperties.json new file mode 100644 index 000000000..afab215f5 --- /dev/null +++ b/src/Squot.package/SquotShadowGraphMirror.class/methodProperties.json @@ -0,0 +1,10 @@ +{ + "class" : { + }, + "instance" : { + "canHaveReferences:" : "jr 9/10/2021 22:17", + "capture:with:ifReplaced:" : "jr 9/10/2021 22:18", + "is:comparableTo:" : "jr 9/10/2021 22:17", + "newDiffFrom:to:" : "jr 9/10/2021 22:17", + "referencesFrom:" : "jr 9/10/2021 22:17", + "reflectGraphElementWithName:in:" : "jr 9/10/2021 22:19" } } diff --git a/src/Squot.package/SquotShadowGraphMirror.class/properties.json b/src/Squot.package/SquotShadowGraphMirror.class/properties.json new file mode 100644 index 000000000..bbe44e337 --- /dev/null +++ b/src/Squot.package/SquotShadowGraphMirror.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Squot-Reflection", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "SquotShadowGraphMirror", + "pools" : [ + ], + "super" : "SquotGraphMirror", + "type" : "normal" } diff --git a/src/Squot.package/SquotShadowMaterializer.class/instance/rematerializeGraph.into..st b/src/Squot.package/SquotShadowMaterializer.class/instance/rematerializeGraph.into..st index 142a99a4a..3073b1fba 100644 --- a/src/Squot.package/SquotShadowMaterializer.class/instance/rematerializeGraph.into..st +++ b/src/Squot.package/SquotShadowMaterializer.class/instance/rematerializeGraph.into..st @@ -4,11 +4,10 @@ rematerializeGraph: aShadowGraph into: targetMutableObjectGraph targetGraph := targetMutableObjectGraph. NotFound := #(). aShadowGraph shadows do: - [:each | | name existing | - name := aShadowGraph nameOf: each. - existing := objectRegistry objectNamed: name ifAbsent: [NotFound]. + [:each | | existing | + existing := each sameIn: objectRegistry asIn: aShadowGraph ifAbsent: [NotFound]. existing ~~ NotFound - ifTrue: [targetMutableObjectGraph assign: name to: existing]]. + ifTrue: [targetMutableObjectGraph assign: (objectRegistry nameOf: existing) to: existing]]. additionDiff := targetMutableObjectGraph squotDiffAgainst: aShadowGraph. (convertedObjects := SquotPatcher new) registry: targetMutableObjectGraph; diff --git a/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json b/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json index 3c3204834..6c49f6974 100644 --- a/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json +++ b/src/Squot.package/SquotShadowMaterializer.class/methodProperties.json @@ -7,7 +7,7 @@ "registry" : "jr 7/29/2017 18:15", "registry:" : "jr 7/6/2017 15:29", "rematerializeGraph:" : "jr 7/25/2021 15:09", - "rematerializeGraph:into:" : "jr 7/17/2021 02:11", + "rematerializeGraph:into:" : "jr 9/10/2021 22:52", "sourceGraph" : "jr 7/30/2017 02:20", "sourceGraph:" : "jr 7/30/2017 02:20", "targetGraph" : "jr 7/30/2017 02:15", From b7019e267d245f99bd98b8d116eff294f038c90d Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Fri, 10 Sep 2021 23:54:13 +0200 Subject: [PATCH 42/43] Class comments --- src/Squot.package/SquotGraphElementWithName.class/README.md | 1 + .../SquotGraphElementWithName.class/properties.json | 2 +- src/Squot.package/SquotGraphMirror.class/README.md | 1 + src/Squot.package/SquotGraphMirror.class/properties.json | 2 +- src/Squot.package/SquotObjectRegistryMirror.class/README.md | 1 + .../SquotObjectRegistryMirror.class/properties.json | 2 +- src/Squot.package/SquotShadowGraphMirror.class/README.md | 1 + src/Squot.package/SquotShadowGraphMirror.class/properties.json | 2 +- 8 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Squot.package/SquotGraphElementWithName.class/README.md b/src/Squot.package/SquotGraphElementWithName.class/README.md index e69de29bb..b06cd85e4 100644 --- a/src/Squot.package/SquotGraphElementWithName.class/README.md +++ b/src/Squot.package/SquotGraphElementWithName.class/README.md @@ -0,0 +1 @@ +I am the reference to an object that has a certain id in a graph. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphElementWithName.class/properties.json b/src/Squot.package/SquotGraphElementWithName.class/properties.json index e7f27ebf4..5e1301b42 100644 --- a/src/Squot.package/SquotGraphElementWithName.class/properties.json +++ b/src/Squot.package/SquotGraphElementWithName.class/properties.json @@ -4,7 +4,7 @@ ], "classvars" : [ ], - "commentStamp" : "", + "commentStamp" : "jr 9/10/2021 23:51", "instvars" : [ "name" ], "name" : "SquotGraphElementWithName", diff --git a/src/Squot.package/SquotGraphMirror.class/README.md b/src/Squot.package/SquotGraphMirror.class/README.md index e69de29bb..15552813c 100644 --- a/src/Squot.package/SquotGraphMirror.class/README.md +++ b/src/Squot.package/SquotGraphMirror.class/README.md @@ -0,0 +1 @@ +I can access objects in different classes of object graphs. \ No newline at end of file diff --git a/src/Squot.package/SquotGraphMirror.class/properties.json b/src/Squot.package/SquotGraphMirror.class/properties.json index 853fb10ce..69e8be816 100644 --- a/src/Squot.package/SquotGraphMirror.class/properties.json +++ b/src/Squot.package/SquotGraphMirror.class/properties.json @@ -4,7 +4,7 @@ ], "classvars" : [ ], - "commentStamp" : "", + "commentStamp" : "jr 9/10/2021 23:52", "instvars" : [ ], "name" : "SquotGraphMirror", diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/README.md b/src/Squot.package/SquotObjectRegistryMirror.class/README.md index e69de29bb..4d7721955 100644 --- a/src/Squot.package/SquotObjectRegistryMirror.class/README.md +++ b/src/Squot.package/SquotObjectRegistryMirror.class/README.md @@ -0,0 +1 @@ +I can access live objects in a SquotObjectRegistry. \ No newline at end of file diff --git a/src/Squot.package/SquotObjectRegistryMirror.class/properties.json b/src/Squot.package/SquotObjectRegistryMirror.class/properties.json index e979c7643..6c64eba25 100644 --- a/src/Squot.package/SquotObjectRegistryMirror.class/properties.json +++ b/src/Squot.package/SquotObjectRegistryMirror.class/properties.json @@ -4,7 +4,7 @@ ], "classvars" : [ ], - "commentStamp" : "", + "commentStamp" : "jr 9/10/2021 23:52", "instvars" : [ ], "name" : "SquotObjectRegistryMirror", diff --git a/src/Squot.package/SquotShadowGraphMirror.class/README.md b/src/Squot.package/SquotShadowGraphMirror.class/README.md index e69de29bb..bde208d80 100644 --- a/src/Squot.package/SquotShadowGraphMirror.class/README.md +++ b/src/Squot.package/SquotShadowGraphMirror.class/README.md @@ -0,0 +1 @@ +I can access shadows in a SquotShadowGraph (or its subclasses). \ No newline at end of file diff --git a/src/Squot.package/SquotShadowGraphMirror.class/properties.json b/src/Squot.package/SquotShadowGraphMirror.class/properties.json index bbe44e337..b8f16c50b 100644 --- a/src/Squot.package/SquotShadowGraphMirror.class/properties.json +++ b/src/Squot.package/SquotShadowGraphMirror.class/properties.json @@ -4,7 +4,7 @@ ], "classvars" : [ ], - "commentStamp" : "", + "commentStamp" : "jr 9/10/2021 23:53", "instvars" : [ ], "name" : "SquotShadowGraphMirror", From ec00544c1221caffc011df997e0554ad0cb9156b Mon Sep 17 00:00:00 2001 From: Jakob Reschke Date: Sat, 11 Sep 2021 00:07:15 +0200 Subject: [PATCH 43/43] Fix: key not found errors when dealing with older .squot-contents Some properties, such as #objectsReplacedByNames, may not be in .squot-contents of old commits yet. For migration and compatibility, ignore any properties that would be removed according to the diff, but are in fact not even there yet. Ignore failing removals if the target state is still the expected one. --- .../instance/squotApplyTo..st | 2 +- .../SquotTrackedObjectMetadataDiff.class/methodProperties.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Squot.package/SquotTrackedObjectMetadataDiff.class/instance/squotApplyTo..st b/src/Squot.package/SquotTrackedObjectMetadataDiff.class/instance/squotApplyTo..st index 0d2272038..402ed6a65 100644 --- a/src/Squot.package/SquotTrackedObjectMetadataDiff.class/instance/squotApplyTo..st +++ b/src/Squot.package/SquotTrackedObjectMetadataDiff.class/instance/squotApplyTo..st @@ -30,5 +30,5 @@ squotApplyTo: metadata referrer := object. object := each reflect: referrer in: mirror. mirror := mirror mirrorOf: object reachedVia: each from: referrer]. - diff squotReflectOn: object in: mirror]. + [diff squotReflectOn: object in: mirror] on: KeyNotFound do: [:e | diff isRemoval ifTrue: [e return] ifFalse: [e pass]]]. ^ new \ No newline at end of file diff --git a/src/Squot.package/SquotTrackedObjectMetadataDiff.class/methodProperties.json b/src/Squot.package/SquotTrackedObjectMetadataDiff.class/methodProperties.json index 749847a51..361838284 100644 --- a/src/Squot.package/SquotTrackedObjectMetadataDiff.class/methodProperties.json +++ b/src/Squot.package/SquotTrackedObjectMetadataDiff.class/methodProperties.json @@ -6,6 +6,6 @@ "printOn:" : "jr 12/13/2020 18:04", "right" : "jr 12/9/2020 22:59", "setLeft:right:diffs:" : "jr 12/7/2020 22:30", - "squotApplyTo:" : "jr 4/11/2021 20:48", + "squotApplyTo:" : "jr 9/10/2021 23:36", "squotHasChanges" : "jr 12/7/2020 22:31", "update:reflectedIn:asMaterializedFrom:reflectedIn:" : "jr 6/13/2021 20:36" } }