Supporting raw content import in file repositories.
This commit is contained in:
parent
966c0e8456
commit
1910b685a6
@ -47,54 +47,6 @@ FossilRepo >> checkinsFor: relativeFilePath [
|
|||||||
^ payload at: 'checkins'
|
^ payload at: 'checkins'
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #querying }
|
|
||||||
FossilRepo >> commitsByDate [
|
|
||||||
"I present the sum of all commit organized by date."
|
|
||||||
| result |
|
|
||||||
result := Dictionary new.
|
|
||||||
self timeline do: [ :commit | | key |
|
|
||||||
key := (DateAndTime fromUnixTime: (commit at: 'timestamp' )) asDate.
|
|
||||||
result at: key
|
|
||||||
ifPresent: [ result at: key put: (result at: key) + 1 ]
|
|
||||||
ifAbsent: [ result at: key put: 1 ] ].
|
|
||||||
^ result
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #'data visualization' }
|
|
||||||
FossilRepo >> commitsCalendarFrom: startYear to: endYear colored: colorsPalette [
|
|
||||||
"I"
|
|
||||||
|
|
||||||
| b colors dictionary valuedColors |
|
|
||||||
dictionary := self commitsByDate.
|
|
||||||
colors := RTColorPalette sequential colors: 9 scheme: 'Blues'.
|
|
||||||
valuedColors := self commitsByDate collect: [ :v | colors at: v // 2 + 1 ].
|
|
||||||
b := RTCalendarBuilder new.
|
|
||||||
b dateShape rectangle
|
|
||||||
size: 15;
|
|
||||||
color: Color white;
|
|
||||||
borderColor: Color lightGray.
|
|
||||||
b monthShape shape: (b monthShapePath: 15.0).
|
|
||||||
b yearShape
|
|
||||||
composite: [ :comp |
|
|
||||||
comp
|
|
||||||
add:
|
|
||||||
(RTLabel new
|
|
||||||
text: [ :d | d year ];
|
|
||||||
height: 20).
|
|
||||||
comp add: (RTBox new color: Color transparent) ].
|
|
||||||
b dates: ((Year year: startYear) to: (Year year: endYear)).
|
|
||||||
b dateLayout gapSize: 0.
|
|
||||||
b monthLayout month.
|
|
||||||
b yearLayout horizontalLine.
|
|
||||||
b dateShape
|
|
||||||
if: [ :d | dictionary includesKey: d ]
|
|
||||||
color: [ :d | valuedColors at: d ].
|
|
||||||
b dateInteraction popup.
|
|
||||||
b build.
|
|
||||||
(b view elements select: [ :e | e model isKindOf: Month ]) pushFront.
|
|
||||||
^ b view
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #wiki }
|
{ #category : #wiki }
|
||||||
FossilRepo >> createPage: pageName [
|
FossilRepo >> createPage: pageName [
|
||||||
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'create/', pageName)
|
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'create/', pageName)
|
||||||
@ -114,8 +66,8 @@ FossilRepo >> jsonDataFor: anUrlSegment [
|
|||||||
{ #category : #querying }
|
{ #category : #querying }
|
||||||
FossilRepo >> jsonStringFor: aFileName [
|
FossilRepo >> jsonStringFor: aFileName [
|
||||||
| baseUrl queryForJSONData |
|
| baseUrl queryForJSONData |
|
||||||
baseUrl := self remote.
|
baseUrl := self remote asString.
|
||||||
baseUrl addPathSegments: #('json' 'finfo').
|
baseUrl := baseUrl asUrl addPathSegments: #('json' 'finfo').
|
||||||
queryForJSONData := baseUrl queryAt: 'name' put: aFileName.
|
queryForJSONData := baseUrl queryAt: 'name' put: aFileName.
|
||||||
^ (ZnEasy get: queryForJSONData) contents.
|
^ (ZnEasy get: queryForJSONData) contents.
|
||||||
]
|
]
|
||||||
@ -172,6 +124,15 @@ FossilRepo >> rawCapabilities [
|
|||||||
^ NeoJSONReader fromString: (self jsonDataFor: 'cap')
|
^ 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 }
|
{ #category : #accessing }
|
||||||
FossilRepo >> remote [
|
FossilRepo >> remote [
|
||||||
^ remote
|
^ remote
|
||||||
@ -182,16 +143,6 @@ FossilRepo >> remote: anUrlString [
|
|||||||
remote := anUrlString asUrl
|
remote := anUrlString asUrl
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
FossilRepo >> timeline [
|
|
||||||
"I return all information of all commits in a repository timeline."
|
|
||||||
| baseUrl queryForJSONData |
|
|
||||||
baseUrl := self remote addPathSegments: #('json' 'timeline' 'checkin').
|
|
||||||
queryForJSONData := baseUrl queryAt: 'limit' put: 0.
|
|
||||||
^ ((NeoJSONReader fromString: (queryForJSONData asUrl retrieveContents))
|
|
||||||
at: 'payload') at: 'timeline'
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #authentication }
|
{ #category : #authentication }
|
||||||
FossilRepo >> whoAmI [
|
FossilRepo >> whoAmI [
|
||||||
^ NeoJSONReader fromString: (self jsonDataFor: 'whoami')
|
^ NeoJSONReader fromString: (self jsonDataFor: 'whoami')
|
||||||
|
8
repository/Fossil/FossilRepoTest.class.st
Normal file
8
repository/Fossil/FossilRepoTest.class.st
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
"
|
||||||
|
A FossilRepoTest is a test class for testing the behavior of FossilRepo
|
||||||
|
"
|
||||||
|
Class {
|
||||||
|
#name : #FossilRepoTest,
|
||||||
|
#superclass : #TestCase,
|
||||||
|
#category : #'Fossil-Tests'
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
"
|
|
||||||
I store metadata for this package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
|
|
||||||
"
|
|
||||||
Class {
|
|
||||||
#name : #ManifestFossil,
|
|
||||||
#superclass : #PackageManifest,
|
|
||||||
#category : #Fossil
|
|
||||||
}
|
|
||||||
|
|
||||||
{ #category : #'code-critics' }
|
|
||||||
ManifestFossil class >> ruleRBBadMessageRuleV1FalsePositive [
|
|
||||||
^ #(#(#(#RGMethodDefinition #(#FossilRepo #commitsCalendarFrom:to:colored: #false)) #'2017-10-12T15:19:50.932072-05:00') )
|
|
||||||
]
|
|
Loading…
Reference in New Issue
Block a user