[squeak-dev] The Trunk: Monticello-nice.547.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Jun 2 15:28:19 UTC 2013
Nicolas Cellier uploaded a new version of Monticello to project The Trunk:
http://source.squeak.org/trunk/Monticello-nice.547.mcz
==================== Summary ====================
Name: Monticello-nice.547
Author: nice
Time: 2 June 2013, 5:25:56.867 pm
UUID: e362cb35-f4c1-447b-93f7-4360eb3ba26e
Ancestors: Monticello-nice.546
Encode all .mcz and .mcd text files in UTF8, not only snaphot/source.st.
=============== Diff against Monticello-nice.546 ===============
Item was changed:
+ ----- Method: MCMcdWriter>>writeBaseInfo: (in category 'visiting') -----
- ----- Method: MCMcdWriter>>writeBaseInfo: (in category 'as yet unclassified') -----
writeBaseInfo: aVersionInfo
| string |
string := self serializeVersionInfo: aVersionInfo.
+ self addString: string at: 'base' encodedTo: 'utf8'.
- self addString: string at: 'base'.
!
Item was changed:
+ ----- Method: MCMcdWriter>>writeDefinitions: (in category 'visiting') -----
- ----- Method: MCMcdWriter>>writeDefinitions: (in category 'as yet unclassified') -----
writeDefinitions: aVersion
self writeBaseInfo: aVersion baseInfo.
self writePatch: aVersion patch.!
Item was changed:
+ ----- Method: MCMcdWriter>>writeNewDefinitions: (in category 'visiting') -----
- ----- Method: MCMcdWriter>>writeNewDefinitions: (in category 'as yet unclassified') -----
writeNewDefinitions: aCollection
+ self addString: (self serializeDefinitions: aCollection) at: 'new/source.', self snapshotWriterClass extension encodedTo: 'utf8'.!
- self addString: (self serializeDefinitions: aCollection) at: 'new/source.', self snapshotWriterClass extension.!
Item was changed:
+ ----- Method: MCMcdWriter>>writeOldDefinitions: (in category 'visiting') -----
- ----- Method: MCMcdWriter>>writeOldDefinitions: (in category 'as yet unclassified') -----
writeOldDefinitions: aCollection
+ self addString: (self serializeDefinitions: aCollection) at: 'old/source.', self snapshotWriterClass extension encodedTo: 'utf8'.!
- self addString: (self serializeDefinitions: aCollection) at: 'old/source.', self snapshotWriterClass extension.!
Item was changed:
+ ----- Method: MCMcdWriter>>writePatch: (in category 'visiting') -----
- ----- Method: MCMcdWriter>>writePatch: (in category 'as yet unclassified') -----
writePatch: aPatch
| old new |
old := OrderedCollection new.
new := OrderedCollection new.
aPatch operations do:
[:ea |
ea isRemoval ifTrue: [old add: ea definition].
ea isAddition ifTrue: [new add: ea definition].
ea isModification ifTrue: [old add: ea baseDefinition. new add: ea definition]].
self writeOldDefinitions: old.
self writeNewDefinitions: new.
self addString: (self serializeInBinary: aPatch) at: 'patch.bin'.!
Item was added:
+ ----- Method: MCMczReader>>contentsForMember: (in category 'private') -----
+ contentsForMember: member
+ ^[(member contentStreamFromEncoding: 'utf8') text contents] on: InvalidUTF8
+ do: [:exc |
+ "Case of legacy encoding, presumably it is latin-1.
+ But if contents starts with a null character, it might be a case of WideString encoded in UTF-32BE"
+ | str |
+ str := (member contentStreamFromEncoding: 'latin1') text.
+ exc return: ((str peek = Character null and: [ str size \\ 4 = 0 ])
+ ifTrue: [WideString fromByteArray: str contents asByteArray]
+ ifFalse: [str contents])]!
Item was changed:
----- Method: MCMczReader>>extractDefinitionsFrom: (in category 'as yet unclassified') -----
extractDefinitionsFrom: member
| reader |
(MCSnapshotReader readerClassForFileNamed: member fileName)
+ ifNotNil: [:rc |
+ reader := rc on: (self contentsForMember: member) readStream.
+ definitions addAll: reader definitions]
- ifNotNil: [:rc | reader := rc on: member contentStream text.
- definitions addAll: reader definitions]
!
Item was changed:
----- Method: MCMczReader>>extractDependencyFrom: (in category 'as yet unclassified') -----
extractDependencyFrom: zipMember
^ MCVersionDependency
package: (MCPackage named: (zipMember fileName copyAfterLast: $/))
+ info: (self extractInfoFrom: (self parseMember: zipMember))!
- info: (self extractInfoFrom: (self parseMember: zipMember fileName))!
Item was changed:
+ ----- Method: MCMczReader>>loadDefinitions (in category 'loading') -----
- ----- Method: MCMczReader>>loadDefinitions (in category 'as yet unclassified') -----
loadDefinitions
definitions := OrderedCollection new.
(self zip memberNamed: 'snapshot.bin') ifNotNil:
[:m | [^ definitions := (DataStream on: m contentStream) next definitions]
on: Error do: [:fallThrough ]].
"otherwise"
(self zip membersMatching: 'snapshot/*')
do: [:m | self extractDefinitionsFrom: m].
!
Item was changed:
+ ----- Method: MCMczReader>>loadDependencies (in category 'loading') -----
- ----- Method: MCMczReader>>loadDependencies (in category 'as yet unclassified') -----
loadDependencies
dependencies := (self zip membersMatching: 'dependencies/*') collect: [:m | self extractDependencyFrom: m].
dependencies := dependencies asArray.
!
Item was changed:
+ ----- Method: MCMczReader>>loadPackage (in category 'loading') -----
- ----- Method: MCMczReader>>loadPackage (in category 'as yet unclassified') -----
loadPackage
| dict |
dict := self parseMember: 'package'.
package := MCPackage named: (dict at: #name)!
Item was changed:
+ ----- Method: MCMczReader>>loadVersionInfo (in category 'loading') -----
- ----- Method: MCMczReader>>loadVersionInfo (in category 'as yet unclassified') -----
loadVersionInfo
info := self extractInfoFrom: (self parseMember: 'version')!
Item was changed:
----- Method: MCMczReader>>parseMember: (in category 'as yet unclassified') -----
+ parseMember: memberOrName
+ | member contents tokens |
+ member := self zip member: memberOrName.
+ contents := self contentsForMember: member.
+ tokens := (self scanner scanTokens: contents) first.
- parseMember: fileName
- | tokens |
- tokens := (self scanner scanTokens: (self zip contentsOf: fileName)) first.
^ self associate: tokens!
Item was added:
+ ----- Method: MCMczWriter>>addString:at:encodedTo: (in category 'writing') -----
+ addString: string at: path encodedTo: encodingName
+ | member |
+ member := zip addString: (string convertToEncoding: encodingName) as: path.
+ member desiredCompressionMethod: ZipArchive compressionDeflated
+ !
Item was changed:
----- Method: MCMczWriter>>serializeDefinitions: (in category 'serializing') -----
serializeDefinitions: aCollection
+ ^String streamContents: [:aStream |
- ^(String streamContents: [:aStream |
| writer |
writer := self snapshotWriterClass on: aStream.
+ writer writeDefinitions: aCollection]!
- writer writeDefinitions: aCollection])
- squeakToUtf8!
Item was changed:
----- Method: MCMczWriter>>writePackage: (in category 'visiting') -----
writePackage: aPackage
+ self addString: (self serializePackage: aPackage) at: 'package' encodedTo: 'utf8'!
- self addString: (self serializePackage: aPackage) at: 'package'!
Item was changed:
----- Method: MCMczWriter>>writeSnapshot: (in category 'visiting') -----
writeSnapshot: aSnapshot
+ self addString: (self serializeDefinitions: aSnapshot definitions) at: 'snapshot/source.', self snapshotWriterClass extension encodedTo: 'utf8'.
- self addString: (self serializeDefinitions: aSnapshot definitions) at: 'snapshot/source.', self snapshotWriterClass extension.
self addString: (self serializeInBinary: aSnapshot) at: 'snapshot.bin'!
Item was changed:
----- Method: MCMczWriter>>writeVersionDependency: (in category 'visiting') -----
writeVersionDependency: aVersionDependency
| string |
string := (self serializeVersionInfo: aVersionDependency versionInfo).
+ self addString: string at: 'dependencies/', aVersionDependency package name encodedTo: 'utf8'!
- self addString: string at: 'dependencies/', aVersionDependency package name!
Item was changed:
----- Method: MCMczWriter>>writeVersionInfo: (in category 'visiting') -----
writeVersionInfo: aVersionInfo
| string |
string := self serializeVersionInfo: aVersionInfo.
+ self addString: string at: 'version' encodedTo: 'utf8'.
- self addString: string at: 'version'.
!
Item was changed:
----- Method: MCStReader>>readStream (in category 'evaluating') -----
readStream
- | contents |
- contents := stream contents.
- contents := [contents utf8ToSqueak] on: InvalidUTF8 do: [:exc |
- "Case of legacy encoding, presumably it is latin-1 and we do not need to do anything
- But if contents starts with a null character, it might be a case of WideString encoded in UTF-32BE"
- exc return: (((contents beginsWith: Character null asString) and: [ contents size \\ 4 = 0 ])
- ifTrue: [WideString fromByteArray: contents asByteArray]
- ifFalse: [contents])].
^ ('!!!!
+ ', stream contents) readStream!
- ', contents) readStream!
Item was changed:
+ ----- Method: MCWriter>>stream (in category 'accessing') -----
- ----- Method: MCWriter>>stream (in category 'as yet unclassified') -----
stream
^ stream!
Item was changed:
+ ----- Method: MCWriter>>stream: (in category 'accessing') -----
- ----- Method: MCWriter>>stream: (in category 'as yet unclassified') -----
stream: aStream
stream := aStream!
More information about the Squeak-dev
mailing list
|