Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert 1790 revert 1753 6797 issue from pharo #1791

Closed
wants to merge 9 commits into from
2 changes: 1 addition & 1 deletion BaselineOfIceberg/BaselineOfIceberg.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ BaselineOfIceberg >> libgit: spec [
baseline: 'LibGit'
with: [
spec
repository: 'github://pharo-vcs/libgit2-pharo-bindings:v3.0.9';
repository: 'github://pharo-vcs/libgit2-pharo-bindings:v3.0.8';
loads: 'default' ].
spec
project: 'LibGit-Tests'
Expand Down
26 changes: 12 additions & 14 deletions Iceberg-Libgit-Filetree/IceLibgitFiletreeFileUtils.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@
Emulates other 'file utils' classes by reading from a git repository (its blob, not a working copy'). Allows for reading any tree (from any commit) in the repository.
"
Class {
#name : 'IceLibgitFiletreeFileUtils',
#superclass : 'Object',
#category : 'Iceberg-Libgit-Filetree-Utilities',
#package : 'Iceberg-Libgit-Filetree',
#tag : 'Utilities'
#name : #IceLibgitFiletreeFileUtils,
#superclass : #Object,
#category : #'Iceberg-Libgit-Filetree-Utilities'
}

{ #category : 'utilities' }
{ #category : #utilities }
IceLibgitFiletreeFileUtils class >> deleteAll: aTreeBuilder [
^ aTreeBuilder deleteAll
]

{ #category : 'utilities' }
{ #category : #utilities }
IceLibgitFiletreeFileUtils class >> directoryExists: aLGitTreeEntry [
^ aLGitTreeEntry type = LGitObjectTypeEnum git_obj_tree
]

{ #category : 'utilities' }
{ #category : #utilities }
IceLibgitFiletreeFileUtils class >> directoryFromEntry: treeEntry [
^ treeEntry object
]

{ #category : 'utilities' }
{ #category : #utilities }
IceLibgitFiletreeFileUtils class >> directoryFromPath: aString relativeTo: aCommitOrTree [
^ aCommitOrTree
entryByPath: aString
Expand All @@ -33,27 +31,27 @@ IceLibgitFiletreeFileUtils class >> directoryFromPath: aString relativeTo: aComm

]

{ #category : 'utilities' }
{ #category : #utilities }
IceLibgitFiletreeFileUtils class >> directoryName: anEntry [
^ anEntry filename
]

{ #category : 'utilities' }
{ #category : #utilities }
IceLibgitFiletreeFileUtils class >> fileName: anEntry [
^ anEntry filename
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeFileUtils class >> pathNameDelimiter [
^ $/
]

{ #category : 'utilities' }
{ #category : #utilities }
IceLibgitFiletreeFileUtils class >> readStreamFor: fileName in: tree do: aBlock [
(tree entryByPath: fileName) readStreamDo: aBlock
]

{ #category : 'utilities' }
{ #category : #utilities }
IceLibgitFiletreeFileUtils class >> writeStreamFor: fileName in: directory do: aBlock [
directory addEntryNamed: fileName withContents: (String streamContents: aBlock).
]
28 changes: 13 additions & 15 deletions Iceberg-Libgit-Filetree/IceLibgitFiletreeLog.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,52 @@
I'm a tool to ask the full history of a method (based on filetree file format).
"
Class {
#name : 'IceLibgitFiletreeLog',
#superclass : 'IceLog',
#category : 'Iceberg-Libgit-Filetree-Log',
#package : 'Iceberg-Libgit-Filetree',
#tag : 'Log'
#name : #IceLibgitFiletreeLog,
#superclass : #IceLog,
#category : #'Iceberg-Libgit-Filetree-Log'
}

{ #category : 'testing' }
{ #category : #testing }
IceLibgitFiletreeLog class >> isAvailableFor: aRepository [
^ aRepository writerClass id = #filetree
]

{ #category : 'private' }
{ #category : #private }
IceLibgitFiletreeLog >> basepathOf: aPath [
^ aPath
]

{ #category : 'private' }
{ #category : #private }
IceLibgitFiletreeLog >> cypressClassOrTraitName: aMethod [
^ aMethod origin instanceSide name, (self cypressMethodClassExtension: aMethod)

]

{ #category : 'private' }
{ #category : #private }
IceLibgitFiletreeLog >> cypressMethodClassExtension: aMethod [
aMethod isExtension ifTrue: [ ^ '.extension' ].
aMethod origin isTrait ifTrue: [ ^ '.trait' ].
^ '.class'
]

{ #category : 'private' }
{ #category : #private }
IceLibgitFiletreeLog >> cypressMethodName: aMethod [
^ (MCFileTreeStCypressWriter fileNameForSelector: aMethod selector asString), '.st'
]

{ #category : 'private' }
{ #category : #private }
IceLibgitFiletreeLog >> cypressMethodSideName: aMethod [
^ aMethod origin isClassSide
ifTrue: [ 'class' ]
ifFalse: [ 'instance' ]
]

{ #category : 'private' }
{ #category : #private }
IceLibgitFiletreeLog >> cypressPackageName: aPackage [
^ aPackage name, '.package'
]

{ #category : 'private' }
{ #category : #private }
IceLibgitFiletreeLog >> definitionFor: aMethod path: aPath commit: aCommit [
^ ((IceLibgitFiletreeLogReader fileName: aPath on: aCommit)
package: aMethod package mcPackage;
Expand All @@ -68,7 +66,7 @@ IceLibgitFiletreeLog >> definitionFor: aMethod path: aPath commit: aCommit [
source: '' ]
]

{ #category : 'private' }
{ #category : #private }
IceLibgitFiletreeLog >> fileNameForMethod: aMethod [
| path |

Expand All @@ -85,7 +83,7 @@ IceLibgitFiletreeLog >> fileNameForMethod: aMethod [
path asStringOn: stream delimiter: '/' ]
]

{ #category : 'private' }
{ #category : #private }
IceLibgitFiletreeLog >> toFileName: aMethod [
^ self fileNameForMethod: aMethod
]
20 changes: 9 additions & 11 deletions Iceberg-Libgit-Filetree/IceLibgitFiletreeLogReader.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,32 @@ I read exclusively the definition of the method defined in fileName.
I'm using to speed the creation of a version list on IceLibgitFiletreeLog.
"
Class {
#name : 'IceLibgitFiletreeLogReader',
#superclass : 'IceLibgitFiletreeReader',
#name : #IceLibgitFiletreeLogReader,
#superclass : #IceLibgitFiletreeReader,
#instVars : [
'fileName'
],
#category : 'Iceberg-Libgit-Filetree-Reader',
#package : 'Iceberg-Libgit-Filetree',
#tag : 'Reader'
#category : #'Iceberg-Libgit-Filetree-Reader'
}

{ #category : 'instance creation' }
{ #category : #'instance creation' }
IceLibgitFiletreeLogReader class >> fileName: aString on: aCommit [
^ (self on: aCommit)
fileName: aString;
yourself
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeLogReader >> fileName [
^ fileName
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeLogReader >> fileName: aString [
fileName := aString
]

{ #category : 'utilities' }
{ #category : #utilities }
IceLibgitFiletreeLogReader >> loadDefinitions [
| entry segments className classIsMeta entryPath packageIndex |

Expand Down Expand Up @@ -65,12 +63,12 @@ IceLibgitFiletreeLogReader >> loadDefinitions [
source: source) ]
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeLogReader >> package [
^ package
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeLogReader >> package: aPackage [
package := aPackage
]
32 changes: 15 additions & 17 deletions Iceberg-Libgit-Filetree/IceLibgitFiletreeReader.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ Reads an MCVersion from a git repository (its blob, not a working copy!) using l
Currently we only support metadata-less repositories.
"
Class {
#name : 'IceLibgitFiletreeReader',
#superclass : 'MCFileTreeStCypressReader',
#name : #IceLibgitFiletreeReader,
#superclass : #MCFileTreeStCypressReader,
#traits : 'TIceRepositoryReader',
#classTraits : 'TIceRepositoryReader classTrait',
#instVars : [
'iceVersion'
],
#category : 'Iceberg-Libgit-Filetree-Reader',
#package : 'Iceberg-Libgit-Filetree',
#tag : 'Reader'
#category : #'Iceberg-Libgit-Filetree-Reader'
}

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeReader class >> compatibleAuthorNameOf: aString [
"Timestamp of method has a very precise format that needs to be fulfiled:

Expand All @@ -28,60 +26,60 @@ IceLibgitFiletreeReader class >> compatibleAuthorNameOf: aString [
^ aString reject: [ :each | each = Character space ]
]

{ #category : 'testing' }
{ #category : #testing }
IceLibgitFiletreeReader class >> id [
^ #filetree
]

{ #category : 'testing' }
{ #category : #testing }
IceLibgitFiletreeReader class >> isLegacyDefault [
^ true
]

{ #category : 'instance creation' }
{ #category : #'instance creation' }
IceLibgitFiletreeReader class >> on: aCommitOrTree iceVersion: iceVersion [
^ (self on: aCommitOrTree)
iceVersion: iceVersion;
yourself
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeReader >> commit [
^ stream
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeReader >> fileUtils [
^ IceLibgitFiletreeFileUtils
]

{ #category : 'testing' }
{ #category : #testing }
IceLibgitFiletreeReader >> hasMonticelloMetadata [
^ false
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeReader >> iceVersion [
^ iceVersion
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeReader >> iceVersion: anObject [
iceVersion := anObject.
self packageDirectory: (iceVersion commit project sourceDirectoryPath / (IceLibgitFiletreeWriter directoryNameFor: (IcePackage named: iceVersion package name repository: iceVersion commit repository))) pathString
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeReader >> loadVersionInfo [
^ info := self iceVersion info
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeReader >> packageNameFromPackageDirectory [
^ iceVersion packageName
]

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeReader >> versionName [
^ ('{1}-{2}.{3}' format: {
self packageNameFromPackageDirectory.
Expand Down
14 changes: 6 additions & 8 deletions Iceberg-Libgit-Filetree/IceLibgitFiletreeSnapshotWriter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@ I'm a filetree snapshot writer to ensure the output will be libgit2 compatible.
I'm not surre I cannot unify myself class with my parent.
"
Class {
#name : 'IceLibgitFiletreeSnapshotWriter',
#superclass : 'IceMetadatalessStCypressWriter',
#category : 'Iceberg-Libgit-Filetree-Writer',
#package : 'Iceberg-Libgit-Filetree',
#tag : 'Writer'
#name : #IceLibgitFiletreeSnapshotWriter,
#superclass : #IceMetadatalessStCypressWriter,
#category : #'Iceberg-Libgit-Filetree-Writer'
}

{ #category : 'accessing' }
{ #category : #accessing }
IceLibgitFiletreeSnapshotWriter >> fileUtils [
^ IceLibgitFiletreeFileUtils
]

{ #category : 'initialize-release' }
{ #category : #'initialize-release' }
IceLibgitFiletreeSnapshotWriter >> propertyFileExtension [
^ MCFileTreeRepository defaultPropertyFileExtension
]

{ #category : 'visiting' }
{ #category : #visiting }
IceLibgitFiletreeSnapshotWriter >> writeInDirectoryName: directoryNameOrPath fileName: fileName extension: ext visit: visitBlock [
| directory |
directory := self directoryForDirectoryNamed: directoryNameOrPath.
Expand Down
Loading
Loading