Fossil > parents are now fossil commit objects instead of plain text of the uuid.
This commit is contained in:
parent
553d8b8552
commit
5b6435ee86
@ -38,26 +38,25 @@ FossilTimeline >> commits: anObject [
|
||||
FossilTimeline >> importFromUrl: aJsonFileUrl [
|
||||
"Imports all commits stored in aJsonFileUrl and converts them in a collection of FossilCommit objects"
|
||||
|
||||
| commitsDict parents i |
|
||||
| commitsDict |
|
||||
|
||||
"Extracting data"
|
||||
commitsDict := ((NeoJSONReader fromString: (aJsonFileUrl asUrl retrieveContents asString)) at: 'payload') at: 'timeline'.
|
||||
|
||||
"Adding all commits except the first one who has no parents"
|
||||
self commits: (commitsDict collect: [:commit |
|
||||
FossilCommit new
|
||||
uuid: (commit at: 'uuid');
|
||||
type: (commit at: 'type');
|
||||
timestamp: (commit at: 'timestamp');
|
||||
user: (commit at: 'user');
|
||||
comment: (commit at: 'comment');
|
||||
tags: (commit at: 'tags')]).
|
||||
FossilCommit new
|
||||
uuid: (commit at: 'uuid');
|
||||
type: (commit at: 'type');
|
||||
timestamp: (commit at: 'timestamp');
|
||||
user: (commit at: 'user');
|
||||
comment: (commit at: 'comment');
|
||||
tags: (commit at: 'tags')]).
|
||||
"Adding parents for all commits except the first one who has no parents"
|
||||
parents := commitsDict allButLast collect: [:each | (each at: 'parents')].
|
||||
i := 0.
|
||||
self commits allButLastDo: [:commit |
|
||||
i := i + 1.
|
||||
commit parents: (parents at: i)]
|
||||
commit parents: (
|
||||
"Seach for every parent in the commitsDict and adding it as parent to the commit properties"
|
||||
commits select: [:each | each uuid = (((commitsDict at: 1) at: 'parents') at: 1)])]
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
@ -66,3 +65,10 @@ FossilTimeline >> initialize [
|
||||
|
||||
super initialize
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilTimeline >> parentsFor: aCommit [
|
||||
"Returns the elements which are parents for aCommit"
|
||||
|
||||
^ self commits select: [:commit | commit uuid = (aCommit parents at: 1)]
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user