Skip to content
Merged
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
15 changes: 0 additions & 15 deletions src/BitBucketHealth-Model-Importer/BitBucketModelImporter.class.st
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
Class {
#name : #BitBucketModelImporter,
#superclass : #GitModelImporter,
#instVars : [
'withInitialCommits'
],
#category : #'BitBucketHealth-Model-Importer'
}

Expand Down Expand Up @@ -754,15 +751,3 @@ BitBucketModelImporter >> parseUserIntoGLHUser: userDictionnary [
id: (userDictionnary at: #id);
username: (userDictionnary at: #name)
]

{ #category : #accessing }
BitBucketModelImporter >> withInitialCommits [

^ withInitialCommits
]

{ #category : #accessing }
BitBucketModelImporter >> withInitialCommits: anObject [

withInitialCommits := anObject
]
3 changes: 1 addition & 2 deletions src/GitLabHealth-Model-Analysis/Metric.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ Metric >> foundSuccessorOf: commits andCompleteImportForMax: commitLimit [
visitChildCommits: c childCommits
toStoreThemIn: analyzingCommits
upto: commitLimit.
analyzingCommits add: c.
].
analyzingCommits add: c ].

i := 0.
size := analyzingCommits size.
Expand Down
20 changes: 10 additions & 10 deletions src/GitLabHealth-Model-Analysis/ProjectMetric.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,13 @@ ProjectMetric >> loadCommitsSince: since until: until [
until: until.

"download commits unless project cache is not empty"
allCommits := project repository
cacheAt: cacheSymbol
ifAbsentPut: [
| foundCommits |
foundCommits := glhImporter
importCommitsOfProject: project
since: since
until: until.
foundCommits ].
allCommits := project repository cacheAt: cacheSymbol ifAbsentPut: [
| foundCommits |
foundCommits := glhImporter
importCommitsOfProject: project
since: since
until: until.
foundCommits ].

allCommits do: [ :commit | glhImporter importCreatorOfCommit: commit ].
glhImporter chainsCommitsFrom: allCommits.
Expand Down Expand Up @@ -103,7 +101,9 @@ ProjectMetric >> loadMergeRequestsSince: since until: until [
ProjectMetric >> loadProjectCompleteMergeRequestsSince: since until: until [

| mergeRequests |
mergeRequests := self loadProjectMergeRequestsSince: since until: until.
mergeRequests := self
loadProjectMergeRequestsSince: since
until: until.

mergeRequests do: [ :mergeRequest |
glhImporter importMergeResquestMerger: mergeRequest.
Expand Down
9 changes: 9 additions & 0 deletions src/GitLabHealth-Model-Extension/GLHCommit.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Extension { #name : #GLHCommit }

{ #category : #'*GitLabHealth-Model-Extension' }
GLHCommit >> allBranches [
"A commit is associated to a branch only if it is the head of its branch. This method search all the branches by exploring the children commit "

^ (self
deep: [ :commit | commit childCommits ]
flatCollect: [ :commit | commit branch ]) , self branch
]

{ #category : #'*GitLabHealth-Model-Extension' }
GLHCommit >> computeChurnForMaxCommits: aLimit [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ GLHMetamodelGenerator >> tagProperties [

{ #category : #tags }
GLHMetamodelGenerator >> tagRelations [
(tag property: #commit) - (commit property: #tag).
(tag property: #commit) *- (commit property: #tags).
(tag property: #release) - (release property: #tag).
(tag property: #repository) *-<> (repository property: #tags).
]
Expand Down
56 changes: 19 additions & 37 deletions src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Class {
#name : #GitlabModelImporter,
#superclass : #GitModelImporter,
#instVars : [
'withInitialCommits',
'withInitialMergeRequest'
],
#category : #'GitLabHealth-Model-Importer'
}

Expand Down Expand Up @@ -179,28 +175,26 @@ GitlabModelImporter >> completeImportedProject: aGLHProject [
add: aGLHProject
unless: self blockOnIdEquality.

self importLatestPipelinesOfProject: importedProject.
self factoryImporter importLatestPipelinesOfProject: importedProject.

"aGLHProject creator: (self importUser: aGLHProject creator_id)."

(self importUser: importedProject creator_id) addCreatedProject:
importedProject.
(self factoryImporter importUser: importedProject creator_id)
addCreatedProject: importedProject.



importedProject repository: GLHRepository new.
self glhModel add: importedProject repository.
self completeImportsOfRepository: importedProject repository.


withInitialMergeRequest ifTrue: [
self
self factoryImporter
importMergeRequestsOfProject: importedProject
since: DateAndTime today
until: DateAndTime now ].

^ importedProject


]

{ #category : #'import - repositories' }
Expand Down Expand Up @@ -591,18 +585,6 @@ GitlabModelImporter >> glhApi: anObject [
repoApi := anObject
]

{ #category : #accessing }
GitlabModelImporter >> glhModel [

^ glhModel
]

{ #category : #accessing }
GitlabModelImporter >> glhModel: anObject [

glhModel := anObject
]

{ #category : #'import - users' }
GitlabModelImporter >> importActiveHumanUsers [

Expand Down Expand Up @@ -1208,16 +1190,22 @@ GitlabModelImporter >> importLatestReleaseOfProject: aGLHProject [
^ foundRelease.
]

{ #category : #'import - commits' }
{ #category : #'import - merge-requests' }
GitlabModelImporter >> importMergeRequestCommits: aGLPHEMergeRequest [

| commits result |
aGLPHEMergeRequest commits ifNotNil: [ ^ aGLPHEMergeRequest commits ].

result := self repoApi mergeRequests commitsOf: aGLPHEMergeRequest iid inProject: aGLPHEMergeRequest project id.

commits := (result collect: [ :commitsJson | self parseCommitsResult: commitsJson ]) flattened.
commits := commits collect: [ :commit | self importCommit: commit id ofProject: aGLPHEMergeRequest project ].

result := self repoApi mergeRequests
commitsOf: aGLPHEMergeRequest iid
inProject: aGLPHEMergeRequest project id.

commits := (result collect: [ :commitsJson |
self parseCommitsResult: commitsJson ]) flattened.
commits := commits collect: [ :commit | "Could we use factory.. unsure because sometimes commits of squashed MR are only saved on remote"
self
importCommit: commit id
ofProject: aGLPHEMergeRequest project ].
aGLPHEMergeRequest commits: commits.


Expand Down Expand Up @@ -1570,7 +1558,7 @@ GitlabModelImporter >> importProject: aProjectID [
| result projectResult |
('Import project with id: ' , aProjectID printString) recordInfo.

(glhModel allWithType: GLHProject)
(self glhModel allWithType: GLHProject)
detect: [ :project | project id = aProjectID ]
ifFound: [ :project | ^ project ].

Expand Down Expand Up @@ -2142,9 +2130,3 @@ GitlabModelImporter >> subGroupsOf: aGroupID [

^ subgroups
]

{ #category : #accessing }
GitlabModelImporter >> withInitialCommits: aBoolean [

withInitialCommits := aBoolean
]
56 changes: 31 additions & 25 deletions src/GitLabHealth-Model/GLHCommit.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ a commit attached to a repository
|---|
| `branch` | `GLHCommit` | `commits` | `GLHBranch` | |
| `childCommits` | `GLHCommit` | `parentCommits` | `GLHCommit` | |
| `commitedMergeRequest` | `GLHCommit` | `mergeRequestCommit` | `GLHMergeRequest` | |
| `commitedMergeRequest` | `GLHCommit` | `mergedCommit` | `GLHMergeRequest` | |
| `commitedMergeRequest` | `GLHCommit` | `mergeRequestCommit` | `GLHMergeRequest` | |
| `parentCommits` | `GLHCommit` | `childCommits` | `GLHCommit` | |
| `squashedMergeRequest` | `GLHCommit` | `squashCommit` | `GLHMergeRequest` | |
| `tag` | `GLHCommit` | `commit` | `GLHTag` | |
| `tags` | `GLHCommit` | `commit` | `GLHTag` | |


## Properties
Expand Down Expand Up @@ -58,31 +58,31 @@ Class {
#traits : 'FamixTNamedEntity + GLHTRef',
#classTraits : 'FamixTNamedEntity classTrait + GLHTRef classTrait',
#instVars : [
'#parent_ids => FMProperty defaultValue: \'OrderedCollection new\'',
'#id => FMProperty',
'#short_id => FMProperty',
'#title => FMProperty',
'#author_name => FMProperty',
'#additions => FMProperty',
'#author_email => FMProperty',
'#author_name => FMProperty',
'#authored_date => FMProperty',
'#committer_name => FMProperty',
'#committer_email => FMProperty',
'#branch => FMMany type: #GLHBranch opposite: #commits',
'#childCommits => FMMany type: #GLHCommit opposite: #parentCommits',
'#commitCreator => FMOne type: #GLHUser opposite: #commits',
'#commitedMergeRequest => FMOne type: #GLHMergeRequest opposite: #mergedCommit',
'#committed_date => FMProperty',
'#committer_email => FMProperty',
'#committer_name => FMProperty',
'#created_at => FMProperty',
'#message => FMProperty',
'#web_url => FMProperty',
'#additions => FMProperty',
'#deletions => FMProperty',
'#repository => FMOne type: #GLHRepository opposite: #commits',
'#branch => FMMany type: #GLHBranch opposite: #commits',
'#diffs => FMMany type: #GLHDiff opposite: #commit',
'#commitCreator => FMOne type: #GLHUser opposite: #commits',
'#parentCommits => FMMany type: #GLHCommit opposite: #childCommits',
'#childCommits => FMMany type: #GLHCommit opposite: #parentCommits',
'#id => FMProperty',
'#jobs => FMMany type: #GLHJob opposite: #commit',
'#tag => FMOne type: #GLHTag opposite: #commit',
'#commitedMergeRequest => FMOne type: #GLHMergeRequest opposite: #mergedCommit',
'#squashedMergeRequest => FMOne type: #GLHMergeRequest opposite: #squashCommit'
'#message => FMProperty',
'#parentCommits => FMMany type: #GLHCommit opposite: #childCommits',
'#parent_ids => FMProperty defaultValue: \'OrderedCollection new\'',
'#repository => FMOne type: #GLHRepository opposite: #commits',
'#short_id => FMProperty',
'#squashedMergeRequest => FMOne type: #GLHMergeRequest opposite: #squashCommit',
'#tags => FMMany type: #GLHTag opposite: #commit',
'#title => FMProperty',
'#web_url => FMProperty'
],
#category : #'GitLabHealth-Model-Entities'
}
Expand Down Expand Up @@ -126,6 +126,12 @@ GLHCommit >> addParentCommit: anObject [
^ self parentCommits add: anObject
]

{ #category : #adding }
GLHCommit >> addTag: anObject [
<generated>
^ self tags add: anObject
]

{ #category : #accessing }
GLHCommit >> additions [

Expand Down Expand Up @@ -473,19 +479,19 @@ GLHCommit >> squashedMergeRequest: anObject [
]

{ #category : #accessing }
GLHCommit >> tag [
"Relation named: #tag type: #GLHTag opposite: #commit"
GLHCommit >> tags [
"Relation named: #tags type: #GLHTag opposite: #commit"

<generated>
<derived>
^ tag
^ tags
]

{ #category : #accessing }
GLHCommit >> tag: anObject [
GLHCommit >> tags: anObject [

<generated>
tag := anObject
tags value: anObject
]

{ #category : #accessing }
Expand Down
2 changes: 1 addition & 1 deletion src/GitLabHealth-Model/GLHIssue.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ an Issues help collaboration within a team to plan, track, and deliver work
| `description` | `String` | nil | |
| `due_date` | `Object` | nil | |
| `id` | `Number` | nil | |
| `name` | `String` | nil | Basic name of the entity, not full reference.|
| `name` | `String` | nil | |
| `name` | `String` | nil | Basic name of the entity, not full reference.|
| `state` | `String` | nil | |
| `updated_at` | `Object` | nil | |

Expand Down
2 changes: 1 addition & 1 deletion src/GitLabHealth-Model/GLHJob.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ A CI Job
| `allow_failure` | `Boolean` | nil | |
| `duration` | `Object` | nil | |
| `id` | `Number` | nil | |
| `name` | `String` | nil | |
| `name` | `String` | nil | Basic name of the entity, not full reference.|
| `name` | `String` | nil | |
| `ref` | `String` | nil | |
| `web_url` | `String` | nil | |

Expand Down
12 changes: 6 additions & 6 deletions src/GitLabHealth-Model/GLHTag.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ a Tag is a reference to a specific point in the repository's history
### Other
| Relation | Origin | Opposite | Type | Comment |
|---|
| `commit` | `GLHTag` | `tag` | `GLHCommit` | |
| `commit` | `GLHTag` | `tags` | `GLHCommit` | |
| `release` | `GLHTag` | `tag` | `GLHRelease` | |


Expand All @@ -35,13 +35,13 @@ Class {
#traits : 'GLHTRef',
#classTraits : 'GLHTRef classTrait',
#instVars : [
'#commit => FMOne type: #GLHCommit opposite: #tags',
'#created_at => FMProperty',
'#message => FMProperty',
'#target => FMProperty',
'#protected => FMProperty',
'#created_at => FMProperty',
'#commit => FMOne type: #GLHCommit opposite: #tag',
'#release => FMOne type: #GLHRelease opposite: #tag',
'#repository => FMOne type: #GLHRepository opposite: #tags'
'#repository => FMOne type: #GLHRepository opposite: #tags',
'#target => FMProperty'
],
#category : #'GitLabHealth-Model-Entities'
}
Expand All @@ -57,7 +57,7 @@ GLHTag class >> annotation [

{ #category : #accessing }
GLHTag >> commit [
"Relation named: #commit type: #GLHCommit opposite: #tag"
"Relation named: #commit type: #GLHCommit opposite: #tags"

<generated>
^ commit
Expand Down
2 changes: 1 addition & 1 deletion src/GitLabHealth-Model/GLHUser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ A GitLab User
| `job_title` | `String` | nil | |
| `linkedin` | `String` | nil | |
| `location` | `String` | nil | |
| `name` | `String` | nil | |
| `name` | `String` | nil | Basic name of the entity, not full reference.|
| `name` | `String` | nil | |
| `organization` | `String` | nil | |
| `pronouns` | `String` | nil | |
| `public_email` | `String` | nil | |
Expand Down
Loading
Loading