diff --git a/src/MiniDocs/GrafoscopioNode.class.st b/src/MiniDocs/GrafoscopioNode.class.st index 280d2f4..d4bc35c 100644 --- a/src/MiniDocs/GrafoscopioNode.class.st +++ b/src/MiniDocs/GrafoscopioNode.class.st @@ -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 ].