Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/GitHubHealth-Model-Importer/GithubModelImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ GithubModelImporter >> completeImportedProject: aGLHProject [
aGLHProject repository: GLHRepository new.
self glhModel add: aGLHProject repository.

self importPipelinesOfProject: aGLHProject.
self importBranchesOf: aGLHProject.
self importAllPipelinesOfProject: aGLHProject.
self importBranchesOfProject: aGLHProject.
self withCommitsSince ifNotNil: [ :withCommitSince | "If not nil, it means we have to import commit"
| commits |
commits := self importCommitsOfProject: aGLHProject.
Expand Down Expand Up @@ -343,6 +343,20 @@ GithubModelImporter >> ensureGroupNamed: aGroupName [
ifNone: [ self glhModel newGroupNamed: aGroupName ]
]

{ #category : #'import - pipelines' }
GithubModelImporter >> importAllPipelinesOfProject: project [

"add the pipeline (actions runs) in the project"

| pipelinesResult ghApiPipelineOverview |
pipelinesResult := self repoApi actions
getLatestForRepo: project name
ofOwner: project group name.
ghApiPipelineOverview := self parsePipelinesResult: pipelinesResult.
ghApiPipelineOverview workflow_runs do: [ :pipeline |
project addPipeline: pipeline ]
]

{ #category : #'import - branches' }
GithubModelImporter >> importBranchesOf: aGLHProject [
"add the pipeline (actions runs) in the project"
Expand Down Expand Up @@ -817,15 +831,21 @@ GithubModelImporter >> importPipelinesOfMergeRequest: aGLHMergeRequest [

{ #category : #'import - pipelines' }
GithubModelImporter >> importPipelinesOfProject: project [

"add the pipeline (actions runs) in the project"

| pipelinesResult ghApiPipelineOverview |
self
deprecated:
'Use importAllPipelinesOfProject: instead of current one'
on: '1 September 2026'
in:
'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.

pipelinesResult := self repoApi actions
getLatestForRepo: project name
ofOwner: project group name.
ghApiPipelineOverview := self parsePipelinesResult: pipelinesResult.
ghApiPipelineOverview workflow_runs do: [ :pipeline |
ghApiPipelineOverview workflow_runs do: [ :pipeline |
project addPipeline: pipeline ]
]

Expand Down
33 changes: 18 additions & 15 deletions src/GitLabHealth-Model-Analysis-Tests/GitAnalyzerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,19 @@ GitAnalyzerTest >> testAnalyseAmandment [
mondayCommit -> tuesdayCommit -> wednesdayCommit
"
wednesdayCommit := glhImporter
importCommitOfProject: projects first
withId:
'f298ec312f81032b611a890f993d98096ab3bbc1'.
importCommit:
'f298ec312f81032b611a890f993d98096ab3bbc1'
ofProject: projects first.

mondayCommit := glhImporter
importCommitOfProject: projects first
withId: '8a6f665118e6fcfa468d7cce1a7e944ba65812ab'.
importCommit:
'8a6f665118e6fcfa468d7cce1a7e944ba65812ab'
ofProject: projects first.

tuesdayCommit := glhImporter
importCommitOfProject: projects first
withId: '2c7308c727560dd425ef78f9a95ca7650d164bed'.
importCommit:
'2c7308c727560dd425ef78f9a95ca7650d164bed'
ofProject: projects first.

myCommits := {
mondayCommit.
Expand Down Expand Up @@ -135,18 +137,19 @@ GitAnalyzerTest >> testChurnMetric [

"commit chain: mondayCommit -> tuesdayCommit -> wednesdayCommit "
wednesdayCommit := glhImporter
importCommitOfProject: projects first
withId:
'f298ec312f81032b611a890f993d98096ab3bbc1'.
importCommit:
'f298ec312f81032b611a890f993d98096ab3bbc1'
ofProject: projects first.

mondayCommit := glhImporter
importCommitOfProject: projects first
withId: '8a6f665118e6fcfa468d7cce1a7e944ba65812ab'.
importCommit:
'8a6f665118e6fcfa468d7cce1a7e944ba65812ab'
ofProject: projects first.

tuesdayCommit := glhImporter
importCommitOfProject: projects first
withId: '2c7308c727560dd425ef78f9a95ca7650d164bed'.

importCommit:
'2c7308c727560dd425ef78f9a95ca7650d164bed'
ofProject: projects first.

myCommits := {
mondayCommit.
Expand Down
2 changes: 1 addition & 1 deletion src/GitLabHealth-Model-Analysis/ProjectMetric.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ProjectMetric class >> isAbstract [
ProjectMetric >> loadAllBranches [

| branches |
branches := glhImporter importBranchesOf: project.
branches := glhImporter importBranchesOfProject: project.
branches do: [ :branch | glhImporter importRefCommitOfBranch: branch ].
^ branches
]
Expand Down
70 changes: 0 additions & 70 deletions src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -766,73 +766,6 @@ GitlabModelImporter >> importCommit: aCommitID ofProject: aGLHProject [
^ parsedResult
]

{ #category : #'import - commits' }
GitlabModelImporter >> importCommitOfProject: anProject withId: anID [

| commit result |
self
deprecated: 'Use importCommit:ofProject: instead of current one'
on: '27 August 2025'
in: 'MSR 1.3.0 '
transformWith: '`@rcv importCommitOfProject: `arg1 withId: `arg2' -> '`@rcv importCommit: `arg2 ofProject: `arg1'.
anID ifNil: [ ^ nil ].

('looking for commit ' , anID printString , ' in project : '
, anProject id printString) recordInfo.

commit := (self
detectEntityType: GLHCommit
overAttribut: #id
equalTo: anID) ifNil: [
result := self repoApi commits
get: anID
inProject: anProject id.
commit := (self parseCommitsResult: '[' , result , ']')
first.

commit := self glhModel
add: commit
unless: self blockOnIdEquality.
commit repository: anProject repository.

commit ].

self withCommitDiffs ifTrue: [ self importDiffOfCommit: commit ].

^ commit
]

{ #category : #'import - commits' }
GitlabModelImporter >> importCommits: aGLHProject [
"limited to the last 20 commits"

| results parsedResults params |
self
deprecated:
'Use importLatestCommitsOfProject: instead of current one'
on: '19 September 2025'
in:
'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.

params := { (#with_stats -> 'true') } asDictionary.
results := self repoApi commits
getByPage: 1
perPage: 20
inProject: aGLHProject id
withParams: params.

parsedResults := self parseCommitsResult: results.
self glhModel addAll: parsedResults unless: self blockOnIdEquality.

parsedResults do: [ :commit |
commit repository: aGLHProject repository ].

self withCommitDiffs ifTrue: [
parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].

^ parsedResults
]

{ #category : #'import - commits' }
GitlabModelImporter >> importCommitsFollowing: aCommit upToDays: aNumberOfDay [
"import the 'n' commits of a project starting from an initial 'aCommit' commit.
Expand Down Expand Up @@ -873,9 +806,6 @@ GitlabModelImporter >> importCommitsFromTag: fromTag toTag: toTag [
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch [

| commits |
" result := self glhApi
commitsOfProject: aGLHBranch repository project id
forRefName: aGLHBranch name."
commits := self
importCommitsOfBranch: aGLHBranch
since: withCommitsSince.
Expand Down
6 changes: 6 additions & 0 deletions src/GitProjectHealth-Model-Importer/GitModelImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,12 @@ GitModelImporter >> glhModel: anObject [
glhModel := anObject
]

{ #category : #'import - pipelines' }
GitModelImporter >> importAllPipelinesOfProject: aGLHProject [
self subclassResponsibility

]

{ #category : #'import - commits' }
GitModelImporter >> importAndLoadLatestsCommitsOfProject: aGLHProject [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ TGitModelImporterTest >> defaultProject [
TGitModelImporterTest >> testImportBranchesOf [

| collection element |
collection := importer importBranchesOf: self defaultProject.
collection := importer importBranchesOfProject: self defaultProject.

self assert: collection isCollection.

Expand Down
Loading