From 42aadbacd069d259d123b1efd583107b67088993 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Wed, 31 Jan 2024 16:08:30 +0100 Subject: [PATCH 1/2] Allow to set the tonel version This change allows to set the tonel version to use in the .properties file of the repository --- Iceberg-Libgit-Tonel/IceLibgitTonelWriter.class.st | 7 ++++--- Iceberg-Libgit/IceRepositoryProperties.class.st | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Iceberg-Libgit-Tonel/IceLibgitTonelWriter.class.st b/Iceberg-Libgit-Tonel/IceLibgitTonelWriter.class.st index dff3220f26..869bef4ae7 100644 --- a/Iceberg-Libgit-Tonel/IceLibgitTonelWriter.class.st +++ b/Iceberg-Libgit-Tonel/IceLibgitTonelWriter.class.st @@ -37,9 +37,10 @@ IceLibgitTonelWriter class >> forInternalStore [ { #category : 'writing' } IceLibgitTonelWriter class >> forInternalStoreFileOut: aMCVersion on: aRepository [ - self forInternalStore - fileOut: aMCVersion - on: aRepository subdirectoryReference + + (self forInternalStore forVersion: (aRepository properties tonelVersion ifNil: [ self forInternalStore defaultVersion ])) new + directoryReference: aRepository subdirectoryReference; + writeVersion: aMCVersion ] { #category : 'accessing' } diff --git a/Iceberg-Libgit/IceRepositoryProperties.class.st b/Iceberg-Libgit/IceRepositoryProperties.class.st index 3f47452796..cfb6a06f3d 100644 --- a/Iceberg-Libgit/IceRepositoryProperties.class.st +++ b/Iceberg-Libgit/IceRepositoryProperties.class.st @@ -210,6 +210,12 @@ IceRepositoryProperties >> storeOnFileReference: aFileReference [ nextPut: self properties ] ] +{ #category : 'private' } +IceRepositoryProperties >> tonelVersion [ + + ^ self properties at: #version ifAbsent: [ nil ] +] + { #category : 'accessing' } IceRepositoryProperties >> writerClass [ ^ self properties From b63f84efbe3d82ed24bd584740cbce9d6df6c014 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Wed, 31 Jan 2024 16:10:41 +0100 Subject: [PATCH 2/2] Simplify some code --- Iceberg-Libgit/IceRepositoryProperties.class.st | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Iceberg-Libgit/IceRepositoryProperties.class.st b/Iceberg-Libgit/IceRepositoryProperties.class.st index cfb6a06f3d..1e54d11eae 100644 --- a/Iceberg-Libgit/IceRepositoryProperties.class.st +++ b/Iceberg-Libgit/IceRepositoryProperties.class.st @@ -50,9 +50,8 @@ IceRepositoryProperties class >> propertiesFileName [ { #category : 'instance creation' } IceRepositoryProperties class >> readPropertiesFrom: aFileReference [ - self flag: #pharoFixMe. "When Pharo 6.1 will not be supported anymore we can directly use: `ref readStreamDo: [ :stream | STON fromStream: stream ]` but currently FileReference>>readStream return a ZnBufferedStream in Pharo 61 and a ZnCharacterReadStream decoding utf8 in Pharo 7." - ^ aFileReference - binaryReadStreamDo: [ :stream | STON fromStream: (ZnCharacterReadStream on: stream encoding: 'utf8') ] + + ^ aFileReference readStreamDo: [ :stream | STON fromStream: stream ] ] { #category : 'comparing' }