Fix (bad) source corruption when committing private classes
This commit fixes a really bad bug causing source corruption when
committing private classes *and* when using original repository for
commits ( `hgUseOriginalRepositories: true`).
This was becase private classes's source was not made local prior opening
the enclosing class's container for writing! Sigh.
--- a/common/SCMAbstractPackageWorkingCopy.st Fri Feb 19 12:14:01 2021 +0100
+++ b/common/SCMAbstractPackageWorkingCopy.st Fri Jul 09 06:47:09 2021 +0100
@@ -416,28 +416,21 @@
!SCMAbstractPackageWorkingCopy methodsFor:'file out'!
-fileOutClass:cls
-
- |stream|
-
- cls theNonMetaclass methodDictionary do:
- [:each|each makeLocalStringSource].
+fileOutClass: cls
+ | stream |
- cls theMetaclass methodDictionary do:
- [:each|each makeLocalStringSource].
-
- stream := self containerWriteStreamForClass:cls.
+ self makeLocalStringSource: cls.
+ stream := self containerWriteStreamForClass: cls.
[
- self fileOutClass:cls on:stream
- ] ensure:[
- stream close
- ]
+ self fileOutClass: cls on: stream
+ ] ensure: [ stream close ]
"Modified: / 11-06-2009 / 16:18:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Created: / 30-12-2009 / 19:04:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 03-07-2013 / 19:50:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (format): / 30-07-2014 / 20:49:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 26-10-2020 / 23:51:41 / Jan Vrany <jan.vrany@labware.com>"
+ "Modified (format): / 04-07-2021 / 21:48:46 / Jan Vrany <jan.vrany@labware.com>"
!
fileOutClass:cls on:clsStream
@@ -745,6 +738,23 @@
"Modified (comment): / 05-03-2014 / 23:21:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+makeLocalStringSource: cls
+ "Make sure all methods in given class (and its private classes)
+ have 'local' source (that is, the source is in smalltalk memory
+ as opposed to in a file on a disk)
+ "
+
+ cls theNonMetaclass methodDictionary do: [:each |
+ each makeLocalStringSource
+ ].
+ cls theMetaclass methodDictionary do: [:each |
+ each makeLocalStringSource
+ ].
+ cls privateClassesDo: [ :each | self makeLocalStringSource: each ]
+
+ "Modified: / 09-07-2021 / 06:48:53 / Jan Vrany <jan.vrany@labware.com>"
+!
+
updateCachedValues
"Update all cached data"