Support for GrafoscopioNode remote location in Fossil, for getting estimated creation of Grafoscopio notebooks/nodes.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-04-17 20:50:14 -05:00
parent 51ad735e0e
commit 006b8c6663
1 changed files with 26 additions and 2 deletions

View File

@ -15,7 +15,8 @@ Class {
'edited',
'headers',
'key',
'output'
'output',
'remoteLocations'
],
#category : #MiniDocs
}
@ -26,6 +27,11 @@ GrafoscopioNode class >> fromFile: aFileReference [
^ (STON fromString: aFileReference contents) first parent
]
{ #category : #accessing }
GrafoscopioNode >> addRemoteLocation: anURL [
self remoteLocations add: anURL
]
{ #category : #accessing }
GrafoscopioNode >> ancestors [
"I return a collection of all the nodes wich are ancestors of the receiver node"
@ -115,12 +121,25 @@ GrafoscopioNode >> earliestCreationDate [
self nodesWithCreationDates ifNotEmpty: [
earliest := self nodesWithCreationDates first created]
ifEmpty: [ earliest := self ].
ifEmpty: [ earliest := self earliestRepositoryTimestamp].
self nodesWithCreationDates do: [:node |
node created <= earliest ifTrue: [ earliest := node created ] ].
^ earliest
]
{ #category : #accessing }
GrafoscopioNode >> earliestRepositoryTimestamp [
| remote fossilHost docSegments repo |
remote := self remoteLocations first asUrl.
fossilHost := 'https://mutabit.com/repos.fossil'.
(remote asString includesSubstring: fossilHost) ifFalse: [ ^ false ].
docSegments := remote segments copyFrom: 5 to: remote segments size.
repo := FossilRepo new
remote: (remote scheme, '://', remote host, '/', remote segments first, '/', remote segments second).
^ repo
firstCheckinFor: ('/' join: docSegments)
]
{ #category : #accessing }
GrafoscopioNode >> edited [
^ edited ifNotNil: [^ edited asDateAndTime ]
@ -245,6 +264,11 @@ GrafoscopioNode >> printOn: aStream [
nextPutAll: '( ', self header, ' )'
]
{ #category : #accessing }
GrafoscopioNode >> remoteLocations [
^ remoteLocations ifNil: [ remoteLocations := OrderedCollection new]
]
{ #category : #accessing }
GrafoscopioNode >> root [
self level = 0 ifTrue: [ ^ self ].