The Inbox: MonticelloConfigurations-dtl.165.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: MonticelloConfigurations-dtl.165.mcz

commits-2
A new version of MonticelloConfigurations was added to project The Inbox:
http://source.squeak.org/inbox/MonticelloConfigurations-dtl.165.mcz

==================== Summary ====================

Name: MonticelloConfigurations-dtl.165
Author: dtl
Time: 15 April 2020, 12:34:34.971324 pm
UUID: 51a442f7-9ad9-4b66-b9ea-d64be6b75d4b
Ancestors: MonticelloConfigurations-dtl.164

Add comments to explain how key prefixes are used to provide backward compatibility for older images reading newer MCM files.

=============== Diff against MonticelloConfigurations-dtl.164 ===============

Item was changed:
  ----- Method: MCConfiguration class>>copyWithoutKeyPrefix: (in category 'private') -----
  copyWithoutKeyPrefix: configArray
  "Tokens in the version history portion of configArray are prefixed with $X to
  prevent them being parsed in the original implementation of MCConfiguration.
  Here we remove the prefixes prior to processing in the current implementation
+ with MCConfigurationExtended support. See #contentsOn:keyPrefix: for the
+ prefix writer."
- with MCConfigurationExtended support."
  | strm |
  strm := #() writeStream.
  configArray do: [ :token |
  token caseOf: {
  [#Xname ] -> [ strm nextPut: #name] .
  [#Xrepository ] -> [ strm nextPut: #repository] .
  [#Xdependency ] -> [ strm nextPut: #dependency] .
  [#XmcmVersion] -> [ strm nextPut: #mcmVersion] .
  [#Xid] -> [ strm nextPut: #id] .
  [#XauthorInitials ] -> [ strm nextPut: #authorInitials] .
  [#XtimeStamp ] -> [ strm nextPut: #timeStamp] .
  [#Xcomment ] -> [ strm nextPut: #comment]
  }
  otherwise: [ strm nextPut: token]
 
 
  ].
  ^ strm contents.
 
  !

Item was changed:
  ----- Method: MCConfiguration>>contentsOn:keyPrefix: (in category 'printing') -----
  contentsOn: aStream keyPrefix: prefix
+ "Prepend prefix to key values. If the prefix is a non-empty string, the resulting
+ key values will be ignored when parsing an original format MCConfiguration
+ from an extended format MCM file. This provides backward compatibility for
+ older images that need to read newer format MCM files."
 
  name ifNotNil: [:n |
  aStream cr.
  aStream nextPutAll: prefix,'name '.
  aStream print: n].
 
  repositories do: [:ea |
  aStream cr.
  aStream nextPutAll: prefix,'repository '.
  (MCConfiguration repositoryToArray: ea) printElementsOn: aStream].
 
  dependencies do: [:ea |
  aStream cr.
  aStream nextPutAll: prefix,'dependency '.
  (MCConfiguration dependencyToArray: ea) printElementsOn: aStream].
  !

Item was changed:
  ----- Method: MCConfigurationExtended>>contentsOn:keyPrefix: (in category 'printing') -----
  contentsOn: aStream keyPrefix: prefix
 
  super contentsOn: aStream keyPrefix: prefix.
 
  mcmVersion ifNotNil: [:ver |
  aStream cr.
  aStream nextPutAll: prefix,'mcmVersion '.
  aStream print: ver].
 
  id ifNotNil: [:uuid |
  aStream cr.
  aStream nextPutAll: prefix,'id '.
  aStream print: uuid].
 
  authorInitials ifNotNil: [:initials |
  aStream cr.
  aStream nextPutAll: prefix,'authorInitials '.
  aStream print: initials].
 
  timeStamp ifNotNil: [:ts |
  aStream cr.
  aStream nextPutAll: prefix,'timeStamp '.
  aStream print: ts].
 
  comment ifNotNil: [:c |
  aStream cr.
  aStream nextPutAll: prefix,'comment '.
  aStream print: c].
 
  "Keys in the prior versions have a prefix to prevent them being parsed
  into a MCConfiguration when an image that does not contain support for the
  newer MCConfigurationExtended format. This allows older images to read
  an MCM file with extended format and version history, treating it as if it
+ were data for the original MCConfiguration. See #copyWithoutKeyPrefix:
+ for removal of the prefix during parsing."
- were data for the original MCConfiguration."
  priorVersions do: [:e | e copyWithoutHistory contentsOn: aStream keyPrefix: 'X'].
  !