Improving resynchronize.

This commit is contained in:
ruidajo 2022-03-04 10:38:15 -05:00
parent 528c5adf29
commit 4764f989b7

View File

@ -112,7 +112,8 @@ TiddlyWiki >> detectRepositoryLocal [
| folder folderItems | | folder folderItems |
folder := self file parent. folder := self file parent.
folderItems := folder children. 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 ]] and:[ (folder = FileLocator root) not ]]
whileTrue: [folder := folder parent. whileTrue: [folder := folder parent.
folderItems := folder children.]. folderItems := folder children.].
@ -399,10 +400,26 @@ TiddlyWiki >> rebuildTiddlers [
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> rebuildTiddlersJSON [ TiddlyWiki >> rebuildTiddlersJSON [
self tiddlers: self rebuildTiddlers. self tiddlers: self rebuildTiddlersWithoutShadows.
^ self exportJSONSubtiddlers: (self rebuildTiddlers asArray) as: 'rebuildedTiddlers'. ^ 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 } { #category : #accessing }
TiddlyWiki >> remote [ TiddlyWiki >> remote [
@ -426,6 +443,17 @@ TiddlyWiki >> repository [
^ repo ^ repo
] ]
{ #category : #accessing }
TiddlyWiki >> resynchronize [
| repository |
repository := self repository.
repository update.
self exportContentTiddlers.
repository addRecentChangesFromWiki: self.
^ self rebuildTiddlersJSON
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> selectContentType: mimeType [ TiddlyWiki >> selectContentType: mimeType [
@ -482,13 +510,6 @@ TiddlyWiki >> tiddlersJSONUrl [
self remote ifNil: [^ nil]. self remote ifNil: [^ nil].
] ]
{ #category : #accessing }
TiddlyWiki >> updateAndRebuildTiddlersJSONWithFossilRepo [
self repository update; uvExportSTON.
^ self rebuildTiddlersJSON
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> withoutContentType: application [ TiddlyWiki >> withoutContentType: application [
| filteredTiddlers tempWiki | | filteredTiddlers tempWiki |