Fossil timeline stores all parents info.
This commit is contained in:
parent
264193be5e
commit
553d8b8552
@ -38,12 +38,12 @@ FossilTimeline >> commits: anObject [
|
|||||||
FossilTimeline >> importFromUrl: aJsonFileUrl [
|
FossilTimeline >> importFromUrl: aJsonFileUrl [
|
||||||
"Imports all commits stored in aJsonFileUrl and converts them in a collection of FossilCommit objects"
|
"Imports all commits stored in aJsonFileUrl and converts them in a collection of FossilCommit objects"
|
||||||
|
|
||||||
| commitsDict |
|
| commitsDict parents i |
|
||||||
|
|
||||||
"Extracting data"
|
"Extracting data"
|
||||||
commitsDict := ((NeoJSONReader fromString: (aJsonFileUrl asUrl retrieveContents asString)) at: 'payload') at: 'timeline'.
|
commitsDict := ((NeoJSONReader fromString: (aJsonFileUrl asUrl retrieveContents asString)) at: 'payload') at: 'timeline'.
|
||||||
|
|
||||||
"Transforming the data"
|
"Adding all commits except the first one who has no parents"
|
||||||
self commits: (commitsDict collect: [:commit |
|
self commits: (commitsDict collect: [:commit |
|
||||||
FossilCommit new
|
FossilCommit new
|
||||||
uuid: (commit at: 'uuid');
|
uuid: (commit at: 'uuid');
|
||||||
@ -51,8 +51,13 @@ FossilTimeline >> importFromUrl: aJsonFileUrl [
|
|||||||
timestamp: (commit at: 'timestamp');
|
timestamp: (commit at: 'timestamp');
|
||||||
user: (commit at: 'user');
|
user: (commit at: 'user');
|
||||||
comment: (commit at: 'comment');
|
comment: (commit at: 'comment');
|
||||||
"parents: (commit at: 'parents');"
|
|
||||||
tags: (commit at: 'tags')]).
|
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)]
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
{ #category : #'as yet unclassified' }
|
||||||
|
Loading…
Reference in New Issue
Block a user