From 2353ffb15f17f450a4bb67525f204cbbfdaa524c Mon Sep 17 00:00:00 2001 From: ruidajo Date: Thu, 3 Mar 2022 20:38:14 -0500 Subject: [PATCH] Creating FossilRepo and TiddlyWiki interactions. --- repository/TiddlyWiki/TiddlyWiki.class.st | 39 ++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index 63e33d0..99c3624 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -41,6 +41,17 @@ TiddlyWiki >> addToConfigFile [ ^ MarkupFile exportAsFileOn: self configFile containing:(STON toStringPretty: newConfig) ] +{ #category : #testing } +TiddlyWiki >> belongsToLocalRepository [ + + | localFolder tempRepo relativeName | + localFolder := self detectRepositoryLocal ifNil: [ ^ false ]. + tempRepo := FossilRepo new + local: localFolder. + relativeName := self file fullName withoutPrefix: (tempRepo local fullName, '/'). + ^ tempRepo listUnversioned hasLiteral: relativeName +] + { #category : #accessing } TiddlyWiki >> changesAfter: aDateString [ @@ -96,14 +107,16 @@ TiddlyWiki >> contentTiddlersWithoutLargeTiddlers [ ] { #category : #accessing } -TiddlyWiki >> detectRepository [ +TiddlyWiki >> detectRepositoryLocal [ | folder folderItems | folder := self file parent. folderItems := folder children. - [(folderItems select: [ :path | path basename beginsWith: '.fossil' ]) isEmpty] - whileTrue: [folder := folder parent. - folderItems := folder children.]. + [(folderItems select: [ :path | path basename beginsWith: '.fossil' ]) isEmpty + and:[ (folder = FileLocator root) not ]] + whileTrue: [folder := folder parent. + folderItems := folder children.]. + folder = FileLocator root ifTrue: [ ^ nil ]. ^ folder ] @@ -402,6 +415,17 @@ TiddlyWiki >> remote: aUrlString [ remote := aUrlString asZnUrl ] +{ #category : #accessing } +TiddlyWiki >> repository [ + + | repo | + self belongsToLocalRepository ifFalse: [ ^ self ]. + repo := FossilRepo new + local: self detectRepositoryLocal. + repo repository. + ^ repo +] + { #category : #accessing } TiddlyWiki >> selectContentType: mimeType [ @@ -458,6 +482,13 @@ TiddlyWiki >> tiddlersJSONUrl [ self remote ifNil: [^ nil]. ] +{ #category : #accessing } +TiddlyWiki >> updateAndRebuildTiddlersJSONWithFossilRepo [ + + self repository update; uvExportSTON. + ^ self rebuildTiddlersJSON +] + { #category : #accessing } TiddlyWiki >> withoutContentType: application [ | filteredTiddlers tempWiki |