From 4764f989b7d49cd4cbb2f4a972e8f17250325bef Mon Sep 17 00:00:00 2001 From: ruidajo Date: Fri, 4 Mar 2022 10:38:15 -0500 Subject: [PATCH] Improving resynchronize. --- repository/TiddlyWiki/TiddlyWiki.class.st | 39 +++++++++++++++++------ 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index 0426600..5572bd2 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -112,7 +112,8 @@ TiddlyWiki >> detectRepositoryLocal [ | folder folderItems | folder := self file parent. folderItems := folder children. - [(folderItems select: [ :path | path basename beginsWith: '.fslckout' ]) isEmpty + [(folderItems select: [ :path | (path basename beginsWith: '.fslckout') or: + [ path basename beginsWith: '.fossil']]) isEmpty and:[ (folder = FileLocator root) not ]] whileTrue: [folder := folder parent. folderItems := folder children.]. @@ -399,10 +400,26 @@ TiddlyWiki >> rebuildTiddlers [ { #category : #accessing } TiddlyWiki >> rebuildTiddlersJSON [ - self tiddlers: self rebuildTiddlers. + self tiddlers: self rebuildTiddlersWithoutShadows. ^ self exportJSONSubtiddlers: (self rebuildTiddlers asArray) as: 'rebuildedTiddlers'. ] +{ #category : #accessing } +TiddlyWiki >> rebuildTiddlersWithoutShadows [ + + | stonTiddlers contentTiddlersFiles | + contentTiddlersFiles := self tiddlersFolder files + select: [ :each | each basename endsWith: 'ston' ]. + + stonTiddlers := OrderedCollection new. + stonTiddlers + addAll: (((self largeTiddlersFolder files) + reject: [ :each | each basename beginsWith: '_shadow.ston' ]) + collect: [ :each | STONJSON fromString: each contents ]); + addAll: (contentTiddlersFiles collect:[ :each | STONJSON fromString: each contents ]). + ^ stonTiddlers +] + { #category : #accessing } TiddlyWiki >> remote [ @@ -426,6 +443,17 @@ TiddlyWiki >> repository [ ^ repo ] +{ #category : #accessing } +TiddlyWiki >> resynchronize [ + + | repository | + repository := self repository. + repository update. + self exportContentTiddlers. + repository addRecentChangesFromWiki: self. + ^ self rebuildTiddlersJSON +] + { #category : #accessing } TiddlyWiki >> selectContentType: mimeType [ @@ -482,13 +510,6 @@ TiddlyWiki >> tiddlersJSONUrl [ self remote ifNil: [^ nil]. ] -{ #category : #accessing } -TiddlyWiki >> updateAndRebuildTiddlersJSONWithFossilRepo [ - - self repository update; uvExportSTON. - ^ self rebuildTiddlersJSON -] - { #category : #accessing } TiddlyWiki >> withoutContentType: application [ | filteredTiddlers tempWiki |