• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / GitProjectHealth / 16469898571

23 Jul 2025 11:54AM UTC coverage: 73.182% (-1.7%) from 74.896%
16469898571

Pull #218

github

web-flow
Merge 1bf70674d into e893a45f0
Pull Request #218: add tags and commits imports

152 of 153 new or added lines in 5 files covered. (99.35%)

683 existing lines in 8 files now uncovered.

17729 of 24226 relevant lines covered (73.18%)

0.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.77
/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st
1
Class {
2
        #name : #GitlabModelImporter,
3
        #superclass : #GitModelImporter,
4
        #instVars : [
5
                'withInitialCommits',
6
                'withInitialMergeRequest',
7
                'generalReader'
8
        ],
9
        #category : #'GitLabHealth-Model-Importer'
10
}
11

12
{ #category : #private }
13
GitlabModelImporter >> addCommits: commitsList toRepository: aProjectRepository [
×
14
        "I take a list of GLHCommit. But some might have been parsed but are already on the model..."
×
15

×
16
        "I return the list of added commits"
×
17

×
18
        | existingCommits newlyFoundCommit |
×
19
        existingCommits := aProjectRepository mooseModel allWithType:
×
20
                                   GLHCommit.
×
21
        newlyFoundCommit := commitsList reject: [ :commitParsed |
×
22
                                    existingCommits anySatisfy: [ :existingCommit |
×
23
                                            existingCommit id = commitParsed id ] ].
×
24
        aProjectRepository mooseModel addAll: newlyFoundCommit.
×
25
        aProjectRepository commits addAll: newlyFoundCommit.
×
26
        ^ newlyFoundCommit
×
27
]
×
28

29
{ #category : #private }
30
GitlabModelImporter >> addGroupResultToModel: groupResult [
1✔
31
        |group|
1✔
32
        group := self glhModel add: groupResult unless: self blockOnIdEquality.
1✔
33
        self glhModel
1✔
34
                addAll: group projects
1✔
35
                unless: self blockOnIdEquality.
1✔
36
        ^ group 
1✔
37
]
1✔
38

39
{ #category : #'import - pipelines' }
40
GitlabModelImporter >> allPipelinesOf: aProjectID [
×
41

×
42
        | result |
×
43
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
×
44
        result := self repoApi pipelines getAllInProject: aProjectID.
×
45
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
×
46

×
47
        ^ (result collect: [ :pipelinesJson |
×
48
                           self parsePipelinesResult: pipelinesJson ]) flattened
×
49
]
×
50

51
{ #category : #private }
52
GitlabModelImporter >> chainsCommitsFrom: commitsCollection [
1✔
53

1✔
54
        | dic |
1✔
55
        
1✔
56
        ('Chains ', commitsCollection size printString , ' commits') recordInfo.
1✔
57
        
1✔
58
        dic := ((self glhModel allWithType: GLHCommit) collect: [ :commit |
1✔
59
                        commit id -> commit ]) asSet asDictionary.
1✔
60

1✔
61
        commitsCollection do: [ :commit |
1✔
62
                commit parent_ids do: [ :parentId | 
1✔
63
                        dic
1✔
64
                                at: parentId
1✔
65
                                ifPresent: [ :parentCommit |
1✔
66
                                        parentCommit childCommits
1✔
67
                                                add: commit
1✔
68
                                                unless: self blockOnIdEquality ]
1✔
69
                                ifAbsent: [  ] ] ].
1✔
70
        ^ commitsCollection
1✔
71
]
1✔
72

73
{ #category : #'import - commits' }
74
GitlabModelImporter >> commitsOfProject: aGLHProject forRefName: refName until: toDate [
×
75

×
76
        | params results allCommits |
×
77
        
×
78
        params := { 
×
79
                #ref_name -> refName.
×
80
                #until -> (toDate ifNotNil: [ toDate asDateAndTime asString ] ifNil: [ '' ]) 
×
81
        } asDictionary.
×
82
        results := self repoApi commits getAllInProject: aGLHProject id withParams: params.
×
83
        allCommits := (results collect: [ :commitsJson | self parseCommitsResult: commitsJson ]) flattened.
×
84
        
×
85
        self glhModel addAll: allCommits unless: self blockOnIdEquality.
×
86
        aGLHProject repository commits addAll: allCommits unless: self blockOnIdEquality.
×
87

×
88
        self withCommitDiffs ifTrue: [
×
89
                aGLHProject repository commits do: [ :commit |
×
90
                        self importDiffOfCommit: commit ] ].
×
91
        
×
92
        ^allCommits
×
93
]
×
94

95
{ #category : #'import - projects' }
96
GitlabModelImporter >> completeImportProject: aGLHProject [
×
97

×
98
        | importedProject |
×
99
        ('Complete import of project: ' , aGLHProject id printString)
×
100
                recordInfo.
×
101
        aGLHProject repository ifNotNil: [ ^ aGLHProject ].
×
102

×
103
        importedProject := self glhModel
×
104
                                   add: aGLHProject
×
105
                                   unless: self blockOnIdEquality.
×
106

×
107
        self importLatestPipelinesOfProject: importedProject.
×
108

×
109
        "aGLHProject creator: (self importUser: aGLHProject creator_id)."
×
110

×
111
        (self importUser: importedProject creator_id) addCreatedProject:
×
112
                importedProject.
×
113

×
114

×
115
        importedProject repository: GLHRepository new.
×
116
        self glhModel add: importedProject repository.
×
117
        self importRepository: importedProject repository.
×
118

×
119

×
120
        withInitialMergeRequest ifTrue: [
×
121
                self
×
122
                        importMergeRequests: importedProject
×
123
                        since: DateAndTime today
×
124
                        until: DateAndTime now ].
×
125

×
126
        ^ importedProject
×
127
        
×
128

×
129
]
×
130

131
{ #category : #'import - commits' }
132
GitlabModelImporter >> completeImportedCommit: aCommit [
1✔
133

1✔
134
        ('completing commit: ' , aCommit short_id printString) recordInfo.
1✔
135
        self importCreatorOfCommit: aCommit.
1✔
136

1✔
137
        self withCommitDiffs ifTrue: [
1✔
138
                | diffs |
1✔
139
                aCommit diffs ifEmpty: [
1✔
140
                        diffs := self importDiffOfCommit: aCommit.
1✔
141
                        self glhModel addAll: diffs unless: self blockForDiffEquality ] ].
1✔
142

1✔
143
        ^ aCommit
1✔
144
]
1✔
145

146
{ #category : #'import - pipelines' }
147
GitlabModelImporter >> completeImportedPipeline: aGLHPipeline [ 
×
148
        |result parsedResult|
×
149
        
×
150
        aGLHPipeline duration ifNotNil: [ ^ aGLHPipeline ].
×
151
        
×
152
        result := self repoApi pipelines get: aGLHPipeline id inProject: aGLHPipeline project id. 
×
153
        parsedResult := self parsePipelineResult: result. 
×
154
        
×
155
        "aGLHPipeline methods".
×
156
        { #'created_at:' . #'status:' . #'finished_at:' . #'duration:' . #'started_at:' . #'updated_at:' . #'ref:' } do: [ :m |
×
157
                aGLHPipeline perform: m asSymbol with: (parsedResult perform: (m withoutSuffix: ':') asSymbol )
×
158
                 ].
×
159
        
×
160
        parsedResult cacheAt: #userID ifPresent: [:id |
×
161
                aGLHPipeline user: (self importUser: id). 
×
162
                ].
×
163
        
×
164
        ^ aGLHPipeline. 
×
165
]
×
166

167
{ #category : #'import - pipelines' }
168
GitlabModelImporter >> completeImportedPipelines: aCollectionOfGLHPipeline [
×
169
        ^ aCollectionOfGLHPipeline collect: [ :pipeline | self completeImportedPipeline: pipeline ].  
×
170
]
×
171

172
{ #category : #'import - projects' }
173
GitlabModelImporter >> completeImportedProject: aGLHProject [
1✔
174

1✔
175
        | importedProject |
1✔
176
        ('Complete import of project: ' , aGLHProject id printString)
1✔
177
                recordInfo.
1✔
178
        aGLHProject repository ifNotNil: [ ^ aGLHProject ].
1✔
179

1✔
180
        importedProject := self glhModel
1✔
181
                                   add: aGLHProject
1✔
182
                                   unless: self blockOnIdEquality.
1✔
183

1✔
184
        self importLatestPipelinesOfProject: importedProject.
1✔
185

1✔
186
        "aGLHProject creator: (self importUser: aGLHProject creator_id)."
1✔
187

1✔
188
        (self importUser: importedProject creator_id) addCreatedProject:
1✔
189
                importedProject.
1✔
190

1✔
191

1✔
192
        importedProject repository: GLHRepository new.
1✔
193
        self glhModel add: importedProject repository.
1✔
194
        self importRepository: importedProject repository.
1✔
195

1✔
196

1✔
197
        withInitialMergeRequest ifTrue: [
1✔
198
                self
1✔
199
                        importMergeRequests: importedProject
1✔
200
                        since: DateAndTime today
1✔
201
                        until: DateAndTime now ].
1✔
202

1✔
203
        ^ importedProject
1✔
204
        
1✔
205

1✔
206
]
1✔
207

208
{ #category : #'private - configure reader' }
209
GitlabModelImporter >> configureReaderForCommit: reader [
1✔
210

1✔
211
          reader for: GLHCommit do: [ :mapping |
1✔
212
                mapping mapInstVars:
1✔
213
                        #( id short_id title author_name author_email committer_name
1✔
214
                           committer_email message web_url ).
1✔
215
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
216
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
217
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
218
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
219
                mapping
1✔
220
                        mapProperty: 'stats'
1✔
221
                        getter: [ :el | "Not used" ]
1✔
222
                        setter: [ :commit :value |
1✔
223
                                commit deletions: (value at: #deletions).
1✔
224
                                commit additions: (value at: #additions) ] ].
1✔
225

1✔
226
        reader for: DateAndTime customDo: [ :mapping |
1✔
227
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
228

1✔
229
        reader
1✔
230
                for: #ArrayOfIds
1✔
231
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
232
  
1✔
233
        reader
1✔
234
                for: #ArrayOfCommit
1✔
235
                customDo: [ :customMappting |
1✔
236
                customMappting listOfElementSchema: GLHCommit ].
1✔
237

1✔
238
]
1✔
239

240
{ #category : #'private - configure reader' }
241
GitlabModelImporter >> configureReaderForDiffs: reader [
1✔
242

1✔
243
        reader for: GLHDiff do: [ :mapping |
1✔
244
                mapping mapInstVars:
1✔
245
                        #( deleted_file new_file new_path old_path renamed_file ).
1✔
246
                mapping mapInstVar: #diffString to: #diff ].
1✔
247

1✔
248
        reader
1✔
249
                for: #ArrayOfDiffs
1✔
250
                customDo: [ :customMappting |
1✔
251
                customMappting listOfElementSchema: GLHDiff ].
1✔
252
        ^ reader
1✔
253
]
1✔
254

255
{ #category : #'private - configure reader' }
256
GitlabModelImporter >> configureReaderForGroup: reader [
1✔
257

1✔
258
        reader for: GLHGroup do: [ :mapping |
1✔
259
                mapping mapInstVars.
1✔
260
                (mapping mapInstVar: #projects) valueSchema: #ArrayOfProjects ].
1✔
261
        reader mapInstVarsFor: GLHProject.
1✔
262
        reader
1✔
263
                for: #ArrayOfProjects
1✔
264
                customDo: [ :customMappting |
1✔
265
                customMappting listOfElementSchema: GLHProject ].
1✔
266
        reader
1✔
267
                for: #ArrayOfGroups
1✔
268
                customDo: [ :customMappting |
1✔
269
                customMappting listOfElementSchema: GLHGroup ]
1✔
270
]
1✔
271

272
{ #category : #'private - configure reader' }
273
GitlabModelImporter >> configureReaderForMergeRequest: reader [
1✔
274
        "declare quil y a un array a mapper"
1✔
275

1✔
276
        reader for: #ArrayOfMergeRequest customDo: [ :customMappting |
1✔
277
                customMappting listOfElementSchema: GLHMergeRequest ].
1✔
278

1✔
279
        "declare la liste des properties"
1✔
280
        reader for: GLHMergeRequest do: [ :mapping |
1✔
281
                mapping mapInstVars:
1✔
282
                        #( blocking_discussions_resolved changes_count description
1✔
283
                           detailed_merge_status discussion_locked downvotes draft first_deployed_to_production_at
1✔
284
                           force_remove_source_branch has_conflicts id iid labels latest_build_finished_at
1✔
285
                           latest_build_started_at merge_commit_sha merge_status
1✔
286
                           merge_when_pipeline_succeeds merged_at milestone project_id
1✔
287
                           reference references_full references_relative
1✔
288
                           references_short sha should_remove_source_branch
1✔
289
                           source_branch source_project_id squash squash_commit_sha
1✔
290
                           squash_on_merge state subscribed target_branch target_project_id
1✔
291
                           task_completion_status_completed_count
1✔
292
                           task_completion_status_count time_stats_human_time_estimate
1✔
293
                           time_stats_human_total_time_spent
1✔
294
                           time_stats_time_estimate time_stats_total_time_spent
1✔
295
                           title updated_at upvotes user_notes_count web_url work_in_progress ).
1✔
296
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
297
                (mapping mapInstVar: #updated_at) valueSchema: DateAndTime.
1✔
298
                (mapping mapInstVar: #merged_at) valueSchema: DateAndTime.
1✔
299
                (mapping mapInstVar: #closed_at) valueSchema: DateAndTime.
1✔
300
                "(mapping mapInstVar: #assignee) valueSchema: GLHUser."
1✔
301
                mapping
1✔
302
                        mapProperty: #author
1✔
303
                        getter: [  ]
1✔
304
                        setter: [ :object :value |
1✔
305
                        object cacheAt: #authorID put: (value at: #id) ].
1✔
306
                mapping
1✔
307
                        mapProperty: #merge_user
1✔
308
                        getter: [  ]
1✔
309
                        setter: [ :object :value | 
1✔
310
                                value ifNotNil: [
1✔
311
                                        object cacheAt: #mergeUserID put: (value at: #id) ] ] ].
1✔
312

1✔
313
        "(mapping mapInstVar: #closed_by) valueSchema: GLHUser.
1✔
314
        (mapping mapInstVar: #mergeCommit) valueSchema: GLHCommit."
1✔
315
        "indique ce que doit faire le reader lorsqu'il parse une DateAndTime object"
1✔
316
        reader for: DateAndTime customDo: [ :mapping |
1✔
317
                mapping decoder: [ :string |
1✔
318
                        string ifNil: [ nil ] ifNotNil: [ DateAndTime fromString: string ] ] ]
1✔
319
]
1✔
320

321
{ #category : #'private - configure reader' }
322
GitlabModelImporter >> configureReaderForPipeline: reader [
1✔
323

1✔
324
        reader mapInstVarsFor: GLHPipeline.
1✔
325
        
1✔
326
        reader for: GLHPipeline do: [ :mapping |
1✔
327

1✔
328
                mapping
1✔
329
                        mapProperty: #created_at
1✔
330
                        getter: [ :object | #ignore ]
1✔
331
                        setter: [ :object :value |
1✔
332
                        object created_at: (value ifNotNil: [DateAndTime fromString: value]).
1✔
333
                        object runDate: (value ifNotNil: [DateAndTime fromString: value]) ].
1✔
334
                
1✔
335
                mapping
1✔
336
                        mapProperty: #updated_at
1✔
337
                        getter: [ :object | #ignore ]
1✔
338
                        setter: [ :object :value |
1✔
339
                        object updated_at: (value ifNotNil: [DateAndTime fromString: value]).
1✔
340
                        ].
1✔
341
                
1✔
342
                mapping
1✔
343
                        mapProperty: #finished_at
1✔
344
                        getter: [ :object | #ignore ]
1✔
345
                        setter: [ :object :value |
1✔
346
                                object finished_at: (value ifNotNil: [DateAndTime fromString: value]).
1✔
347
                        ].
1✔
348
                
1✔
349
                mapping
1✔
350
                        mapProperty: #started_at  
1✔
351
                        getter: [ :object | #ignore ]
1✔
352
                        setter: [ :object :value |
1✔
353
                        object started_at: (value ifNotNil: [DateAndTime fromString: value]).
1✔
354
                        ].
1✔
355
                
1✔
356
                mapping
1✔
357
                        mapProperty: #source
1✔
358
                        getter: [ :object | #ignore ]
1✔
359
                        setter: [ :object :value |
1✔
360
                        object sourceEvent: value.
1✔
361
                        ].
1✔
362
                
1✔
363
                mapping
1✔
364
                        mapProperty: #duration
1✔
365
                        getter: [ :object | #ignore ]
1✔
366
                        setter: [ :object :value |
1✔
367
                        object duration: (value ifNotNil: [value asDuration]) .
1✔
368
                        ].
1✔
369
                
1✔
370
                mapping
1✔
371
                        mapProperty: #user
1✔
372
                        getter: [ :object | #ignore ]
1✔
373
                        setter: [ :object :value |
1✔
374
                        value ifNotNil: [object cacheAt: #userID put: (value at: #id)].
1✔
375
                        ].
1✔
376
                
1✔
377
                 ].
1✔
378
        
1✔
379
        reader
1✔
380
                for: #ArrayOfPipelines
1✔
381
                customDo: [ :customMappting |
1✔
382
                customMappting listOfElementSchema: GLHPipeline ].
1✔
383
]
1✔
384

385
{ #category : #'private - configure reader' }
386
GitlabModelImporter >> configureReaderForReleases: reader [
1✔
387

1✔
388
        reader mapInstVarsFor: GLHRelease .
1✔
389
        
1✔
390
        
1✔
391
        reader for: GLHRelease do: [ :mapping |
1✔
392
                        
1✔
393
                (mapping mapInstVar: #author) valueSchema: GLHUser .
1✔
394
                 ].
1✔
395
        
1✔
396
        
1✔
397
        reader
1✔
398
                for: #ArrayOfReleases
1✔
399
                customDo: [ :customMappting |
1✔
400
                customMappting listOfElementSchema: GLHRelease ].
1✔
401
]
1✔
402

403
{ #category : #'private - configure reader' }
404
GitlabModelImporter >> configureReaderForTags: reader [
1✔
405

1✔
406
        reader mapInstVarsFor: GLHTag .
1✔
407
        
1✔
408
        reader for: GLHTag do: [ :mapping |
1✔
409
                        
1✔
410
                (mapping mapInstVar: #commit) valueSchema: GLHCommit .
1✔
411
"                (mapping mapInstVar: #release) valueSchema: GLHRelease ."
1✔
412
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime .
1✔
413
                
1✔
414
                mapping
1✔
415
                        mapProperty: #release
1✔
416
                        getter: [ :object | #ignore ]
1✔
417
                        setter: [ :object :value |
1✔
418
                        object release: (value ifNotNil: [GLHRelease new description: (value at:#description); tag_name: (value at: #tag_name); yourself ]).
1✔
419
                        ].
1✔
420
                 ].
1✔
421
        
1✔
422
        reader
1✔
423
                for: #ArrayOfTags
1✔
424
                customDo: [ :customMappting |
1✔
425
                customMappting listOfElementSchema: GLHTag ].
1✔
426
]
1✔
427

1✔
428
{ #category : #'private - configure reader' }
1✔
429
GitlabModelImporter >> configureReaderForUsers: reader [
1✔
430

1✔
431
        reader mapInstVarsFor: GLHUser.
1✔
432

1✔
433
        reader
1✔
434
                for: #ArrayOfUser
1✔
435
                customDo: [ :customMappting |
1✔
436
                customMappting listOfElementSchema: GLHUser ].
1✔
437

1✔
438
]
1✔
439

1✔
440
{ #category : #private }
1✔
441
GitlabModelImporter >> convertApiFileAsFile: aAPIFile [
1✔
442

1✔
443
        aAPIFile type = 'tree' ifTrue: [ 
1✔
444
                ^ GLHFileDirectory new
1✔
445
                          name: aAPIFile name;
1✔
446
                          yourself ].
1✔
447
        ^ GLHFileBlob new
1✔
448
                  name: aAPIFile name;
1✔
449
                  yourself
1✔
450
]
1✔
451

1✔
452
{ #category : #private }
1✔
453
GitlabModelImporter >> detectEntityType: aType overAttribut: aSelector equalTo: value [
1✔
454

1✔
455
        ^ (self glhModel allWithType: aType) detect: [ :entity |
1✔
456
                  (entity perform: aSelector) = value ] ifNone: [ nil ]. 
1✔
457
]
1✔
458

1✔
459
{ #category : #accessing }
1✔
460
GitlabModelImporter >> glhApi [
1✔
461

1✔
462
        self
1✔
463
                deprecated: 'Use #repoApi instead'
1✔
464
                on: '7 October 2024'
1✔
465
                in:
1✔
466
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
1✔
467

1✔
468
        ^ repoApi
1✔
469
]
1✔
470

1✔
471
{ #category : #accessing }
1✔
472
GitlabModelImporter >> glhApi: anObject [
1✔
473

1✔
474
        self
1✔
475
                deprecated: 'Use #repoApi: instead'
1✔
476
                on: '7 October 2024'
1✔
477
                in:
1✔
478
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
1✔
479

1✔
480
        repoApi := anObject
1✔
481
]
1✔
482

1✔
483
{ #category : #accessing }
1✔
484
GitlabModelImporter >> glhModel [
1✔
485

1✔
486
        ^ glhModel
1✔
487
]
1✔
488

1✔
489
{ #category : #accessing }
1✔
490
GitlabModelImporter >> glhModel: anObject [
1✔
491

1✔
492
        glhModel := anObject
1✔
493
]
1✔
494

1✔
495
{ #category : #'import - users' }
1✔
496
GitlabModelImporter >> importActiveHumanUsers [
1✔
497

1✔
498
        | params result users |
1✔
499
        params := { 
1✔
500
                #humans -> 'true'.
1✔
501
                #active -> 'true'.
1✔
502
                #without_project_bots -> 'true'
1✔
503
        } asDictionary.
1✔
504
        result := self repoApi users allWithParams: params.
1✔
505
        users := (result collect: [ :usersJson | self parseUsersResult: usersJson ]) flattened.
1✔
506
        
1✔
507
        self glhModel
1✔
508
                                 addAll: users
1✔
509
                                 unless: self blockOnIdEquality.
1✔
510

1✔
511
        ^ users
1✔
512
]
1✔
513

1✔
514
{ #category : #'import - groups' }
1✔
515
GitlabModelImporter >> importAllGroups [
1✔
516

1✔
517
        | params results groups |
1✔
518
        
1✔
519
        params := { 
1✔
520
                        #top_level_only -> 'true'
1✔
521
        } asDictionary.
1✔
522
        results := self repoApi groups getAllWithParams: params.
1✔
523
        
1✔
524
        groups := (results collect: [ :groupsJson | generalReader
1✔
525
                                            on: groupsJson readStream;
1✔
526
                                            nextAs: #ArrayOfGroups. ]) flattened.
1✔
527
        ^ groups
1✔
528
]
1✔
529

1✔
530
{ #category : #'import - pipelines' }
1✔
531
GitlabModelImporter >> importAllPipelinesOfProject: aGLHProject [
1✔
532

1✔
533
        (self allPipelinesOf: aGLHProject id) do: [ :pipeline |
1✔
534
                |pip|
1✔
535
                pip := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
536
                pip := aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
537
                self completeImportedPipeline: pip. 
1✔
538
                ].
1✔
539
        
1✔
540
        ^ aGLHProject pipelines
1✔
541
]
1✔
542

1✔
543
{ #category : #'import - commits' }
1✔
544
GitlabModelImporter >> importAndLoadLatestsCommitsOfProject: aGLHProject [
1✔
545

1✔
546
        | commits completedProject |
1✔
547
        completedProject := self completeImportedProject: aGLHProject.
1✔
548
        commits := self importLastestCommitsOfProject: completedProject.
1✔
549
        commits do: [ :commit | self completeImportedCommit: commit ].
1✔
550
        self chainsCommitsFrom: commits.
1✔
551
        ^ commits
1✔
552
]
1✔
553

1✔
554
{ #category : #'import - user' }
1✔
555
GitlabModelImporter >> importAuthorOfCommit: aGLHCommit [ 
1✔
556
                |user|
1✔
557
        user:= (self importUserByUsername: aGLHCommit author_name) .
1✔
558
        aGLHCommit commitCreator: user. 
1✔
559
        ^ user
1✔
560
]
1✔
561

1✔
562
{ #category : #'import - commits' }
1✔
563
GitlabModelImporter >> importCommit: aCommitID ofProject: aGLHProject [
1✔
564

1✔
565
        | result parsedResult |
1✔
566
        (self glhModel allWithType: GLHCommit) asOrderedCollection
1✔
567
                detect: [ :commit | commit id = aCommitID ]
1✔
568
                ifFound: [ :commit | ^ commit ].
1✔
569
        result := self repoApi commits get: aCommitID inProject: aGLHProject id.
1✔
570
        
1✔
571
        parsedResult := self parseCommitResult: result.
1✔
572
        
1✔
573
        parsedResult := self glhModel add: parsedResult unless: self blockOnIdEquality.
1✔
574
        parsedResult := aGLHProject repository commits add: parsedResult unless: self blockOnIdEquality.
1✔
575
                
1✔
576
        ^ parsedResult
1✔
577
]
1✔
578

1✔
579
{ #category : #'import - commits' }
1✔
580
GitlabModelImporter >> importCommitOfProject: anProject withId: anID [
1✔
581

1✔
582
        | commit result |
1✔
583
        anID ifNil: [ ^ nil ].
1✔
584

1✔
585
        ('looking for commit ' , anID printString , ' in project : '
1✔
586
         , anProject id printString) recordInfo.
1✔
587

1✔
588
        commit := (self
1✔
589
                           detectEntityType: GLHCommit
1✔
590
                           overAttribut: #id
1✔
591
                           equalTo: anID) ifNil: [
1✔
592
                          result := self repoApi commits get: anID inProject: anProject id.
1✔
593
                          commit := (self parseCommitsResult: '[' , result , ']')
1✔
594
                                            first.
1✔
595

1✔
596
                          commit := self glhModel add: commit unless: self blockOnIdEquality.
1✔
597
                          commit repository: anProject repository.
1✔
598

1✔
599
                          commit ].
1✔
600

1✔
601
        self withCommitDiffs ifTrue: [ self importDiffOfCommit: commit ].
1✔
602

1✔
603
        ^ commit
1✔
604
]
1✔
605

1✔
606
{ #category : #'import - commits' }
1✔
607
GitlabModelImporter >> importCommits: aGLHProject [
1✔
608
        "limited to the last 20 commits"
1✔
609

1✔
610
        | results parsedResults params |
1✔
611
        params := { 
1✔
612
         #with_stats -> 'true'
1✔
613
        } asDictionary.
1✔
614
        results := self repoApi commits getByPage: 1 perPage: 20 inProject: aGLHProject id withParams: params.
1✔
615
        
1✔
616
        parsedResults := self parseCommitsResult: results.
1✔
617
        self glhModel addAll: parsedResults unless: self blockOnIdEquality.
1✔
618

1✔
619
        parsedResults do: [ :commit |
1✔
620
                commit repository: aGLHProject repository ].
1✔
621

1✔
622
        self withCommitDiffs ifTrue: [
1✔
623
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
1✔
624
        
1✔
625
        ^ parsedResults. 
1✔
626
]
1✔
627

1✔
628
{ #category : #'import - commits' }
1✔
629
GitlabModelImporter >> importCommitsFollowing: aCommit upToDays: aNumberOfDay [
1✔
630
        "import the 'n' commits of a project starting from an initial 'aCommit' commit. 
1✔
631
        Lazy import does not import the entities inside the model"
1✔
632

1✔
633
        | date |
1✔
634
        date := aCommit created_at asDateAndTime.
1✔
635

1✔
636
        ^ self
1✔
637
                  importCommitsOfBranch: aCommit branch
1✔
638
                  since: date
1✔
639
                  until: date + aNumberOfDay day
1✔
640
]
1✔
641

1✔
642
{ #category : #'import - commits' }
1✔
643
GitlabModelImporter >> importCommitsFromTag: fromTag toTag: toTag [ 
1✔
644
        | results commits project|
1✔
645
                
1✔
646
        (fromTag isNil or: [ toTag isNil ] ) ifTrue: [ ^ OrderedCollection new.  ] .
1✔
647

1✔
648
        project := fromTag repository project.
1✔
649
        results := self repoApi repositories compareInProject: (project id) from: fromTag name to: toTag name.
1✔
650
        
1✔
651
        commits := (NeoJSONReader fromString: results ) at: #commits ifAbsent: ['[]'].
1✔
652
        
1✔
653
        
1✔
654
        commits := self parseCommitsResult: (NeoJSONWriter toString: commits).
1✔
655
         commits := glhModel addAll: commits unless: self blockOnIdEquality.
1✔
656
        commits := project repository commits addAll: commits unless: self blockOnIdEquality.
1✔
657
        
1✔
658
        self chainsCommitsFrom: commits. 
1✔
659
        
1✔
660
        ^ commits. 
1✔
661
        
1✔
662
]
1✔
663

1✔
664
{ #category : #commit }
1✔
665
GitlabModelImporter >> importCommitsOf: aGLHProject withStats: aBoolean until: toDate [
1✔
666

1✔
667
        | newlyFoundCommit page |
1✔
668
        
1✔
669
        self deprecated: [  ] .
1✔
670
        
1✔
671
        page := 0.
1✔
672
        newlyFoundCommit := { true }.
1✔
673
        [ newlyFoundCommit isNotEmpty ] whileTrue: [
1✔
674
                | results parsedResults existingCommits |
1✔
675
                page := page + 1.
1✔
676
                ('import commit page ' , page printString) recordInfo.
1✔
677
                results := self repoApi
1✔
678
                                   commitsOfProject: aGLHProject id
1✔
679
                                   forRefName: nil
1✔
680
                                   since: nil
1✔
681
                                   until: nil
1✔
682
                                   path: nil
1✔
683
                                   author: nil
1✔
684
                                   all: nil
1✔
685
                                   with_stats: aBoolean
1✔
686
                                   firstParent: nil
1✔
687
                                   order: nil
1✔
688
                                   trailers: nil
1✔
689
                                   perPage: 100
1✔
690
                                   page: page.
1✔
691
                parsedResults := self parseCommitsResult: results.
1✔
692
                existingCommits := aGLHProject mooseModel allWithType: GLHCommit.
1✔
693

1✔
694
                newlyFoundCommit := parsedResults reject: [ :commitParsed |
1✔
695
                                            (toDate isNil or: [
1✔
696
                                                     commitParsed committed_date
1✔
697
                                                     < toDate asDateAndTime ]) or: [
1✔
698
                                                    existingCommits anySatisfy: [ :existingCommit |
1✔
699
                                                            existingCommit id = commitParsed id ] ] ].
1✔
700
                aGLHProject mooseModel addAll: newlyFoundCommit.
1✔
701
                aGLHProject repository commits addAll: newlyFoundCommit ].
1✔
702

1✔
703

1✔
704
        self withCommitDiffs ifTrue: [
1✔
705
                aGLHProject repository commits do: [ :commit |
1✔
706
                        self importDiffOfCommit: commit ] ]
1✔
707
]
1✔
708

1✔
709
{ #category : #'import - commits' }
1✔
710
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch [
1✔
711

1✔
712
        | commits |
1✔
713
        "        result := self glhApi
1✔
714
                          commitsOfProject: aGLHBranch repository project id
1✔
715
                          forRefName: aGLHBranch name."
1✔
716
        commits := self
1✔
717
                           importCommitsOfBranch: aGLHBranch
1✔
718
                           since: withCommitsSince.
1✔
719

1✔
720
        self chainsCommitsFrom: commits.
1✔
721

1✔
722
        commits do: [ :aCommit |
1✔
723
                aCommit repository: aGLHBranch repository.
1✔
724
                self completeImportedCommit: aCommit ].
1✔
725
        ^ commits
1✔
726
]
1✔
727

1✔
728
{ #category : #'import - commits' }
1✔
729
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch fromCommit: anInitialCommit [
1✔
730

1✔
731
        | commits |
1✔
732
        "        result := self glhApi
1✔
733
                          commitsOfProject: aGLHBranch repository project id
1✔
734
                          forRefName: aGLHBranch name."
1✔
735
        commits := self
1✔
736
                           importCommitsOfBranch: aGLHBranch
1✔
737
                           since: anInitialCommit committed_date.
1✔
738

1✔
739
        commits do: [ :aCommit |
1✔
740
                aCommit repository: aGLHBranch repository.
1✔
741
                self completeImportedCommit: aCommit ].
1✔
742
        ^ commits
1✔
743
]
1✔
744

1✔
745
{ #category : #'import - commits' }
1✔
746
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch since: fromDate [
1✔
747

1✔
748
        ^ self importCommitsOfBranch: aGLHBranch since: fromDate until: nil
1✔
749
]
1✔
750

1✔
751
{ #category : #'import - commits' }
1✔
752
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch since: fromDate until: toDate [
1✔
753

1✔
754
        | params result allCommits |
1✔
755
        params := { 
1✔
756
          #ref_name -> aGLHBranch name.
1✔
757
          #since ->  (fromDate ifNotNil: [ fromDate asDate asDateAndTime asString ] ifNil: [ '' ]).
1✔
758
          #until -> (toDate ifNotNil: [ toDate asDate asDateAndTime asString ] ifNil: [ '' ]). 
1✔
759

1✔
760
        } asDictionary.
1✔
761
        result := self repoApi commits getAllInProject: aGLHBranch repository project id withParams: params.
1✔
762
        
1✔
763
        allCommits := (result collect: [ :commitsJson | self parseCommitsResult: commitsJson ]) flattened.
1✔
764
        
1✔
765
        aGLHBranch commits
1✔
766
                        addAll: allCommits
1✔
767
                        unless: self blockOnIdEquality.
1✔
768

1✔
769
        self glhModel
1✔
770
                addAll: aGLHBranch commits
1✔
771
                unless: self blockOnIdEquality.
1✔
772
                
1✔
773
        self chainsCommitsFrom: allCommits. 
1✔
774

1✔
775
        ^ allCommits
1✔
776
]
1✔
777

1✔
778
{ #category : #'import - commits' }
1✔
779
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch until: toDate [
1✔
780

1✔
781
        ^ self importCommitsOfBranch: aGLHBranch since: nil until: toDate
1✔
782
]
1✔
783

1✔
784
{ #category : #'import - commits' }
1✔
785
GitlabModelImporter >> importCommitsOfProject: aProject since: fromDate until: toDate [
1✔
786

1✔
787
        | params results allCommits |
1✔
788
        params := {
1✔
789
                          (#since
1✔
790
                           ->
1✔
791
                           (fromDate
1✔
792
                                    ifNotNil: [ fromDate asDate asDateAndTime asString ]
1✔
793
                                    ifNil: [ '' ])).
1✔
794
                          (#until
1✔
795
                           ->
1✔
796
                           (toDate
1✔
797
                                    ifNotNil: [ toDate asDate asDateAndTime asString ]
1✔
798
                                    ifNil: [ '' ])).
1✔
799
                          (#with_stats -> 'true').
1✔
800
                          (#all -> 'true') } asDictionary.
1✔
801
        results := self repoApi commits
1✔
802
                           getAllInProject: aProject id
1✔
803
                           withParams: params.
1✔
804

1✔
805
        allCommits := (results collect: [ :commitsJson |
1✔
806
                               self parseCommitsResult: commitsJson ]) flattened.
1✔
807

1✔
808
        allCommits:= aProject repository commits
1✔
809
                addAll: allCommits
1✔
810
                unless: self blockOnIdEquality.
1✔
811

1✔
812
        ^ self glhModel addAll: allCommits unless: self blockOnIdEquality
1✔
813
]
1✔
814

1✔
815
{ #category : #'import - commits' }
1✔
816
GitlabModelImporter >> importCommitsOfTag: aGLHTag [
1✔
817

1✔
818
        | taggedCommit tags commits date |
1✔
819
        self
1✔
820
                deprecated: 'Use importCommitsFromTag:toTag: instead of current one'
1✔
821
                on: '21 July 2025'
1✔
822
                in:
1✔
823
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
824
        
1✔
825
        
1✔
826
        tags := self importTagsForProject: aGLHTag repository project.
1✔
827

1✔
828

1✔
829
        taggedCommit := aGLHTag commit ifNil: [
1✔
830
                                self
1✔
831
                                        importCommit: aGLHTag target
1✔
832
                                        ofProject: aGLHTag repository project ].
1✔
833

1✔
834
        date := (tags isEmptyOrNil and: [ tags size < 2 ])
1✔
835
                        ifTrue: [ aGLHTag created_at ]
1✔
836
                        ifFalse: [ tags second commit committed_date ].
1✔
837

1✔
838
        commits := self
1✔
839
                           importParentCommitsOfCommit: taggedCommit
1✔
840
                           since: tags third created_at.
1✔
841
        commits add: taggedCommit.
1✔
842
        self chainsCommitsFrom: commits.
1✔
843

1✔
844
        ^ commits
1✔
845
]
1✔
846

1✔
847
{ #category : #'import - projects' }
1✔
848
GitlabModelImporter >> importContributedProjectsOfUser: aGLHUser [
1✔
849

1✔
850
        | remaningProjects params results projects projectsIds |
1✔
851
        params := {
1✔
852
                          (#order_by -> 'last_activity_at').
1✔
853
                          (#simple -> 'true') } asDictionary.
1✔
854
        results := self repoApi projects
1✔
855
                           contributedProjectsOfUser: aGLHUser id
1✔
856
                           withParams: params.
1✔
857

1✔
858
        projectsIds := (results collect: [ :projectsJson |
1✔
859
                             (NeoJSONReader fromString: projectsJson) collect: [:projectJson | projectJson at: #id ] ]) flattened.
1✔
860
        
1✔
861
        projects := self importProjects: projectsIds.
1✔
862
        remaningProjects := self importProjects:
1✔
863
                                    ((projects collect: #id) difference:
1✔
864
                                             ((self userCatalogue atId: aGLHUser id) at:
1✔
865
                                                      #contributedProjects)).
1✔
866

1✔
867

1✔
868
        aGLHUser contributedProjects
1✔
869
                addAll: projects , remaningProjects
1✔
870
                unless: self blockOnIdEquality.
1✔
871

1✔
872
        self userCatalogue
1✔
873
                addUser: aGLHUser
1✔
874
                withProjects: (aGLHUser contributedProjects collect: #id).
1✔
875

1✔
876
        ^ projects
1✔
877
]
1✔
878

1✔
879
{ #category : #'import - commits' }
1✔
880
GitlabModelImporter >> importCreatorOfCommit: aCommit [
1✔
881

1✔
882
        aCommit commitCreator ifNil: [
1✔
883
                aCommit commitCreator:
1✔
884
                        (self importUserByUsername: aCommit author_name) ].
1✔
885
        self userCatalogue
1✔
886
                addUser: aCommit commitCreator
1✔
887
                withProject: aCommit repository project id.
1✔
888
        ^ aCommit commitCreator
1✔
889
]
1✔
890

1✔
891
{ #category : #'import - commits' }
1✔
892
GitlabModelImporter >> importDiffOfCommit: aCommit [
1✔
893

1✔
894
        | result diffsResult |
1✔
895
        aCommit diffs ifNotEmpty: [
1✔
896
                'Diff already importer: ' , aCommit short_id printString recordInfo.
1✔
897
                ^ aCommit diffs ].
1✔
898
        ('Import diff of commit: ' , aCommit short_id printString) recordInfo.
1✔
899

1✔
900
        result := self repoApi commits
1✔
901
                          diffOf: aCommit id
1✔
902
                          inProject: aCommit repository project id
1✔
903
                          uniDiff: true.
1✔
904

1✔
905
        (self isServerError: result) ifTrue: [ ^ {  } ].
1✔
906
        diffsResult := self newParseDiffResult: result.
1✔
907

1✔
908
        aCommit diffs addAll: diffsResult unless: self blockForDiffEquality.
1✔
909
        
1✔
910
        "changes are added into the model during the import"
1✔
911
        aCommit diffs do: [ :diff | self importDiffRangesForDiff: diff ].
1✔
912

1✔
913
        ^ aCommit diffs
1✔
914
]
1✔
915

1✔
916
{ #category : #'import - merge request' }
1✔
917
GitlabModelImporter >> importDiffOfMergeRequest: aMergeRequest [
1✔
918

1✔
919
        | result diffsResult |
1✔
920
        aMergeRequest diffs ifNotEmpty: [
1✔
921
                'Diff of already importer: '
1✔
922
                , aMergeRequest iid printString recordInfo.
1✔
923
                ^ aMergeRequest diffs ].
1✔
924
        ('Import diff commits of MR ' , aMergeRequest iid printString)
1✔
925
                recordInfo.
1✔
926
        result := self repoApi mergeRequests
1✔
927
                          diffsOf: aMergeRequest iid
1✔
928
                          inProject: aMergeRequest project_id.
1✔
929
        diffsResult := result flatCollect: [ :aResult |
1✔
930
                               self newParseDiffResult: aResult ].
1✔
931

1✔
932

1✔
933
        aMergeRequest diffs
1✔
934
                addAll: diffsResult
1✔
935
                unless: self blockForDiffEquality.
1✔
936
        self glhModel
1✔
937
                addAll: aMergeRequest diffs
1✔
938
                unless: self blockForDiffEquality.
1✔
939

1✔
940
        aMergeRequest diffs do: [ :diff | self importDiffRangesForDiff: diff ].
1✔
941

1✔
942
        ^ aMergeRequest diffs
1✔
943
]
1✔
944

1✔
945
{ #category : #'import - repositories' }
1✔
946
GitlabModelImporter >> importDirectoryFiles: aDirectoryFile OfBranch: aBranch [
1✔
947

1✔
948
        | result files apiFiles params |
1✔
949
        params := { 
1✔
950
                #ref -> aBranch name.
1✔
951
                #path -> (aDirectoryFile path , '/')
1✔
952
        } asDictionary.
1✔
953
        result := self repoApi repositories repositoryTreeOfProject: aBranch repository project id withParams: params.
1✔
954
                         " treeOfRepository: aBranch repository project id
1✔
955
                          ofBranch: aBranch name
1✔
956
                          andPath: aDirectoryFile path , '/'."
1✔
957
        apiFiles := (result collect: [ :treeJson | self parseFileTreeResult: treeJson ]) flattened.
1✔
958
        files := apiFiles collect: [ :apiFile |
1✔
959
                         self convertApiFileAsFile: apiFile ].
1✔
960
        
1✔
961
        files do: [ :file |
1✔
962
                self glhModel add: file.
1✔
963
                aDirectoryFile addFile: file ].
1✔
964
        
1✔
965
        files
1✔
966
                select: [ :file | file isKindOf: GLHFileDirectory ]
1✔
967
                thenCollect: [ :file |
1✔
968
                self importDirectoryFiles: file OfBranch: aBranch ]
1✔
969
]
1✔
970

1✔
971
{ #category : #'import - repositories' }
1✔
972
GitlabModelImporter >> importFilesOfBranch: aBranch [
1✔
973

1✔
974
        | result files apiFiles params |
1✔
975
        params := { 
1✔
976
                #ref -> aBranch name.
1✔
977
        } asDictionary.
1✔
978
        
1✔
979
        result := self repoApi repositories repositoryTreeOfProject: aBranch repository project id withParams: params.
1✔
980
        
1✔
981
                          "treeOfRepository: aBranch repository project id
1✔
982
                          ofBranch: aBranch name
1✔
983
                          andPath: nil."
1✔
984
        apiFiles := (result collect: [ :filesJson | self parseFileTreeResult: filesJson  ]) flattened.
1✔
985
        files := apiFiles collect: [ :apiFile | 
1✔
986
                         self convertApiFileAsFile: apiFile ].
1✔
987
        files do: [ :file | 
1✔
988
                self glhModel add: file.
1✔
989
                aBranch addFile: file ].
1✔
990
        files
1✔
991
                select: [ :file | file isKindOf: GLHFileDirectory ]
1✔
992
                thenCollect: [ :file | 
1✔
993
                self importDirectoryFiles: file OfBranch: aBranch ]
1✔
994
]
1✔
995

1✔
996
{ #category : #'import - groups' }
1✔
997
GitlabModelImporter >> importGroup: aGroupID [
1✔
998

1✔
999
        | result groupResult |
1✔
1000
        ('Import group: ' , aGroupID printString) recordInfo.
1✔
1001

1✔
1002
        result := self repoApi groups get: aGroupID.
1✔
1003
        
1✔
1004
        "group: aGroupID."
1✔
1005
        groupResult := self parseGroupResult: result.
1✔
1006
        groupResult := self addGroupResultToModel: groupResult.
1✔
1007

1✔
1008
        groupResult projects do: [ :project |
1✔
1009
                self completeImportedProject: project ].
1✔
1010

1✔
1011
        (self subGroupsOf: aGroupID) do: [ :subGroup |
1✔
1012
                
1✔
1013
                groupResult subGroups
1✔
1014
                        add: (self importGroup: subGroup id)
1✔
1015
                        unless: self blockOnIdEquality ].
1✔
1016
        ^ groupResult
1✔
1017
]
1✔
1018

1✔
1019
{ #category : #'import - jobs' }
1✔
1020
GitlabModelImporter >> importJobsOf: aPipeline [
1✔
1021

1✔
1022
        | jobs results |
1✔
1023
        results := self repoApi jobs
1✔
1024
                           getAllForPipeline: aPipeline id
1✔
1025
                           inProject: aPipeline project id.
1✔
1026
        "jobsOfProject: aPipeline project id
1✔
1027
                          ofPipelines: aPipeline id."
1✔
1028
        jobs := (results collect: [ :jobsJson |
1✔
1029
                         self parseJobsResult: jobsJson ofProject: aPipeline project ])
1✔
1030
                        flattened.
1✔
1031
        jobs do: [ :job | aPipeline addJob: job ].
1✔
1032
        self glhModel addAll: jobs.
1✔
1033

1✔
1034
        ^ jobs
1✔
1035
]
1✔
1036

1✔
1037
{ #category : #'import - commits' }
1✔
1038
GitlabModelImporter >> importLastestCommitsOfProject: aGLHProject [
1✔
1039
        "limited to the last 50 commits"
1✔
1040

1✔
1041
        | results parsedResults params |
1✔
1042
        params := { 
1✔
1043
                #with_stats -> 'true'.
1✔
1044
                #all -> true
1✔
1045
         } asDictionary.
1✔
1046
        results := self repoApi commits getByPage: 1 perPage: 50 inProject: aGLHProject id withParams: params.
1✔
1047

1✔
1048
        parsedResults := self parseCommitsResult: results.
1✔
1049
        parsedResults := self glhModel
1✔
1050
                                 addAll: parsedResults
1✔
1051
                                 unless: self blockOnIdEquality.
1✔
1052

1✔
1053
        aGLHProject repository commits
1✔
1054
                addAll: parsedResults
1✔
1055
                unless: self blockOnIdEquality.
1✔
1056

1✔
1057
        self withCommitDiffs ifTrue: [
1✔
1058
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
1✔
1059

1✔
1060
        ^ parsedResults
1✔
1061
]
1✔
1062

1✔
1063
{ #category : #'import - merge request' }
1✔
1064
GitlabModelImporter >> importLatestMergeRequestsOfProject: aGLHProject [ 
1✔
1065
        
1✔
1066
        |results parsedResults|
1✔
1067
        results := self repoApi mergeRequests getByPage: 1 perPage: 20  inProject: aGLHProject id. 
1✔
1068
        parsedResults := self parseMergeRequestsResult: results. 
1✔
1069
        
1✔
1070
        parsedResults := glhModel addAll: parsedResults unless: self blockOnIdEquality.
1✔
1071
        parsedResults := aGLHProject mergeRequests addAll: parsedResults unless: self blockOnIdEquality.
1✔
1072
        ^ parsedResults.
1✔
1073
]
1✔
1074

1✔
1075
{ #category : #'import - pipelines' }
1✔
1076
GitlabModelImporter >> importLatestPipelinesOfProject: aGLHProject [ 
1✔
1077
        (self pipelinesOf: aGLHProject id withLimit:20) do: [ :pipeline |
1✔
1078
                |pip|
1✔
1079
                pip := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1080
                pip := aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
1081
                self completeImportedPipeline: pip. 
1✔
1082
                ].
1✔
1083
        
1✔
1084
        ^ aGLHProject pipelines 
1✔
1085
]
1✔
1086

1✔
1087
{ #category : #'import - release' }
1✔
1088
GitlabModelImporter >> importLatestReleaseOfProject: aGLHProject [ 
1✔
1089
        
1✔
1090
        |result foundRelease|
1✔
1091
        result := repoApi releases getLatestOfProject: aGLHProject id.
1✔
1092
        foundRelease := self parseReleaseResult: result. 
1✔
1093

1✔
1094
        foundRelease := glhModel add: foundRelease unless: self blockOnNameEquality.
1✔
1095
        foundRelease := aGLHProject releases add: foundRelease unless: self blockOnNameEquality.
1✔
1096

1✔
1097
        foundRelease author: (self importUser: foundRelease author id). 
1✔
1098
        
1✔
1099
        ^ foundRelease.
1✔
1100
]
1✔
1101

1✔
1102
{ #category : #'import - merge request' }
1✔
1103
GitlabModelImporter >> importMergeRequestCommits: aGLPHEMergeRequest [
1✔
1104

1✔
1105
        | commits result |
1✔
1106
        aGLPHEMergeRequest commits ifNotNil: [ ^ aGLPHEMergeRequest commits ].
1✔
1107
        
1✔
1108
        result := self repoApi mergeRequests commitsOf: aGLPHEMergeRequest iid inProject: aGLPHEMergeRequest project id.
1✔
1109
        
1✔
1110
        commits := (result collect: [ :commitsJson | self parseCommitsResult: commitsJson ]) flattened.
1✔
1111
        commits := commits collect: [ :commit | self importCommit: commit id ofProject: aGLPHEMergeRequest project ].
1✔
1112
        aGLPHEMergeRequest commits: commits.
1✔
1113

1✔
1114

1✔
1115
        ^ commits
1✔
1116
]
1✔
1117

1✔
1118
{ #category : #'import - merge request' }
1✔
1119
GitlabModelImporter >> importMergeRequestMergeCommits: aGLPHEMergeRequest [
1✔
1120

1✔
1121
        | foundCommits |
1✔
1122
        foundCommits := OrderedCollection new.
1✔
1123

1✔
1124
        ('Import commit sha of MR:  ' , aGLPHEMergeRequest iid printString)
1✔
1125
                recordInfo.
1✔
1126
        "the founds commits are added to the model during their respective import"
1✔
1127
        aGLPHEMergeRequest mergeRequestCommit: ((self
1✔
1128
                          importCommitOfProject: aGLPHEMergeRequest project
1✔
1129
                          withId: aGLPHEMergeRequest sha) ifNotNil: [ :commit |
1✔
1130
                         foundCommits add: commit ]).
1✔
1131

1✔
1132
        ('Import commit merge_commit_sha of MR:  '
1✔
1133
         , aGLPHEMergeRequest iid printString) recordInfo.
1✔
1134
        aGLPHEMergeRequest mergedCommit: ((self
1✔
1135
                          importCommitOfProject: aGLPHEMergeRequest project
1✔
1136
                          withId: aGLPHEMergeRequest merge_commit_sha) ifNotNil: [ :commit |
1✔
1137
                         foundCommits add: commit ]).
1✔
1138

1✔
1139
        ('Import commit squash_commit_sha of MR:  '
1✔
1140
         , aGLPHEMergeRequest iid printString) recordInfo.
1✔
1141
        aGLPHEMergeRequest squashCommit: ((self
1✔
1142
                          importCommitOfProject: aGLPHEMergeRequest project
1✔
1143
                          withId: aGLPHEMergeRequest squash_commit_sha) ifNotNil: [ :commit |
1✔
1144
                         foundCommits add: commit ]).
1✔
1145

1✔
1146

1✔
1147
        self chainsCommitsFrom: foundCommits.
1✔
1148
        ^ foundCommits
1✔
1149
]
1✔
1150

1✔
1151
{ #category : #'import - pipelines' }
1✔
1152
GitlabModelImporter >> importMergeRequestPipelines: aGLHMergeRequest [ 
1✔
1153
        "default limit to one page with last 100 pipelines"
1✔
1154
        
1✔
1155
        |results parseResults|
1✔
1156
        
1✔
1157
        results := self repoApi pipelines getByPage: 1 perPage: 100 inProject: aGLHMergeRequest project id forMergerRequestIid: aGLHMergeRequest iid. 
1✔
1158
        
1✔
1159
        parseResults := self parsePipelinesResult: results.
1✔
1160
        
1✔
1161
        parseResults := glhModel addAll: parseResults unless: self blockOnIdEquality.
1✔
1162
        parseResults := aGLHMergeRequest pipelines addAll: parseResults unless: self blockOnIdEquality.
1✔
1163
        ^ parseResults collect: [ :pip | self completeImportedPipeline: pip ]  .
1✔
1164
        
1✔
1165
]
1✔
1166

1✔
1167
{ #category : #'import - merge request' }
1✔
1168
GitlabModelImporter >> importMergeRequests: aGLHProject [
1✔
1169

1✔
1170
        | results parsedResults mrs |
1✔
1171
        ('Import merge request of Project: ' , aGLHProject id printString)
1✔
1172
                recordInfo.
1✔
1173

1✔
1174
        results := self repoApi mergeRequests getAllOfProject: aGLHProject id.
1✔
1175
        parsedResults := (results collect: [ :projectsJson | self parseMergeRequestsResult: projectsJson ]) flattened. 
1✔
1176

1✔
1177
        aGLHProject mergeRequests
1✔
1178
                addAll: parsedResults
1✔
1179
                unless: self blockOnIdEquality.
1✔
1180

1✔
1181
        mrs := self glhModel
1✔
1182
                       addAll: aGLHProject mergeRequests
1✔
1183
                       unless: self blockOnIdEquality.
1✔
1184

1✔
1185

1✔
1186
        "gets it related commits"
1✔
1187
        aGLHProject mergeRequests do: [ :mr |
1✔
1188
                self importMergeRequestMergeCommits: mr ].
1✔
1189

1✔
1190

1✔
1191
        self withCommitDiffs ifTrue: [
1✔
1192
                aGLHProject mergeRequests do: [ :mr |
1✔
1193
                        self importDiffOfMergeRequest: mr ] ].
1✔
1194

1✔
1195
        ^ mrs
1✔
1196
]
1✔
1197

1✔
1198
{ #category : #'import - merge request' }
1✔
1199
GitlabModelImporter >> importMergeRequests: aGLHProject since: fromDate until: toDate [
1✔
1200

1✔
1201
        | params result mergeRequests |
1✔
1202
        ('import MR of Project ' , aGLHProject name) recordInfo.
1✔
1203
        params := {
1✔
1204
                          (#created_after
1✔
1205
                           ->
1✔
1206
                           (fromDate
1✔
1207
                                    ifNotNil: [ fromDate asDateAndTime asString ]
1✔
1208
                                    ifNil: [ '' ])).
1✔
1209
                          (#created_before
1✔
1210
                           ->
1✔
1211
                           (toDate
1✔
1212
                                    ifNotNil: [ toDate asDateAndTime asString ]
1✔
1213
                                    ifNil: [ '' ])).
1✔
1214
                          (#scope -> 'all') } asDictionary.
1✔
1215

1✔
1216
        result := self repoApi mergeRequests
1✔
1217
                          getAllOfProject: aGLHProject id
1✔
1218
                          withParams: params.
1✔
1219
        mergeRequests := (result collect: [ :mergeRequestsJson |
1✔
1220
                                  self parseMergeRequestsResult: mergeRequestsJson ])
1✔
1221
                                 flattened.
1✔
1222

1✔
1223
        aGLHProject mergeRequests
1✔
1224
                addAll: mergeRequests
1✔
1225
                unless: self blockOnIdEquality.
1✔
1226

1✔
1227
        "gets it related commits"
1✔
1228
        aGLHProject mergeRequests do: [ :mr |
1✔
1229
                self importMergeRequestMergeCommits: mr ].
1✔
1230

1✔
1231
        self withCommitDiffs ifTrue: [
1✔
1232
                aGLHProject mergeRequests do: [ :mr |
1✔
1233
                        self importDiffOfMergeRequest: mr ] ].
1✔
1234

1✔
1235
        self glhModel
1✔
1236
                addAll: mergeRequests
1✔
1237
                unless: (self blockEqualityOn: #iid).
1✔
1238

1✔
1239
        ^ mergeRequests
1✔
1240
]
1✔
1241

1✔
1242
{ #category : #'import - merge request' }
1✔
1243
GitlabModelImporter >> importMergeResquestApprovals: aGLPHEMergeRequest [
1✔
1244

1✔
1245
        | results parsedResult |
1✔
1246
        (String streamContents: [ :str |
1✔
1247
                 str << 'Check approvals of '.
1✔
1248
                 aGLPHEMergeRequest printOn: str ]) recordInfo.
1✔
1249
        results := self repoApi mergeRequests approvalsOf: aGLPHEMergeRequest iid inProject: aGLPHEMergeRequest project id.
1✔
1250

1✔
1251
        parsedResult := generalReader
1✔
1252
                                on: results readStream;
1✔
1253
                                next.
1✔
1254

1✔
1255
        (parsedResult at: #approved_by) do: [ :approvedUser |
1✔
1256
                aGLPHEMergeRequest addApproved_by:
1✔
1257
                        (self importUser: ((approvedUser at: #user) at: #id)) ].
1✔
1258
        aGLPHEMergeRequest approved: (parsedResult at: #approved).
1✔
1259
        ^ aGLPHEMergeRequest
1✔
1260
]
1✔
1261

1✔
1262
{ #category : #'import - merge request' }
1✔
1263
GitlabModelImporter >> importMergeResquestAuthor: aGLPHEMergeRequest [
1✔
1264

1✔
1265
        | authorID |
1✔
1266
        aGLPHEMergeRequest author ifNotNil: [ ^ aGLPHEMergeRequest author ].
1✔
1267
        authorID := aGLPHEMergeRequest cacheAt: #authorID ifAbsent: [
1✔
1268
                            | result |
1✔
1269
                            result := self repoApi mergeRequests
1✔
1270
                                              get: aGLPHEMergeRequest iid
1✔
1271
                                              inProject: aGLPHEMergeRequest project_id.
1✔
1272

1✔
1273
                            (generalReader
1✔
1274
                                     on: result readStream;
1✔
1275
                                     next) at: #author at: #id ].
1✔
1276
        ^aGLPHEMergeRequest author: (self importUser: authorID)
1✔
1277
]
1✔
1278

1✔
1279
{ #category : #'import - merge request' }
1✔
1280
GitlabModelImporter >> importMergeResquestMerger: aGLPHEMergeRequest [
1✔
1281

1✔
1282
        | authorID |
1✔
1283
        aGLPHEMergeRequest merge_user ifNotNil: [
1✔
1284
                ^ aGLPHEMergeRequest merge_user ].
1✔
1285
        authorID := aGLPHEMergeRequest cacheAt: #mergeUserID ifAbsent: [
1✔
1286
                            | result |
1✔
1287
                            result := self repoApi mergeRequests
1✔
1288
                                              get: aGLPHEMergeRequest iid
1✔
1289
                                              inProject: aGLPHEMergeRequest project_id.
1✔
1290
                            (generalReader
1✔
1291
                                     on: result readStream;
1✔
1292
                                     next)
1✔
1293
                                    at: #merge_user
1✔
1294
                                    ifPresent: [ :mergeUser |
1✔
1295
                                    mergeUser ifNotNil: [ :mruser | mruser at: #id ] ] ].
1✔
1296
        ^aGLPHEMergeRequest merge_user: (self importUser: authorID)
1✔
1297
]
1✔
1298

1✔
1299
{ #category : #'import - notes' }
1✔
1300
GitlabModelImporter >> importNotesfromMergeRequest: mergeRequest [
1✔
1301
        | results notes |
1✔
1302
        
1✔
1303
        results := self repoApi notes allInMergeRequest: mergeRequest iid ofProject: mergeRequest project id.
1✔
1304
        
1✔
1305
        notes := results collect: [ :note | 
1✔
1306
                self parseNoteJson: note ].
1✔
1307
        "notes := self parseNoteJson: results."
1✔
1308
        notes do: [ :tabNotes | tabNotes do: [ :note |
1✔
1309
                        note author: (self importUser: (note author at: #id)).
1✔
1310
                        note name: note id asString]. ].
1✔
1311
        notes := notes flattened.
1✔
1312
        notes := self glhModel addAll: notes unless: self blockOnIdEquality. 
1✔
1313
        notes := mergeRequest note addAll: notes unless: self blockOnIdEquality. 
1✔
1314
        ^notes
1✔
1315
        
1✔
1316
]
1✔
1317

1✔
1318
{ #category : #'import - commits' }
1✔
1319
GitlabModelImporter >> importParentCommitsOfCommit: aGLHCommit since: aDate [
1✔
1320

1✔
1321
        | parentsIds commits |
1✔
1322
        commits := Set new.
1✔
1323
        aGLHCommit created_at asDateAndTime < aDate asDateAndTime ifTrue: [
1✔
1324
                 
1✔
1325
                ^ commits
1✔
1326
                          add: aGLHCommit;
1✔
1327
                          yourself ].
1✔
1328

1✔
1329
        parentsIds := aGLHCommit parent_ids.
1✔
1330

1✔
1331
        commits addAll: (parentsIds collect: [ :id |
1✔
1332
                         self
1✔
1333
                                 importCommit: id ofProject: aGLHCommit repository project  ]).
1✔
1334

1✔
1335
        
1✔
1336
        commits addAll: (commits collect: [ :parentCommit |
1✔
1337
                   self importParentCommitsOfCommit: parentCommit since: aDate ]).
1✔
1338

1✔
1339
        ^ commits flattened asSet. 
1✔
1340
]
1✔
1341

1✔
1342
{ #category : #'import - pipelines' }
1✔
1343
GitlabModelImporter >> importPipeline: pipelineId OfProject: aGLHProject [
1✔
1344

1✔
1345
        
1✔
1346
        | result pipeline|
1✔
1347
        
1✔
1348
        aGLHProject pipelines detect: [ :pip | pip id = pipelineId ] ifOne: [ :pip| ^pip ].
1✔
1349
        
1✔
1350
        ('Search pipelines of: ' , aGLHProject id printString) recordInfo.
1✔
1351
        result := self repoApi pipelines get: pipelineId inProject: aGLHProject id.
1✔
1352
        result isString ifTrue: [ ^ self parsePipelineResult: result ].
1✔
1353

1✔
1354
        pipeline :=  self parsePipelineResult: result.
1✔
1355

1✔
1356
        pipeline := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1357
        pipeline := aGLHProject pipelines add: pipeline unless: self blockOnIdEquality.
1✔
1358
        
1✔
1359
        ^ self completeImportedPipeline: pipeline. 
1✔
1360
]
1✔
1361

1✔
1362
{ #category : #'import - pipelines' }
1✔
1363
GitlabModelImporter >> importPipelinesOfProject: aGLHProject after: after andBefore: before [
1✔
1364
        ^ (self pipelinesOf: aGLHProject id after: after andBefore: before) collect: [ :pipeline |
1✔
1365
                |pip|
1✔
1366
                pip := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1367
                pip := aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
1368
                
1✔
1369
                ].
1✔
1370
        
1✔
1371
]
1✔
1372

1✔
1373
{ #category : #'import - pipelines' }
1✔
1374
GitlabModelImporter >> importPipelinesOfProject: aGLHProject after: after andBefore: before onBranch: aBranch [
1✔
1375
        | result parsedResults|
1✔
1376
        ('Search pipelines of: ' , aGLHProject id printString) recordInfo.
1✔
1377
        
1✔
1378
        result := self repoApi pipelines getAllInProject: aGLHProject id 
1✔
1379
                                                                                                withParams: {        #updated_before -> before.
1✔
1380
                                                                                                                                        #updated_after -> after.
1✔
1381
                                                                                                                                        #ref -> aBranch name} asDictionary .
1✔
1382
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
1✔
1383

1✔
1384
        parsedResults := (result collect: [ :pipelinesJson |
1✔
1385
                           self parsePipelinesResult: pipelinesJson ]) flattened.
1✔
1386
        
1✔
1387

1✔
1388
        ^ parsedResults collect: [ :pipeline |
1✔
1389
                |pip|
1✔
1390
                pip := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1391
                aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
1392
                ].
1✔
1393
        
1✔
1394
]
1✔
1395

1✔
1396
{ #category : #'import - projects' }
1✔
1397
GitlabModelImporter >> importProject: aProjectID [
1✔
1398

1✔
1399
        | result projectResult |
1✔
1400
        ('Import project with id:  ' , aProjectID printString) recordInfo.
1✔
1401

1✔
1402
        (glhModel allWithType: GLHProject)
1✔
1403
                detect: [ :project | project id = aProjectID ]
1✔
1404
                ifFound: [ :project | ^ project ].
1✔
1405

1✔
1406
        result := self repoApi projects get: aProjectID.
1✔
1407
        projectResult := self parseProjectResult: result.
1✔
1408

1✔
1409
        ^ self completeImportedProject: projectResult
1✔
1410
]
1✔
1411

1✔
1412
{ #category : #'import - projects' }
1✔
1413
GitlabModelImporter >> importProjects [
1✔
1414

1✔
1415
        | result projects |
1✔
1416
        ('import all Projects') recordInfo.
1✔
1417

1✔
1418

1✔
1419
        result := self repoApi projects all.
1✔
1420
        projects := (result collect: [ :projectsJson | self parseArrayOfProject: projectsJson ]) flattened.
1✔
1421
        
1✔
1422
        self glhModel addAll: projects unless: self blockOnIdEquality.
1✔
1423

1✔
1424
        ^ projects
1✔
1425
]
1✔
1426

1✔
1427
{ #category : #'import - projects' }
1✔
1428
GitlabModelImporter >> importProjectsSince: since [
1✔
1429
        "heavy import of all projects"
1✔
1430

1✔
1431
        "copy import from commits"
1✔
1432

1✔
1433
        | newlyFoundProjects page foundProject amount |
1✔
1434
        ('import all Projects since: ' , since printString) recordInfo.
1✔
1435

1✔
1436
        "number of projects per page"
1✔
1437
        amount := 100.
1✔
1438
        page := 0.
1✔
1439
        foundProject := OrderedCollection new.
1✔
1440
        newlyFoundProjects := { true }.
1✔
1441
        [ newlyFoundProjects isNotEmpty ] whileTrue: [
1✔
1442
                | results |
1✔
1443
                page := page + 1.
1✔
1444
                ('import projects page #' , page printString) recordInfo.
1✔
1445

1✔
1446
                results := self repoApi projects allWithParams: {#since -> since} asDictionary .
1✔
1447

1✔
1448
                newlyFoundProjects := self glhModel
1✔
1449
                                              addAll: (self parseArrayOfProject: results)
1✔
1450
                                              unless: self blockOnIdEquality.
1✔
1451
                foundProject addAll: newlyFoundProjects ].
1✔
1452
]
1✔
1453

1✔
1454
{ #category : #'import - repositories' }
1✔
1455
GitlabModelImporter >> importRepository: aGLHRepository [
1✔
1456

1✔
1457
        | resultBranches branches |
1✔
1458
        [
1✔
1459
        ('import the repository of project ' , aGLHRepository project name)
1✔
1460
                recordInfo.
1✔
1461

1✔
1462
        resultBranches := self repoApi branches getAllFromProject:
1✔
1463
                                  aGLHRepository project id.
1✔
1464

1✔
1465
        branches := (resultBranches collect: [ :branchesJson |
1✔
1466
                             self parseBranchesResult: branchesJson ]) flattened.
1✔
1467

1✔
1468
        'import the branches of project ' recordInfo.
1✔
1469

1✔
1470
        branches := aGLHRepository branches
1✔
1471
                            addAll: branches
1✔
1472
                            unless: self blockOnNameEquality.
1✔
1473
        branches := self glhModel
1✔
1474
                            addAll: branches
1✔
1475
                            unless: self blockOnNameEquality.
1✔
1476

1✔
1477

1✔
1478
        self withFiles ifTrue: [
1✔
1479
                branches do: [ :branch | self importFilesOfBranch: branch ] ] ]
1✔
1480
                on: NeoJSONParseError
1✔
1481
                do: [
1✔
1482
                self inform: aGLHRepository project name , ' has no repository' ].
1✔
1483
        
1✔
1484
        withInitialCommits ifTrue: [
1✔
1485
                aGLHRepository branches do: [ :branch |
1✔
1486
                        self importCommitsOfBranch: branch ] ]
1✔
1487
]
1✔
1488

1✔
1489
{ #category : #'import - commits' }
1✔
1490
GitlabModelImporter >> importSZZFromCommit: aCommit [
1✔
1491

1✔
1492
        | result diffRanges diffs szzCommits|
1✔
1493
        szzCommits := Set new. 
1✔
1494
        diffs := (self importDiffOfCommit: aCommit).
1✔
1495
        diffRanges := diffs flatCollect: #diffRanges.
1✔
1496
        diffRanges do: [ :range |
1✔
1497
                |blames|
1✔
1498
                
1✔
1499
                        blames := NeoJSONReader fromString:( self repoApi repositories getBlameOf: range diff new_path  inRef: aCommit id start: range start end:range end ofProject: (aCommit repository project id)).
1✔
1500
                        blames collect: [ :blame |
1✔
1501
                        blame isDictionary ifTrue: [ szzCommits add:         (self importCommit:(blame at: #commit at: #id) ofProject: aCommit repository project). ]
1✔
1502
                         
1✔
1503
                                 ]
1✔
1504
                        
1✔
1505
                 ].
1✔
1506
        ^ szzCommits .
1✔
1507

1✔
1508
]
1✔
1509

1✔
1510
{ #category : #'import - tag' }
1✔
1511
GitlabModelImporter >> importTagsForProject: aProject [ 
1✔
1512
        |results tags |
1✔
1513
        results  := repoApi tags getAllOfProject: aProject id.
1✔
1514
        "get a group of tags"
1✔
1515
        tags := results flatCollect: [ :result |
1✔
1516
                        self parseTagsResult: result. 
1✔
1517
                 ].
1✔
1518

1✔
1519
        "add the tags inside the model"
1✔
1520
        tags := glhModel addAll: tags unless: self blockOnNameEquality.
1✔
1521
        tags := aProject repository tags addAll: tags unless: self blockOnNameEquality.
1✔
1522
        
1✔
1523
        "update tag's commit if already imported"
1✔
1524
        tags do: [ :tag |
1✔
1525
                |commit|
1✔
1526
                commit := glhModel add: tag commit unless: self blockOnIdEquality.
1✔
1527
                commit := aProject repository commits add: tag commit unless: self blockOnIdEquality.
1✔
1528
                tag commit: commit. 
1✔
1529
                 ].
1✔
1530
        
1✔
1531
        "update tag's release if already imported"
1✔
1532
        tags do: [ :tag |
1✔
1533
                |release|
1✔
1534
                release ifNotNil: [ 
1✔
1535
                        release := glhModel add: tag release unless: (self blockEqualityOn: #tag_name).
1✔
1536
                        release := aProject releases add: tag release unless: (self blockEqualityOn: #tag_name).
1✔
1537
                        tag release: release. 
1✔
1538
                         ].
1✔
1539
                 ].
1✔
1540
        
1✔
1541
        ^ tags
1✔
1542
]
1✔
1543

1✔
1544
{ #category : #'import - users' }
1✔
1545
GitlabModelImporter >> importUser: aUserID [
1✔
1546

1✔
1547
        | result userResult |
1✔
1548
        (self glhModel allWithType: GLHUser)
1✔
1549
                detect: [ :user | user id = aUserID ]
1✔
1550
                ifFound: [ :user | ^ user ].
1✔
1551
        ('Import user: ' , aUserID printString) recordInfo.
1✔
1552
        
1✔
1553
        result := self repoApi users get: aUserID.
1✔
1554
        userResult := self parseUserResult: result.
1✔
1555
        
1✔
1556
        userResult := self glhModel add: userResult unless: self blockOnIdEquality.
1✔
1557
        userCatalogue addUser: userResult.
1✔
1558
        ^ userResult 
1✔
1559
]
1✔
1560

1✔
1561
{ #category : #'import - users' }
1✔
1562
GitlabModelImporter >> importUserByUsername: anUsername [
1✔
1563

1✔
1564
        | dicUsername resultUser |
1✔
1565
        dicUsername := ((self glhModel allWithType: GLHUser) collect: [ :user |
1✔
1566
                                user username -> user ]) asSet asDictionary.
1✔
1567

1✔
1568
        dicUsername addAll: self userCatalogue collectUsernames.
1✔
1569

1✔
1570

1✔
1571
        resultUser := dicUsername
1✔
1572
                              at: anUsername
1✔
1573
                              ifAbsent: [ "thus we have to import this new user"
1✔
1574
                                      | result userId searchResult params |
1✔
1575
                                      ('Import user with username: '
1✔
1576
                                       , anUsername printString) recordInfo.
1✔
1577
                                      params := { (#search -> anUsername) } asDictionary.
1✔
1578
                                      result := self repoApi users allWithParams: params.
1✔
1579
                                                        
1✔
1580
                                                         "when result is an error"
1✔
1581
                                                         (result isString) ifTrue: [ result := { result } ].
1✔
1582
                                                        
1✔
1583
                                      searchResult := result ifEmpty: [ result ] ifNotEmpty: [(result collect: [ :usersJson |
1✔
1584
                                                               NeoJSONReader fromString: usersJson ]) first].
1✔
1585
                                                         
1✔
1586
                                      (searchResult class = Dictionary and: [
1✔
1587
                                               (searchResult at: #message) includesSubstring:
1✔
1588
                                                       '403 Forbidden' ])
1✔
1589
                                              ifTrue: [ "if the result is an 403 error we fake a new user"
1✔
1590
                                                      self glhModel
1✔
1591
                                                              add: (GLHUser new
1✔
1592
                                                                               username: anUsername;
1✔
1593
                                                                               name: anUsername;
1✔
1594
                                                                               yourself)
1✔
1595
                                                              unless: [ :nu :ou | nu username = ou username ] ]
1✔
1596
                                              ifFalse: [
1✔
1597
                                                      searchResult
1✔
1598
                                                              ifEmpty: [ "results can be empty thus we force a new user with the info we have "
1✔
1599
                                                                      self glhModel
1✔
1600
                                                                              add: (GLHUser new
1✔
1601
                                                                                               username: anUsername;
1✔
1602
                                                                                               name: anUsername;
1✔
1603
                                                                                               yourself)
1✔
1604
                                                                              unless: [ :nu :ou | nu username = ou username ] ]
1✔
1605
                                                              ifNotEmpty: [ "because we may already have the researched user, we look by ID in the model"
1✔
1606
                                                                      userId := searchResult first at: #id.
1✔
1607
                                                                      (self glhModel allWithType: GLHUser)
1✔
1608
                                                                              detect: [ :user | user id = userId ]
1✔
1609
                                                                              ifNone: [ self importUser: userId ] ] ] ].
1✔
1610

1✔
1611
        self userCatalogue addUser: resultUser withName: anUsername.
1✔
1612

1✔
1613
        ^ resultUser
1✔
1614
]
1✔
1615

1✔
1616
{ #category : #initialization }
1✔
1617
GitlabModelImporter >> initReader [
1✔
1618

1✔
1619
        generalReader := NeoJSONReader new.
1✔
1620
        self configureReaderForCommit: generalReader.
1✔
1621
        self configureReaderForGroup: generalReader.
1✔
1622
        self configureReaderForDiffs: generalReader.
1✔
1623
        self configureReaderForMergeRequest: generalReader.
1✔
1624
        self configureReaderForPipeline: generalReader. 
1✔
1625
        self configureReaderForTags: generalReader. 
1✔
1626
        self configureReaderForReleases: generalReader. 
1✔
1627
        self configureReaderForUsers: generalReader. 
1✔
1628
]
1✔
1629

1✔
1630
{ #category : #initialization }
1✔
1631
GitlabModelImporter >> initialize [
1✔
1632

1✔
1633
        super initialize.
1✔
1634
        withCommitDiffs := true.
1✔
1635
        withInitialCommits := false.
1✔
1636
        withInitialMergeRequest := false.
1✔
1637

1✔
1638
        self withCommitsSince: 1 week.
1✔
1639

1✔
1640
        self initReader
1✔
1641
]
1✔
1642

1✔
1643
{ #category : #private }
1✔
1644
GitlabModelImporter >> isServerError: aString [
1✔
1645
        ^ aString = '{"message":"500 Internal Server Error"}'
1✔
1646
]
1✔
1647

1✔
1648
{ #category : #'import - projects' }
1✔
1649
GitlabModelImporter >> loadAllProjectsFromRepositorySoftware [
1✔
1650
        "heavy import that load all the active project inside the model. Only import the project entities"
1✔
1651
        |projects|
1✔
1652
        
1✔
1653
        projects := self repoApi projects. 
1✔
1654
]
1✔
1655

1✔
1656
{ #category : #'private - parsing' }
1✔
1657
GitlabModelImporter >> newParseCommitResult: result [
1✔
1658

1✔
1659
        generalReader  on: result readStream.
1✔
1660

1✔
1661
        ^ generalReader nextAs: GLHCommit
1✔
1662
]
1✔
1663

1✔
1664
{ #category : #'private - parsing' }
1✔
1665
GitlabModelImporter >> newParseDiffResult: result [
1✔
1666

1✔
1667
        generalReader on: result readStream.
1✔
1668
        ^ generalReader nextAs: #ArrayOfDiffs
1✔
1669
]
1✔
1670

1✔
1671
{ #category : #'private - parsing' }
1✔
1672
GitlabModelImporter >> parseArrayOfProject: arrayOfProjects [
1✔
1673

1✔
1674
        | reader |
1✔
1675
        reader := NeoJSONReader on: arrayOfProjects readStream.
1✔
1676
        reader
1✔
1677
                for: #ArrayOfProjects
1✔
1678
                customDo: [ :customMappting |
1✔
1679
                customMappting listOfElementSchema: GLHProject ].
1✔
1680
        reader for: GLHProject do: [ :mapping |
1✔
1681
                mapping mapInstVar: #name to: #name.
1✔
1682
                mapping mapInstVar: #description to: #description.
1✔
1683
                mapping mapInstVar: #id to: #id.
1✔
1684
                mapping mapInstVar: #archived to: #archived.
1✔
1685
                mapping mapInstVar: #web_url to: #html_url.
1✔
1686
                mapping mapInstVar: #topics to: #topics ].
1✔
1687
        ^ reader nextAs: #ArrayOfProjects
1✔
1688
]
1✔
1689

1✔
1690
{ #category : #'private - parsing' }
1✔
1691
GitlabModelImporter >> parseBranchesResult: result [
1✔
1692

1✔
1693
        | reader |
1✔
1694
        reader := NeoJSONReader on: result readStream.
1✔
1695
        reader mapInstVarsFor: GLHBranch.
1✔
1696
        reader
1✔
1697
                for: #ArrayOfBranch
1✔
1698
                customDo: [ :customMappting | 
1✔
1699
                customMappting listOfElementSchema: GLHBranch ].
1✔
1700
        ^ reader nextAs: #ArrayOfBranch
1✔
1701
]
1✔
1702

1✔
1703
{ #category : #'private - parsing' }
1✔
1704
GitlabModelImporter >> parseCommitResult: result [
1✔
1705

1✔
1706
        | reader |
1✔
1707
        reader := NeoJSONReader on: result readStream.
1✔
1708

1✔
1709
        reader for: GLHCommit do: [ :mapping |
1✔
1710
                mapping mapInstVars:
1✔
1711
                        #( id short_id title author_name author_email committer_name
1✔
1712
                           committer_email message web_url ).
1✔
1713
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
1714
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
1715
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
1716
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
1717
                mapping
1✔
1718
                        mapProperty: 'stats'
1✔
1719
                        getter: [ :el | "Not used" ]
1✔
1720
                        setter: [ :commit :value |
1✔
1721
                                commit deletions: (value at: #deletions).
1✔
1722
                                commit additions: (value at: #additions) ] ].
1✔
1723

1✔
1724
        reader for: DateAndTime customDo: [ :mapping |
1✔
1725
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
1726

1✔
1727
        reader
1✔
1728
                for: #ArrayOfIds
1✔
1729
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
1730

1✔
1731

1✔
1732
        ^ reader nextAs: GLHCommit
1✔
1733
]
1✔
1734

1✔
1735
{ #category : #'private - parsing' }
1✔
1736
GitlabModelImporter >> parseCommitsResult: result [
1✔
1737

1✔
1738
        | reader |
1✔
1739
        reader := NeoJSONReader on: result readStream.
1✔
1740

1✔
1741
          reader for: GLHCommit do: [ :mapping |
1✔
1742
                mapping mapInstVars:
1✔
1743
                        #( id short_id title author_name author_email committer_name
1✔
1744
                           committer_email message web_url ).
1✔
1745
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
1746
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
1747
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
1748
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
1749
                mapping
1✔
1750
                        mapProperty: 'stats'
1✔
1751
                        getter: [ :el | "Not used" ]
1✔
1752
                        setter: [ :commit :value |
1✔
1753
                                commit deletions: (value at: #deletions).
1✔
1754
                                commit additions: (value at: #additions) ] ].
1✔
1755

1✔
1756
        reader for: DateAndTime customDo: [ :mapping |
1✔
1757
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
1758

1✔
1759
        reader
1✔
1760
                for: #ArrayOfIds
1✔
1761
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
1762
  
1✔
1763
        reader
1✔
1764
                for: #ArrayOfCommit
1✔
1765
                customDo: [ :customMappting |
1✔
1766
                customMappting listOfElementSchema: GLHCommit ].
1✔
1767

1✔
1768
        ^ reader nextAs: #ArrayOfCommit
1✔
1769
]
1✔
1770

1✔
1771
{ #category : #private }
1✔
1772
GitlabModelImporter >> parseDiffResult: result [
1✔
1773

1✔
1774
        | reader |
1✔
1775
        self
1✔
1776
                deprecated: 'Use #newParseDiffResult: instead'
1✔
1777
                on: '28 June 2024'
1✔
1778
                in:
1✔
1779
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
1✔
1780
        reader := NeoJSONReader on: result readStream.
1✔
1781
        reader for: GLHDiff do: [ :mapping |
1✔
1782
                mapping mapInstVars:
1✔
1783
                        #( deleted_file new_file new_path old_path renamed_file ).
1✔
1784
                mapping mapInstVar: #diffString to: #diff ].
1✔
1785

1✔
1786
        reader
1✔
1787
                for: #ArrayOfDiffs
1✔
1788
                customDo: [ :customMappting |
1✔
1789
                customMappting listOfElementSchema: GLHDiff ].
1✔
1790
        ^ reader nextAs: #ArrayOfDiffs
1✔
1791
]
1✔
1792

1✔
1793
{ #category : #'private - parsing' }
1✔
1794
GitlabModelImporter >> parseFileTreeResult: aResult [
1✔
1795

1✔
1796
        | reader |
1✔
1797
        reader := NeoJSONReader on: aResult readStream.
1✔
1798
        reader mapInstVarsFor: GLHApiFile.
1✔
1799
        reader
1✔
1800
                for: #ArrayOfFile
1✔
1801
                customDo: [ :customMappting | 
1✔
1802
                customMappting listOfElementSchema: GLHApiFile ].
1✔
1803
        ^ reader nextAs: #ArrayOfFile
1✔
1804
]
1✔
1805

1✔
1806
{ #category : #'private - parsing' }
1✔
1807
GitlabModelImporter >> parseGroupResult: aResult [
1✔
1808

1✔
1809
        | reader |
1✔
1810

1✔
1811
        reader := NeoJSONReader on: aResult readStream.
1✔
1812
        reader for: GLHGroup do: [ :mapping |
1✔
1813
                mapping mapInstVars.
1✔
1814
                (mapping mapInstVar: #projects) valueSchema: #ArrayOfProjects ].
1✔
1815
        reader mapInstVarsFor: GLHProject.
1✔
1816
        reader
1✔
1817
                for: #ArrayOfProjects
1✔
1818
                customDo: [ :customMappting |
1✔
1819
                customMappting listOfElementSchema: GLHProject ].
1✔
1820
        ^ reader nextAs: GLHGroup
1✔
1821
]
1✔
1822

1✔
1823
{ #category : #'private - parsing' }
1✔
1824
GitlabModelImporter >> parseJobsResult: result ofProject: aProject [
1✔
1825

1✔
1826
        | reader |
1✔
1827
        reader := NeoJSONReader on: result readStream.
1✔
1828
        reader for: GLHJob do: [ :mapping |
1✔
1829
                mapping mapInstVars: #( id allow_failure web_url name ).
1✔
1830

1✔
1831
                mapping
1✔
1832
                        mapProperty: #user
1✔
1833
                        getter: [ :object | #ignore ]
1✔
1834
                        setter: [ :object :value |
1✔
1835
                        object user: (self importUser: (value at: #id)) ].
1✔
1836

1✔
1837
                mapping
1✔
1838
                        mapProperty: #commit
1✔
1839
                        getter: [ :object | #ignore ]
1✔
1840
                        setter: [ :object :value |
1✔
1841
                                value ifNotNil: [
1✔
1842
                                        object commit:
1✔
1843
                                                (self importCommit: (value at: #id) ofProject: aProject) ] ].
1✔
1844

1✔
1845
                mapping
1✔
1846
                        mapProperty: #duration
1✔
1847
                        getter: [ :object | #ignore ]
1✔
1848
                        setter: [ :object :value |
1✔
1849
                        value ifNotNil: [ object duration: value seconds ] ] ].
1✔
1850

1✔
1851
        reader
1✔
1852
                for: #ArrayOfGLHJob
1✔
1853
                customDo: [ :customMappting |
1✔
1854
                customMappting listOfElementSchema: GLHJob ].
1✔
1855
        ^ reader nextAs: #ArrayOfGLHJob
1✔
1856
]
1✔
1857

1✔
1858
{ #category : #'private - parsing' }
1✔
1859
GitlabModelImporter >> parseMergeRequestsResult: result [
1✔
1860

1✔
1861
        generalReader on: result readStream.
1✔
1862
        ^ generalReader nextAs: #ArrayOfMergeRequest
1✔
1863
]
1✔
1864

1✔
1865
{ #category : #'private - parsing' }
1✔
1866
GitlabModelImporter >> parseNoteJson: results [  
1✔
1867
    | reader |  
1✔
1868

1✔
1869
    "Créer un lecteur JSON"
1✔
1870
    reader := NeoJSONReader on: results readStream.    
1✔
1871

1✔
1872
    "Définir le mapping pour l'objet GLHNote"
1✔
1873
    reader for: GLHNote do: [ :mapping |  
1✔
1874
        mapping mapInstVars: #(id noteable_id attachment system confidential internal  
1✔
1875
                               noteable_iid resolvable imported imported_from  
1✔
1876
                               author body project_id noteable_type).  
1✔
1877

1✔
1878
        (mapping mapInstVar: #created_at) valueSchema: DateAndTime.  
1✔
1879
        (mapping mapInstVar: #updated_at) valueSchema: DateAndTime.  
1✔
1880
    ].    
1✔
1881

1✔
1882
    "Corriger la conversion des dates"
1✔
1883
    reader for: DateAndTime customDo: [ :mapping |  
1✔
1884
        mapping decoder: [ :string | DateAndTime readFrom: string readStream ] ].
1✔
1885

1✔
1886
        reader
1✔
1887
                for: #ArrayOfNote
1✔
1888
                customDo: [ :customMappting | 
1✔
1889
                customMappting listOfElementSchema: GLHNote ].
1✔
1890
         ^ reader nextAs: #ArrayOfNote
1✔
1891

1✔
1892
    "Retourner la Note"
1✔
1893
    "^ reader nextAs: GLHNote"
1✔
1894

1✔
1895

1✔
1896
]
1✔
1897

1✔
1898
{ #category : #'private - parsing' }
1✔
1899
GitlabModelImporter >> parsePipelineResult: result [
1✔
1900

1✔
1901
        | reader |
1✔
1902
        
1✔
1903
        (result includesSubstring: '{"message":"40' )ifTrue: [ ^ {  } ].
1✔
1904
        
1✔
1905
        reader := generalReader on: result readStream.
1✔
1906
        
1✔
1907
        ^ reader nextAs: GLHPipeline
1✔
1908
]
1✔
1909

1✔
1910
{ #category : #'private - parsing' }
1✔
1911
GitlabModelImporter >> parsePipelinesResult: result [
1✔
1912

1✔
1913
        | reader |
1✔
1914
        
1✔
1915
        (result includesSubstring: '{"message":"40' )ifTrue: [ ^ {  } ].
1✔
1916
        
1✔
1917
        reader := generalReader on: result readStream.
1✔
1918
        
1✔
1919
        ^ reader nextAs: #ArrayOfPipelines
1✔
1920
]
1✔
1921

1✔
1922
{ #category : #'private - parsing' }
1✔
1923
GitlabModelImporter >> parseProjectResult: aResult [ 
1✔
1924
                | reader |
1✔
1925
        reader := NeoJSONReader on: aResult readStream.
1✔
1926
        reader for: GLHProject do: [ :mapping |
1✔
1927
                mapping mapInstVars. ].
1✔
1928
"        reader mapInstVarsFor: GLHProject."
1✔
1929

1✔
1930
        ^ reader nextAs: GLHProject
1✔
1931
]
1✔
1932

1933
{ #category : #parsing }
1934
GitlabModelImporter >> parseReleaseResult: result [
×
1935
        |reader|
×
1936
        reader := generalReader on: result readStream.
×
1937
        
×
1938
        ^ reader nextAs: GLHRelease 
×
UNCOV
1939
]
×
1940

1941
{ #category : #parsing }
1942
GitlabModelImporter >> parseReleasesResult: result [
×
1943
        |reader|
×
1944
        reader := generalReader on: result readStream.
×
1945
        
×
1946
        ^ reader nextAs: #ArrayOfReleases
×
1947
]
×
1948

1949
{ #category : #'private - parsing' }
1950
GitlabModelImporter >> parseSubGroupResult: aResult [
×
1951

×
1952
        | reader |
×
1953
        reader := NeoJSONReader on: aResult readStream.
×
1954
        self configureReaderForGroup: reader.
×
1955
        ^ reader nextAs: #ArrayOfGroups
×
UNCOV
1956
]
×
1957

1958
{ #category : #parsing }
UNCOV
1959
GitlabModelImporter >> parseTagsResult: result [
×
UNCOV
1960
        |reader|
×
UNCOV
1961
        reader := generalReader on: result readStream.
×
UNCOV
1962
        
×
UNCOV
1963
        ^ reader nextAs: #ArrayOfTags
×
UNCOV
1964
]
×
1965

1966
{ #category : #'private - parsing' }
1967
GitlabModelImporter >> parseUserResult: result [
1✔
1968

1✔
1969
        | reader |
1✔
1970
        
1✔
1971
        reader := generalReader on: result readStream.
1✔
1972
        
1✔
1973
        ^ reader nextAs: GLHUser
1✔
1974

1✔
1975
        
1✔
1976

1✔
1977
]
1✔
1978

1979
{ #category : #'private - parsing' }
UNCOV
1980
GitlabModelImporter >> parseUsersResult: result [
×
UNCOV
1981

×
1982
        | reader |
×
1983
        
×
1984
        reader := generalReader on: result readStream.
×
1985
        
×
1986
        ^ reader nextAs: #ArrayOfUser
×
1987
        
×
1988
]
×
1989

1990
{ #category : #'import - projects' }
1991
GitlabModelImporter >> partiallyImportProject: aProjectID [
×
1992

×
1993
        | result projectResult |
×
1994
        ('Import project with id:  ' , aProjectID printString) recordInfo.
×
1995

×
1996
        (glhModel allWithType: GLHProject)
×
1997
                detect: [ :project | project id = aProjectID ]
×
1998
                ifFound: [ :project | ^ project ].
×
1999

×
UNCOV
2000
        result := self repoApi projects get: aProjectID.
×
UNCOV
2001
        projectResult := self parseProjectResult: result.
×
2002

×
2003
        projectResult repository: GLHRepository new.
×
2004
        self glhModel add: projectResult repository.
×
2005
        self importRepository: projectResult repository.
×
2006

×
2007
        ^ projectResult
×
2008
]
×
2009

2010
{ #category : #'import - pipelines' }
2011
GitlabModelImporter >> pipelinesOf: aProjectID after: after andBefore: before [
×
2012

×
2013
        | result |
×
2014
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
×
UNCOV
2015
        
×
UNCOV
2016
        result := self repoApi pipelines getAllInProject: aProjectID 
×
UNCOV
2017
                                                                                                withParams: {        #updated_before -> before.
×
UNCOV
2018
                                                                                                                                        #updated_after -> after} asDictionary .
×
UNCOV
2019
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
×
UNCOV
2020

×
UNCOV
2021
        ^ (result collect: [ :pipelinesJson |
×
UNCOV
2022
                           self parsePipelinesResult: pipelinesJson ]) flattened
×
UNCOV
2023
]
×
2024

2025
{ #category : #'import - pipelines' }
2026
GitlabModelImporter >> pipelinesOf: aProjectID withLimit: aLimit [
1✔
2027

1✔
2028
        | result |
1✔
2029
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
1✔
2030
        result := self repoApi pipelines getByPage: 1 perPage: aLimit inProject: aProjectID.
1✔
2031
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
1✔
2032

1✔
2033
        ^ (result collect: [ :pipelinesJson |
1✔
2034
                           self parsePipelinesResult: pipelinesJson ]) flattened
1✔
2035
]
1✔
2036

2037
{ #category : #accessing }
2038
GitlabModelImporter >> repoApi: anObject [
1✔
2039
        super repoApi: anObject.
1✔
2040
        self repoApi output: 'json'
1✔
2041
]
1✔
2042

2043
{ #category : #'search - merge request' }
2044
GitlabModelImporter >> searchMergeRequestMentionning: aString [ 
×
2045
        |mergeRequests results|
×
UNCOV
2046
        results := repoApi mergeRequests search: aString.
×
UNCOV
2047
        mergeRequests := self parseMergeRequestsResult: results.
×
2048
        mergeRequests :=        mergeRequests collect: [ :mr |
×
2049
                mr project: (self importProject: mr project_id).
×
2050
                mr
×
2051
                 ].
×
2052
        
×
UNCOV
2053
        ^ glhModel addAll: mergeRequests unless: self blockOnIdEquality. 
×
UNCOV
2054
]
×
2055

2056
{ #category : #private }
UNCOV
2057
GitlabModelImporter >> selectEntityType: aType overAttribut: aSelector equalTo: value [
×
UNCOV
2058

×
UNCOV
2059
        ^ (self glhModel allWithType: aType)
×
UNCOV
2060
                select: [ :entity | (entity perform: aSelector) = value ]
×
UNCOV
2061
]
×
2062

2063
{ #category : #'import - groups' }
2064
GitlabModelImporter >> subGroupsOf: aGroupID [
1✔
2065

1✔
2066
        | results subgroups |
1✔
2067
        ('Search subgroup of: ' , aGroupID printString) recordInfo.
1✔
2068
        results := self repoApi groups subgroupsOf: aGroupID.
1✔
2069
        subgroups := (results collect: [ :subgroupsJson | self parseSubGroupResult: subgroupsJson ]) flattened.
1✔
2070
        
1✔
2071
        ^ subgroups
1✔
2072
]
1✔
2073

2074
{ #category : #accessing }
UNCOV
2075
GitlabModelImporter >> withInitialCommits: boolean [
×
UNCOV
2076
        withInitialCommits := boolean 
×
UNCOV
2077
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc