2017-06-01 12:12:11 +00:00
|
|
|
"
|
|
|
|
I model a fossil repository. For details about fossil see:
|
|
|
|
|
|
|
|
http://fossil-scm.org/
|
2017-06-09 07:42:57 +00:00
|
|
|
|
|
|
|
The protocols are named following Smalltalk conventions, but
|
|
|
|
also after the Fossil JSON API documentation at [1]
|
|
|
|
|
|
|
|
[1] https://docs.google.com/document/d/1fXViveNhDbiXgCuE7QDXQOKeFzf2qNUkBEgiUvoqFN4/view
|
2017-06-01 12:12:11 +00:00
|
|
|
"
|
|
|
|
Class {
|
|
|
|
#name : #FossilRepo,
|
|
|
|
#superclass : #Object,
|
|
|
|
#instVars : [
|
2017-06-06 10:27:57 +00:00
|
|
|
'local',
|
2022-02-03 20:44:14 +00:00
|
|
|
'remote',
|
2022-03-04 01:34:46 +00:00
|
|
|
'repository'
|
2017-06-01 12:12:11 +00:00
|
|
|
],
|
2020-02-19 21:31:31 +00:00
|
|
|
#classInstVars : [
|
|
|
|
'executable'
|
|
|
|
],
|
2017-06-01 12:12:11 +00:00
|
|
|
#category : #Fossil
|
|
|
|
}
|
|
|
|
|
2020-02-19 21:31:31 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo class >> executable [
|
|
|
|
^ executable ifNil: [ executable := self locateExecutable ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo class >> executable: aPathString [
|
|
|
|
"I define where the Fossil package is installed in this operative system."
|
|
|
|
executable := aPathString
|
|
|
|
]
|
|
|
|
|
2022-02-03 20:44:14 +00:00
|
|
|
{ #category : #'instance creation' }
|
|
|
|
FossilRepo class >> local: aFilePath repository: aFossilFilePath [
|
|
|
|
|
|
|
|
^ self new
|
|
|
|
local: aFilePath;
|
|
|
|
repository: aFossilFilePath;
|
|
|
|
yourself
|
|
|
|
]
|
|
|
|
|
2020-02-19 21:31:31 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo class >> locateExecutable [
|
|
|
|
Smalltalk os isWindows ifTrue: [ ^ self ].
|
|
|
|
OSSUnixSubprocess new
|
|
|
|
command: 'which';
|
|
|
|
arguments: #('fossil') ;
|
|
|
|
redirectStdout;
|
2020-03-15 14:33:02 +00:00
|
|
|
runAndWaitOnExitDo: [ :process :outString |
|
|
|
|
^ outString allButLast ]
|
2020-02-19 21:31:31 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
2020-01-17 12:57:06 +00:00
|
|
|
FossilRepo >> add: fileRelativePath [
|
|
|
|
"I add a file to the working Fossil repository, given that both, the file and the repositor,
|
|
|
|
share the same root directory/folder."
|
|
|
|
|
2020-01-17 05:05:24 +00:00
|
|
|
OSSUnixSubprocess new
|
2020-02-19 21:31:31 +00:00
|
|
|
command: self class locateExecutable;
|
2022-02-03 20:44:14 +00:00
|
|
|
workingDirectory: self localRoot;
|
2020-03-15 14:33:02 +00:00
|
|
|
arguments: { 'add' . fileRelativePath };
|
2020-01-17 05:05:24 +00:00
|
|
|
redirectStdout;
|
2020-01-17 12:57:06 +00:00
|
|
|
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
2020-01-16 19:49:42 +00:00
|
|
|
]
|
|
|
|
|
2022-02-04 01:22:45 +00:00
|
|
|
{ #category : #accessing }
|
2022-02-04 16:12:34 +00:00
|
|
|
FossilRepo >> addFiles: aCollection [
|
2022-02-04 01:22:45 +00:00
|
|
|
|
2022-02-04 16:12:34 +00:00
|
|
|
aCollection do: [ :each | self add: each ].
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> addRecentChangesFromWiki: aTiddlywiki [
|
|
|
|
|
|
|
|
| docsSton docsStonSanitized recentTiddlers |
|
2022-02-12 04:11:39 +00:00
|
|
|
aTiddlywiki
|
|
|
|
exportJSONFile;
|
|
|
|
importJSONFile.
|
2022-02-04 16:12:34 +00:00
|
|
|
recentTiddlers := aTiddlywiki changesAfter: self checkoutDateAndTime.
|
|
|
|
docsSton := recentTiddlers collect: [:each | each exportSTONFile].
|
2022-02-04 01:22:45 +00:00
|
|
|
"Collecting tiddlers file reference as string and adding to the repo"
|
|
|
|
docsStonSanitized := docsSton collect: [ :each |
|
2022-02-04 16:12:34 +00:00
|
|
|
(each fullName removePrefix: self localRoot) allButFirst ].
|
2022-02-04 01:22:45 +00:00
|
|
|
docsStonSanitized do: [ :each | self add: each ].
|
|
|
|
^ self status
|
|
|
|
]
|
|
|
|
|
2022-03-11 06:12:55 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> addUnversioned: aFileRelativePathFullname [
|
|
|
|
|
|
|
|
^ self fossilUv: 'add' and: aFileRelativePathFullname
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> addUnversionedLargeTiddlersFromWiki: tiddlywiki [
|
|
|
|
|
|
|
|
| stonfiles largeTiddlersFileReference |
|
|
|
|
stonfiles := (tiddlywiki file parent / 'largeTiddlers') files
|
|
|
|
select: [ :each | each fullName endsWith: '.ston' ].
|
|
|
|
largeTiddlersFileReference := stonfiles collect: [ :each |
|
|
|
|
each fullName withoutPrefix:
|
|
|
|
self local fullName , '/' ].
|
|
|
|
largeTiddlersFileReference do: [ :each | self addUnversioned: each ].
|
|
|
|
^ largeTiddlersFileReference
|
|
|
|
]
|
|
|
|
|
2017-06-09 07:42:57 +00:00
|
|
|
{ #category : #authentication }
|
|
|
|
FossilRepo >> authTokenFor: anUserName withPassword: passwordString [
|
|
|
|
^ ((self loginAs: anUserName withPassword: passwordString) at: 'payload') at: 'authToken'
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #authentication }
|
|
|
|
FossilRepo >> capabilities [
|
|
|
|
| payload name permissions |
|
|
|
|
payload := self rawCapabilities at: 'payload'.
|
|
|
|
name := payload at: 'name'.
|
|
|
|
permissions := ((payload at: 'permissionFlags') select: [ :item | item value ]) keys.
|
|
|
|
^ Dictionary new
|
|
|
|
at: 'name' put: name;
|
|
|
|
at: 'permissions' put: permissions;
|
|
|
|
yourself.
|
|
|
|
]
|
|
|
|
|
2017-06-01 12:12:11 +00:00
|
|
|
{ #category : #querying }
|
|
|
|
FossilRepo >> checkinsFor: relativeFilePath [
|
|
|
|
"I get all histotical checkins information for a full file name, wich includes relative path
|
2017-07-06 21:28:17 +00:00
|
|
|
in the repository (i.e: 'Doc/Es/Tutoriales/tutorial.ston' or 'index.html')"
|
|
|
|
| payload |
|
|
|
|
payload := (self jsonDataFor: relativeFilePath) at: 'payload' ifAbsent: [
|
|
|
|
self inform:
|
2017-06-01 12:12:11 +00:00
|
|
|
'WARNING! Key not found, verify the file name you are looking in this repository'.
|
2017-07-06 21:28:17 +00:00
|
|
|
^ self ].
|
|
|
|
^ payload at: 'checkins'
|
2017-06-01 12:12:11 +00:00
|
|
|
]
|
|
|
|
|
2022-02-04 01:22:45 +00:00
|
|
|
{ #category : #accessing }
|
2022-02-04 16:12:34 +00:00
|
|
|
FossilRepo >> checkoutDateAndTime [
|
2022-02-04 01:22:45 +00:00
|
|
|
|
2022-03-04 14:35:06 +00:00
|
|
|
| date time splitedCheckout |
|
|
|
|
splitedCheckout := (self status at: 'checkout') splitOn: ' '.
|
|
|
|
date := splitedCheckout at: 2.
|
|
|
|
time := splitedCheckout at: 3.
|
2022-02-04 16:12:34 +00:00
|
|
|
^ (date, time) asZTimestamp
|
2022-02-04 01:22:45 +00:00
|
|
|
]
|
|
|
|
|
2022-01-29 02:52:55 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> command: aCommandArgument [
|
|
|
|
|
|
|
|
OSSUnixSubprocess new
|
|
|
|
command: 'fossil';
|
|
|
|
arguments: { aCommandArgument };
|
2022-02-03 20:44:14 +00:00
|
|
|
workingDirectory: self localRoot;
|
2022-01-29 02:52:55 +00:00
|
|
|
redirectStdout;
|
|
|
|
redirectStderr;
|
|
|
|
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
|
|
|
]
|
|
|
|
|
2020-02-19 21:31:31 +00:00
|
|
|
{ #category : #operation }
|
2020-01-17 17:39:03 +00:00
|
|
|
FossilRepo >> commit: message [
|
|
|
|
"I add a file to the working Fossil repository, given that both, the file and the repositor,
|
|
|
|
share the same root directory/folder."
|
|
|
|
|
|
|
|
OSSUnixSubprocess new
|
2020-02-19 21:31:31 +00:00
|
|
|
command: self class locateExecutable;
|
2020-01-17 17:39:03 +00:00
|
|
|
arguments: { 'commit' . '--no-warnings' . '-m' . message };
|
2022-02-03 20:44:14 +00:00
|
|
|
workingDirectory: self localRoot;
|
2020-01-17 17:39:03 +00:00
|
|
|
redirectStdout;
|
2020-05-02 13:29:57 +00:00
|
|
|
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
FossilRepo >> commit: message withEnabledWarnings: aBoolean [
|
|
|
|
"I add a file to the working Fossil repository, given that both, the file and the repositor,
|
|
|
|
share the same root directory/folder."
|
|
|
|
|
|
|
|
| warningCommand |
|
|
|
|
warningCommand := aBoolean
|
|
|
|
ifFalse: [ '' ]
|
|
|
|
ifTrue: [ '--no-warnings' ].
|
|
|
|
OSSUnixSubprocess new
|
|
|
|
command: self class locateExecutable;
|
|
|
|
arguments:
|
|
|
|
{'commit'.
|
|
|
|
warningCommand.
|
|
|
|
'-m'.
|
|
|
|
message};
|
2022-02-03 20:44:14 +00:00
|
|
|
workingDirectory: self localRoot;
|
2020-05-02 13:29:57 +00:00
|
|
|
redirectStdout;
|
|
|
|
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
2020-01-17 17:39:03 +00:00
|
|
|
]
|
|
|
|
|
2017-06-06 10:27:57 +00:00
|
|
|
{ #category : #wiki }
|
2017-06-09 07:42:57 +00:00
|
|
|
FossilRepo >> createPage: pageName [
|
|
|
|
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'create/', pageName)
|
|
|
|
]
|
|
|
|
|
2022-02-04 01:22:45 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> diff [
|
|
|
|
|
|
|
|
^ self command: 'diff'
|
|
|
|
]
|
|
|
|
|
2022-03-11 06:12:55 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> exportSTONUnversioned [
|
|
|
|
|
|
|
|
| stonFileReferenceFullName |
|
|
|
|
stonFileReferenceFullName := (self listUnversioned)
|
|
|
|
select: [ :each | each endsWith: '.ston' ].
|
|
|
|
stonFileReferenceFullName do: [ :each | self exportUnversioned: each ].
|
|
|
|
^ stonFileReferenceFullName
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> exportUnversioned: fileReferenceFullName [
|
|
|
|
|
|
|
|
OSSUnixSubprocess new
|
|
|
|
command: 'fossil';
|
|
|
|
arguments: { 'uv' . 'export' . fileReferenceFullName . fileReferenceFullName };
|
|
|
|
workingDirectory: self localRoot;
|
|
|
|
redirectStdout;
|
|
|
|
redirectStderr;
|
|
|
|
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
|
|
|
]
|
|
|
|
|
2022-01-29 02:52:55 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> extra [
|
|
|
|
|
|
|
|
^ self command: 'extra'
|
|
|
|
]
|
|
|
|
|
2017-06-09 07:42:57 +00:00
|
|
|
{ #category : #wiki }
|
|
|
|
FossilRepo >> fetchPage: pageName [
|
|
|
|
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'get/', pageName)
|
|
|
|
]
|
|
|
|
|
2022-01-29 02:52:55 +00:00
|
|
|
{ #category : #accessing }
|
2022-02-04 16:12:34 +00:00
|
|
|
FossilRepo >> fossilUv: anArgument and: aSecondArgument [
|
2022-01-29 02:52:55 +00:00
|
|
|
|
|
|
|
OSSUnixSubprocess new
|
|
|
|
command: 'fossil';
|
|
|
|
arguments: { 'uv' . anArgument . aSecondArgument };
|
2022-02-03 20:44:14 +00:00
|
|
|
workingDirectory: self localRoot;
|
2022-01-29 02:52:55 +00:00
|
|
|
redirectStdout;
|
|
|
|
redirectStderr;
|
|
|
|
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2020-01-11 12:39:04 +00:00
|
|
|
{ #category : #'as yet unclassified' }
|
|
|
|
FossilRepo >> getFileContentsFor: anEmbeddedDocUrl [
|
|
|
|
"Given the web page contents for a file, hosted in Fossil, I detect all the standard
|
|
|
|
page decorations (chrome) and strip them to provide only file contents, contained between
|
|
|
|
<blockquote><pre> HTML tags.."
|
|
|
|
|
|
|
|
| pageContentLines blockQuoteStart blockQuoteEnd fileContentLines fileContent |
|
|
|
|
pageContentLines := (self getPageContentsFor: anEmbeddedDocUrl) lines.
|
|
|
|
pageContentLines
|
|
|
|
doWithIndex: [ :line :index |
|
|
|
|
line = '<blockquote><pre>'
|
|
|
|
ifTrue: [ blockQuoteStart := index ].
|
|
|
|
line = '</pre></blockquote>'
|
|
|
|
ifTrue: [ blockQuoteEnd := index ] ].
|
|
|
|
fileContentLines := pageContentLines
|
|
|
|
copyFrom: blockQuoteStart + 1
|
|
|
|
to: blockQuoteEnd - 1.
|
|
|
|
fileContent := WriteStream on: ''.
|
|
|
|
fileContentLines do: [ :line | fileContent nextPutAll: line; crlf ].
|
|
|
|
^ fileContent contents.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #utilities }
|
|
|
|
FossilRepo >> getPageContentsFor: anEmbeddedDocUrl [
|
|
|
|
"I use the Fossil web interface to get the contents of a file.
|
|
|
|
I'm useful if the file is posted online, but the repository contents are
|
|
|
|
not locally available.
|
|
|
|
|
|
|
|
anEmbeddedDocUrl should have the schema presented at:
|
|
|
|
|
|
|
|
https://www.fossil-scm.org/xfer/doc/trunk/www/embeddeddoc.wiki"
|
|
|
|
|
|
|
|
^ (ZnEasy get: anEmbeddedDocUrl, '?mimetype=text/plain') contents.
|
|
|
|
]
|
|
|
|
|
2020-02-19 21:31:31 +00:00
|
|
|
{ #category : #operation }
|
|
|
|
FossilRepo >> init: absolutePathString [
|
2020-05-02 13:29:57 +00:00
|
|
|
"I init a repository in a given location."
|
2020-02-19 21:31:31 +00:00
|
|
|
Smalltalk os isWindows ifTrue: [ ^ self ].
|
2020-05-02 13:29:57 +00:00
|
|
|
absolutePathString asFileReference exists ifTrue: [ ^ self ].
|
2020-02-19 21:31:31 +00:00
|
|
|
OSSUnixSubprocess new
|
|
|
|
command: self class locateExecutable;
|
|
|
|
arguments: { 'init' . absolutePathString };
|
2022-02-03 20:44:14 +00:00
|
|
|
workingDirectory: self localRoot;
|
2020-02-19 21:31:31 +00:00
|
|
|
redirectStdout;
|
|
|
|
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
|
|
|
]
|
|
|
|
|
2022-03-04 01:34:46 +00:00
|
|
|
{ #category : #testing }
|
|
|
|
FossilRepo >> isOpen [
|
|
|
|
|
|
|
|
self status ifEmpty: [ ^ false ].
|
|
|
|
^ true
|
|
|
|
]
|
|
|
|
|
2019-04-08 22:19:12 +00:00
|
|
|
{ #category : #utilities }
|
|
|
|
FossilRepo >> isUnversioned: aFileNameWithRelativePath [
|
|
|
|
|
|
|
|
^ (aFileNameWithRelativePath beginsWith: 'uv')
|
|
|
|
]
|
|
|
|
|
2019-04-08 20:46:49 +00:00
|
|
|
{ #category : #utilities }
|
2017-06-06 10:27:57 +00:00
|
|
|
FossilRepo >> jsonDataFor: anUrlSegment [
|
2017-07-06 21:28:17 +00:00
|
|
|
|
|
|
|
^ NeoJSONReader fromString: (self jsonStringFor: anUrlSegment)
|
2017-06-09 07:42:57 +00:00
|
|
|
]
|
|
|
|
|
2017-06-01 12:12:11 +00:00
|
|
|
{ #category : #querying }
|
|
|
|
FossilRepo >> jsonStringFor: aFileName [
|
2017-07-06 21:28:17 +00:00
|
|
|
| baseUrl queryForJSONData |
|
2019-04-08 20:46:49 +00:00
|
|
|
baseUrl := self remote addPathSegments: #('json' 'finfo').
|
2017-07-06 21:28:17 +00:00
|
|
|
queryForJSONData := baseUrl queryAt: 'name' put: aFileName.
|
2017-06-01 12:12:11 +00:00
|
|
|
^ (ZnEasy get: queryForJSONData) contents.
|
|
|
|
]
|
|
|
|
|
2017-06-09 07:42:57 +00:00
|
|
|
{ #category : #wiki }
|
|
|
|
FossilRepo >> jsonWikiDataFor: anUrlSegment [
|
|
|
|
^ ZnClient new
|
|
|
|
get: (self wikiRoot addPathSegment: anUrlSegment);
|
|
|
|
contents.
|
|
|
|
]
|
|
|
|
|
2017-06-01 12:12:11 +00:00
|
|
|
{ #category : #querying }
|
|
|
|
FossilRepo >> lastHashNumberFor: aFileName [
|
|
|
|
"I'm useful to see if local versions of files are updated to the last versions of the
|
|
|
|
online repository"
|
|
|
|
^ (self checkinsFor: aFileName) first at: 'uuid'
|
|
|
|
]
|
|
|
|
|
2019-04-08 20:46:49 +00:00
|
|
|
{ #category : #utilities }
|
|
|
|
FossilRepo >> lastVersionPath: aFileNameWithRelativePath [
|
|
|
|
"I dicern if my argument concerns to a versioned or an unversioned file,
|
|
|
|
and return a relative route to the last version of the file in the first
|
|
|
|
case or the unversioned one."
|
|
|
|
|
2019-04-08 22:19:12 +00:00
|
|
|
(self isUnversioned: aFileNameWithRelativePath)
|
2019-04-08 22:40:12 +00:00
|
|
|
ifTrue: [ ^ '/', aFileNameWithRelativePath ]
|
2019-04-08 21:37:22 +00:00
|
|
|
ifFalse: [ ^ '/doc/tip/', aFileNameWithRelativePath ]
|
2019-04-08 20:46:49 +00:00
|
|
|
]
|
|
|
|
|
2022-03-04 01:34:46 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> listUnversioned [
|
|
|
|
|
|
|
|
^ (self fossilUv: 'ls' and: '') lines
|
|
|
|
]
|
|
|
|
|
2017-06-01 15:57:15 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> local [
|
|
|
|
^ local
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> local: aLocalFilePath [
|
|
|
|
local := aLocalFilePath
|
|
|
|
]
|
|
|
|
|
2022-01-29 02:52:55 +00:00
|
|
|
{ #category : #accessing }
|
2022-02-03 20:44:14 +00:00
|
|
|
FossilRepo >> localRoot [
|
|
|
|
|
|
|
|
local ifNotNil: [ ^ self local fullName ].
|
2022-03-04 14:35:06 +00:00
|
|
|
^ self status at: 'local-root:'
|
2022-01-29 02:52:55 +00:00
|
|
|
]
|
|
|
|
|
2017-06-09 07:42:57 +00:00
|
|
|
{ #category : #authentication }
|
|
|
|
FossilRepo >> loginAs: anUserName withPassword: password [
|
|
|
|
| jsonData |
|
|
|
|
jsonData := ZnClient new
|
|
|
|
url: (self loginUrlWithName: anUserName andPassword: password);
|
|
|
|
get;
|
|
|
|
contents.
|
|
|
|
^ NeoJSONReader fromString: jsonData
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #authentication }
|
|
|
|
FossilRepo >> loginUrlWithName: aUser andPassword: passwd [
|
|
|
|
^ self jsonRoot
|
|
|
|
addPathSegment: 'login';
|
|
|
|
queryAt: 'name' put: aUser;
|
|
|
|
queryAt: 'password' put: passwd.
|
|
|
|
]
|
|
|
|
|
2022-02-04 01:22:45 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> open [
|
|
|
|
|
|
|
|
OSSUnixSubprocess new
|
|
|
|
command: 'fossil';
|
|
|
|
arguments: { 'open' . self repository. '-f' };
|
|
|
|
workingDirectory: self localRoot;
|
|
|
|
redirectStdout;
|
|
|
|
redirectStderr;
|
|
|
|
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2022-02-04 16:12:34 +00:00
|
|
|
FossilRepo >> openAndUpdate [
|
2022-02-04 01:22:45 +00:00
|
|
|
|
|
|
|
^ self open; update
|
|
|
|
]
|
|
|
|
|
2017-06-06 10:27:57 +00:00
|
|
|
{ #category : #wiki }
|
|
|
|
FossilRepo >> pageList [
|
2017-06-09 07:42:57 +00:00
|
|
|
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'list')
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #authentication }
|
|
|
|
FossilRepo >> rawCapabilities [
|
|
|
|
^ NeoJSONReader fromString: (self jsonDataFor: 'cap')
|
2017-06-06 10:27:57 +00:00
|
|
|
]
|
|
|
|
|
2017-06-01 12:12:11 +00:00
|
|
|
{ #category : #accessing }
|
2017-06-06 10:27:57 +00:00
|
|
|
FossilRepo >> remote [
|
|
|
|
^ remote
|
2017-06-01 12:12:11 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2017-06-06 10:27:57 +00:00
|
|
|
FossilRepo >> remote: anUrlString [
|
|
|
|
remote := anUrlString asUrl
|
|
|
|
]
|
|
|
|
|
2022-02-03 20:44:14 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> repository [
|
|
|
|
|
2022-03-04 01:34:46 +00:00
|
|
|
repository ifNotNil: [ ^ repository ].
|
|
|
|
self isOpen ifFalse: [ ^ nil ].
|
2022-03-04 14:35:06 +00:00
|
|
|
^ repository := self status at: 'repository'.
|
2022-02-03 20:44:14 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> repository: aFossilRepoFile [
|
|
|
|
|
2022-03-04 01:34:46 +00:00
|
|
|
repository := aFossilRepoFile "fullName"
|
2022-02-03 20:44:14 +00:00
|
|
|
]
|
|
|
|
|
2019-04-08 20:46:49 +00:00
|
|
|
{ #category : #utilities }
|
|
|
|
FossilRepo >> sanitize: aFileNameWithRelativePath [
|
|
|
|
"I dicern if my argument concerns to a versioned or an unversioned file,
|
2019-04-08 21:31:05 +00:00
|
|
|
and return a relative path to put the file."
|
2019-04-08 20:46:49 +00:00
|
|
|
|
2019-04-08 22:19:12 +00:00
|
|
|
(self isUnversioned: aFileNameWithRelativePath)
|
2019-04-08 21:31:05 +00:00
|
|
|
ifFalse: [ ^ aFileNameWithRelativePath ]
|
2019-04-08 22:19:12 +00:00
|
|
|
ifTrue: [ ^ (aFileNameWithRelativePath copyFrom: 4 to: aFileNameWithRelativePath size) ]
|
2019-04-08 20:46:49 +00:00
|
|
|
]
|
|
|
|
|
2022-01-29 02:52:55 +00:00
|
|
|
{ #category : #accessing }
|
2022-02-03 20:44:14 +00:00
|
|
|
FossilRepo >> status [
|
2022-03-04 14:35:06 +00:00
|
|
|
| output |
|
|
|
|
output := OrderedDictionary new.
|
2022-03-09 22:52:17 +00:00
|
|
|
(self command: 'status') linesDo: [ :line | | k v temp commitLog |
|
|
|
|
commitLog := OrderedCollection new.
|
2022-03-04 14:35:06 +00:00
|
|
|
temp := line splitOn: ': '.
|
2022-03-09 22:52:17 +00:00
|
|
|
temp size = 2
|
|
|
|
ifTrue: [
|
|
|
|
k := temp first.
|
|
|
|
v := temp second trimmed.
|
|
|
|
output at: k put: v
|
|
|
|
]
|
|
|
|
ifFalse: [ commitLog add: line ].
|
|
|
|
output at: 'commitLog' put: commitLog
|
2022-03-04 14:35:06 +00:00
|
|
|
].
|
|
|
|
^ output
|
2022-01-29 02:52:55 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2022-03-11 06:12:55 +00:00
|
|
|
FossilRepo >> syncUnversioned [
|
2022-03-03 19:51:01 +00:00
|
|
|
|
2022-03-11 06:12:55 +00:00
|
|
|
^ self fossilUv: 'sync' and: '-v'
|
2022-03-03 19:51:01 +00:00
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2022-03-11 06:12:55 +00:00
|
|
|
FossilRepo >> update [
|
2022-03-03 19:51:01 +00:00
|
|
|
|
2022-03-11 06:12:55 +00:00
|
|
|
^ self command: 'update'
|
2022-03-03 19:51:01 +00:00
|
|
|
]
|
|
|
|
|
2022-01-29 02:52:55 +00:00
|
|
|
{ #category : #accessing }
|
2022-03-11 06:12:55 +00:00
|
|
|
FossilRepo >> updateAndRebuildTiddlersJSONFromWiki: aTiddlywiki [
|
2022-01-29 02:52:55 +00:00
|
|
|
|
2022-03-11 06:12:55 +00:00
|
|
|
self update; exportSTONUnversioned.
|
|
|
|
^ aTiddlywiki rebuildTiddlersJSON.
|
2022-01-29 02:52:55 +00:00
|
|
|
]
|
|
|
|
|
2017-06-09 07:42:57 +00:00
|
|
|
{ #category : #authentication }
|
|
|
|
FossilRepo >> whoAmI [
|
|
|
|
^ NeoJSONReader fromString: (self jsonDataFor: 'whoami')
|
|
|
|
]
|
|
|
|
|
2017-06-06 10:27:57 +00:00
|
|
|
{ #category : #wiki }
|
|
|
|
FossilRepo >> wikiRoot [
|
2020-01-11 12:39:04 +00:00
|
|
|
^ self remote
|
|
|
|
addPathSegments: #('json' 'wiki')
|
|
|
|
"addPathSegment: 'wiki' "
|
2017-06-06 10:27:57 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #wiki }
|
|
|
|
FossilRepo >> wikiTimeline [
|
2017-06-09 07:42:57 +00:00
|
|
|
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'timeline')
|
2017-06-01 12:12:11 +00:00
|
|
|
]
|