From f44e2dfece45d4c4f661781177491287f30f7bbb Mon Sep 17 00:00:00 2001 From: ruidajo Date: Fri, 11 Mar 2022 08:50:20 -0500 Subject: [PATCH] Improving and creating synchronize methods for fossil repos. --- repository/TiddlyWiki/TiddlyWiki.class.st | 49 +++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index e5e3c9d..b567abb 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -30,6 +30,23 @@ TiddlyWiki class >> fromJSONUrl: anUrlString [ name: anUrlString ] +{ #category : #accessing } +TiddlyWiki >> addRecentChangesToRepo [ + + | docsSton docsStonSanitized recentTiddlers repository | + repository := self repository. + self + exportJSONFile; + importJSONFile. + recentTiddlers := self changesAfter: repository checkoutDateAndTime. + docsSton := recentTiddlers collect: [:each | each exportSTONFile]. + "Collecting tiddlers file reference as string and adding to the repo" + docsStonSanitized := docsSton collect: [ :each | + (each fullName removePrefix: repository localRoot) allButFirst ]. + docsStonSanitized do: [ :each | repository add: each ]. + ^ repository status +] + { #category : #accessing } TiddlyWiki >> addToConfigFile [ | cleaned newConfig | @@ -489,17 +506,15 @@ TiddlyWiki >> repository [ { #category : #accessing } TiddlyWiki >> resynchronize [ - | repository | - self - exportJSONFile; - importJSONFile. + | repository return | repository := self repository. repository update. + return := Dictionary new + at: 'status' put: self addRecentChangesToRepo. + self exportSTONFiles. self exportContentTiddlers. self exportLargeTiddlers. - repository addRecentChangesFromWiki: self. - ^ Dictionary new - at: 'status' put: repository status; + ^ return at: 'file' put: self rebuildTiddlersJSON; yourself. ] @@ -520,6 +535,26 @@ TiddlyWiki >> shadow [ ^ self tiddlers select: [:tiddler | tiddler title beginsWith: '$:/'] ] +{ #category : #accessing } +TiddlyWiki >> syncRemoteLocalDestructive [ + + | repository | + repository := self repository. + repository update. + repository revertRemoteUnversioned. + repository exportHTMLUnversioned. + self + exportJSONFile; + importJSONFile. + self exportSTONFiles. + self exportContentTiddlers. + self exportLargeTiddlers. + ^ Dictionary new + at: 'status' put: repository status; + at: 'tiddlers from STON' put: self rebuildTiddlers; + yourself. +] + { #category : #accessing } TiddlyWiki >> taggedWith: aTag [ ^ self tiddlers select: [:tiddler |