Implementing support for unversioned files.
This commit is contained in:
parent
1910b685a6
commit
616cd8d292
@ -57,7 +57,7 @@ FossilRepo >> fetchPage: pageName [
|
||||
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'get/', pageName)
|
||||
]
|
||||
|
||||
{ #category : #utility }
|
||||
{ #category : #utilities }
|
||||
FossilRepo >> jsonDataFor: anUrlSegment [
|
||||
|
||||
^ NeoJSONReader fromString: (self jsonStringFor: anUrlSegment)
|
||||
@ -66,8 +66,7 @@ FossilRepo >> jsonDataFor: anUrlSegment [
|
||||
{ #category : #querying }
|
||||
FossilRepo >> jsonStringFor: aFileName [
|
||||
| baseUrl queryForJSONData |
|
||||
baseUrl := self remote asString.
|
||||
baseUrl := baseUrl asUrl addPathSegments: #('json' 'finfo').
|
||||
baseUrl := self remote addPathSegments: #('json' 'finfo').
|
||||
queryForJSONData := baseUrl queryAt: 'name' put: aFileName.
|
||||
^ (ZnEasy get: queryForJSONData) contents.
|
||||
]
|
||||
@ -86,6 +85,17 @@ FossilRepo >> lastHashNumberFor: aFileName [
|
||||
^ (self checkinsFor: aFileName) first at: 'uuid'
|
||||
]
|
||||
|
||||
{ #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."
|
||||
|
||||
(aFileNameWithRelativePath beginsWith: '/uv')
|
||||
ifTrue: [ ^ aFileNameWithRelativePath ]
|
||||
ifFalse: [ '/doc/tip/', aFileNameWithRelativePath ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> local [
|
||||
^ local
|
||||
@ -124,15 +134,6 @@ FossilRepo >> rawCapabilities [
|
||||
^ NeoJSONReader fromString: (self jsonDataFor: 'cap')
|
||||
]
|
||||
|
||||
{ #category : #utility }
|
||||
FossilRepo >> rawContentFor: aFilePath [
|
||||
"I provide the file contents of a given file path that exist in the repository."
|
||||
| checksum |
|
||||
self remote ifNil: [ ^ self ].
|
||||
checksum := self lastHashNumberFor: aFilePath.
|
||||
^ (self remote asString, 'raw/', aFilePath, '?name=', checksum) asUrl retrieveContents.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> remote [
|
||||
^ remote
|
||||
@ -143,6 +144,15 @@ FossilRepo >> remote: anUrlString [
|
||||
remote := anUrlString asUrl
|
||||
]
|
||||
|
||||
{ #category : #utilities }
|
||||
FossilRepo >> sanitize: aFileNameWithRelativePath [
|
||||
"I dicern if my argument concerns to a versioned or an unversioned file,
|
||||
and return a relative path to put the file."
|
||||
|
||||
(aFileNameWithRelativePath beginsWith: '/uv')
|
||||
ifTrue: [ ^ aFileNameWithRelativePath copyWithout: '/uv' ]
|
||||
]
|
||||
|
||||
{ #category : #authentication }
|
||||
FossilRepo >> whoAmI [
|
||||
^ NeoJSONReader fromString: (self jsonDataFor: 'whoami')
|
||||
|
@ -1,8 +0,0 @@
|
||||
"
|
||||
A FossilRepoTest is a test class for testing the behavior of FossilRepo
|
||||
"
|
||||
Class {
|
||||
#name : #FossilRepoTest,
|
||||
#superclass : #TestCase,
|
||||
#category : #'Fossil-Tests'
|
||||
}
|
Loading…
Reference in New Issue
Block a user