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

moosetechnology / GitProjectHealth / 17947755529

23 Sep 2025 01:28PM UTC coverage: 73.698% (+0.4%) from 73.342%
17947755529

Pull #233

github

web-flow
Merge 9221e4a4e into dd8ffa1f6
Pull Request #233: V2.0.0 : Refactoring importers

935 of 1233 new or added lines in 22 files covered. (75.83%)

58 existing lines in 7 files now uncovered.

19283 of 26165 relevant lines covered (73.7%)

0.74 hits per line

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

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

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

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

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

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

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

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

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

50
{ #category : #'import - commits' }
UNCOV
51
GitlabModelImporter >> commitsOfProject: aGLHProject forRefName: refName until: toDate [
×
52

×
53
        | params results allCommits |
×
54
        
×
55
        params := { 
×
56
                #ref_name -> refName.
×
57
                #until -> (toDate ifNotNil: [ toDate asDateAndTime asString ] ifNil: [ '' ]) 
×
58
        } asDictionary.
×
59
        results := self repoApi commits getAllInProject: aGLHProject id withParams: params.
×
60
        allCommits := (results collect: [ :commitsJson | self parseCommitsResult: commitsJson ]) flattened.
×
61
        
×
62
        self glhModel addAll: allCommits unless: self blockOnIdEquality.
×
63
        aGLHProject repository commits addAll: allCommits unless: self blockOnIdEquality.
×
64

×
65
        self withCommitDiffs ifTrue: [
×
66
                aGLHProject repository commits do: [ :commit |
×
67
                        self importDiffOfCommit: commit ] ].
×
68
        
×
69
        ^allCommits
×
70
]
×
71

72
{ #category : #'import - projects' }
73
GitlabModelImporter >> completeImportProject: aGLHProject [
×
74

×
75
        | importedProject |
×
76
        ('Complete import of project: ' , aGLHProject id printString)
×
77
                recordInfo.
×
78
        aGLHProject repository ifNotNil: [ ^ aGLHProject ].
×
79

×
80
        importedProject := self glhModel
×
81
                                   add: aGLHProject
×
82
                                   unless: self blockOnIdEquality.
×
83

×
84
        self importLatestPipelinesOfProject: importedProject.
×
85

×
86
        "aGLHProject creator: (self importUser: aGLHProject creator_id)."
×
87

×
88
        (self importUser: importedProject creator_id) addCreatedProject:
×
89
                importedProject.
×
90

×
91

×
92
        importedProject repository: GLHRepository new.
×
93
        self glhModel add: importedProject repository.
×
94
        self importRepository: importedProject repository.
×
95

×
96

×
97
        withInitialMergeRequest ifTrue: [
×
98
                self
×
NEW
99
                        importMergeRequestsOfProject: importedProject
×
100
                        since: DateAndTime today
×
101
                        until: DateAndTime now ].
×
102

×
103
        ^ importedProject
×
104
        
×
105

×
106
]
×
107

108
{ #category : #'import - commits' }
109
GitlabModelImporter >> completeImportedCommit: aCommit [
1✔
110

1✔
111
        ('completing commit: ' , aCommit short_id printString) recordInfo.
1✔
112
        self importCreatorOfCommit: aCommit.
1✔
113

1✔
114
        self withCommitDiffs ifTrue: [
1✔
115
                | diffs |
1✔
116
                aCommit diffs ifEmpty: [
1✔
117
                        diffs := self importDiffOfCommit: aCommit.
1✔
118
                        self glhModel addAll: diffs unless: self blockForDiffEquality ] ].
1✔
119

1✔
120
        ^ aCommit
1✔
121
]
1✔
122

123
{ #category : #'import - jobs' }
124
GitlabModelImporter >> completeImportedJob: aGLHJob [
1✔
125
        
1✔
126
        aGLHJob commit ifNil: [ 
1✔
127
                |commit|
1✔
128
                commit := self
1✔
129
                          importCommit:
1✔
130
                          (aGLHJob cacheAt: #commitID ifAbsent: [ '' ])
1✔
131
                          ofProject: aGLHJob pipeline project.
1✔
132
                aGLHJob commit: commit. ].
1✔
133
        
1✔
134
        aGLHJob user ifNil: [ 
1✔
135
                |user|
1✔
136
                user := self importUser: (aGLHJob cacheAt: #userID ifAbsent: [ '' ]).
1✔
137
        aGLHJob user: user.
1✔
138
                 ]. 
1✔
139
        
1✔
140
        
1✔
141
        ^ aGLHJob
1✔
142
]
1✔
143

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

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

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

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

1✔
178
        importedProject := self glhModel
1✔
179
                                   add: aGLHProject
1✔
180
                                   unless: self blockOnIdEquality.
1✔
181

1✔
182
        self importLatestPipelinesOfProject: importedProject.
1✔
183

1✔
184
        "aGLHProject creator: (self importUser: aGLHProject creator_id)."
1✔
185

1✔
186
        (self importUser: importedProject creator_id) addCreatedProject:
1✔
187
                importedProject.
1✔
188

1✔
189
        
1✔
190
        importedProject repository: GLHRepository new.
1✔
191
        self glhModel add: importedProject repository.
1✔
192
        self importRepository: importedProject repository.
1✔
193
        
1✔
194

1✔
195
        withInitialMergeRequest ifTrue: [
1✔
196
                self
1✔
197
                        importMergeRequestsOfProject: importedProject
1✔
198
                        since: DateAndTime today
1✔
199
                        until: DateAndTime now ].
1✔
200

1✔
201
        ^ importedProject
1✔
202
        
1✔
203

1✔
204
]
1✔
205

206
{ #category : #'private - configure reader' }
207
GitlabModelImporter >> configureReaderForBranch: reader [
1✔
208

1✔
209
        super configureReaderForBranch: reader.
1✔
210
        
1✔
211
                reader for: GLHBranch do: [ :mapping |
1✔
212
                mapping
1✔
213
                        mapProperty: #commit
1✔
214
                        getter: [  ]
1✔
215
                        setter: [ :branch :rawCommit | branch sha: (rawCommit at: #id) ] ].
1✔
216
]
1✔
217

218
{ #category : #'private - configure reader' }
219
GitlabModelImporter >> configureReaderForCommit: reader [
1✔
220

1✔
221
        super configureReaderForCommit: reader.
1✔
222
        
1✔
223
        reader for: GLHCommit do: [ :mapping |
1✔
224
                mapping mapInstVars:
1✔
225
                        #( id short_id title author_name author_email committer_name
1✔
226
                           committer_email message web_url ).
1✔
227
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
228
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
229
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
230
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
231
                mapping
1✔
232
                        mapProperty: 'stats'
1✔
233
                        getter: [ :el | "Not used" ]
1✔
234
                        setter: [ :commit :value |
1✔
235
                                commit deletions: (value at: #deletions).
1✔
236
                                commit additions: (value at: #additions) ] ].
1✔
237

1✔
238
        reader
1✔
239
                for: #ArrayOfIds
1✔
240
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
241

1✔
242

1✔
243
]
1✔
244

245
{ #category : #'private - configure reader' }
246
GitlabModelImporter >> configureReaderForDiff: reader [
1✔
247

1✔
248
        super configureReaderForDiff: reader.
1✔
249
        reader
1✔
250
                for: GLHDiff
1✔
251
                do: [ :mapping | 
1✔
252
                        "mapping mapInstVars:
1✔
253
                        #( deleted_file new_file new_path old_path renamed_file )."
1✔
254
                        mapping mapInstVar: #diffString to: #diff ].
1✔
255

1✔
256
        ^ reader
1✔
257
]
1✔
258

259
{ #category : #'private - configure reader' }
260
GitlabModelImporter >> configureReaderForGroup: reader [
1✔
261

1✔
262
        super configureReaderForGroup: reader.
1✔
263

1✔
264
        reader for: GLHGroup do: [ :mapping |
1✔
265
                (mapping mapInstVar: #projects) valueSchema: #ArrayOfProject ]
1✔
266
]
1✔
267

268
{ #category : #'private - configure reader' }
269
GitlabModelImporter >> configureReaderForJob: reader [
1✔
270

1✔
271
        super configureReaderForJob: reader.
1✔
272

1✔
273
        reader
1✔
274
                for: GLHJob
1✔
275
                do: [ :mapping | "(mapping mapInstVar: #user) valueSchema: GLHUser.
1✔
276
                (mapping mapInstVar: #pipeline) valueSchema: GLHPipeline."
1✔
277
                        mapping
1✔
278
                                mapProperty: #user
1✔
279
                                getter: [  ]
1✔
280
                                setter: [ :job :rawUser |
1✔
281
                                job cacheAt: #userID put: (rawUser at: #id) ].
1✔
282

1✔
283
                        mapping
1✔
284
                                mapProperty: #pipeline
1✔
285
                                getter: [  ]
1✔
286
                                setter: [ :job :rawPipeline |
1✔
287
                                        job cacheAt: #pipelineID put: (rawPipeline at: #id) ].
1✔
288
                                
1✔
289
                        mapping
1✔
290
                                mapProperty: #commit
1✔
291
                                getter: [  ]
1✔
292
                                setter: [ :job :rawCommit |
1✔
293
                                        job cacheAt: #commitID put: (rawCommit at: #id) ].
1✔
294

1✔
295
                        "mapping
1✔
296
                        mapProperty: #user
1✔
297
                        getter: [ :object | #ignore ]
1✔
298
                        setter: [ :object :value |
1✔
299
                        object user: (self importUser: (value at: #id)) ]."
1✔
300

1✔
301
                        mapping
1✔
302
                                mapProperty: #duration
1✔
303
                                getter: [ :object | #ignore ]
1✔
304
                                setter: [ :object :value |
1✔
305
                                value ifNotNil: [ object duration: value seconds ] ] ]
1✔
306
]
1✔
307

308
{ #category : #'private - configure reader' }
309
GitlabModelImporter >> configureReaderForMergeRequest: reader [
1✔
310
        "declare quil y a un array a mapper"
1✔
311
        self flag: 'assignee.s must be parsed with nil condition'.
1✔
312
        super configureReaderForMergeRequest: reader.
1✔
313

1✔
314
        "declare la liste des properties"
1✔
315
        reader
1✔
316
                for: GLHMergeRequest
1✔
317
                do: [ :mapping | 
1✔
318
                         
1✔
319
                        "(mapping mapInstVar: #assignee) valueSchema: GLHUser."
1✔
320
                        "(mapping mapInstVar: #assignees) valueSchema: #ArrayOfUser."
1✔
321
                        (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
322
                        (mapping mapInstVar: #updated_at) valueSchema: DateAndTime.
1✔
323
                        (mapping mapInstVar: #merged_at) valueSchema: DateAndTime.
1✔
324
                        (mapping mapInstVar: #closed_at) valueSchema: DateAndTime.
1✔
325

1✔
326
                        mapping
1✔
327
                                mapProperty: #author
1✔
328
                                getter: [  ]
1✔
329
                                setter: [ :object :value |
1✔
330
                                object cacheAt: #authorID put: (value at: #id) ].
1✔
331
                        mapping
1✔
332
                                mapProperty: #merge_user
1✔
333
                                getter: [  ]
1✔
334
                                setter: [ :object :value |
1✔
335
                                        value ifNotNil: [
1✔
336
                                                object cacheAt: #mergeUserID put: (value at: #id) ] ] ]
1✔
337
]
1✔
338

339
{ #category : #'private - parsing' }
340
GitlabModelImporter >> configureReaderForNote: reader [
1✔
341

1✔
342
        super configureReaderForNote: reader.
1✔
343

1✔
344
        reader for: GLHNote do: [ :mapping |
1✔
345
                
1✔
346
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
347
                (mapping mapInstVar: #updated_at) valueSchema: DateAndTime ]
1✔
348
]
1✔
349

350
{ #category : #'private - configure reader' }
351
GitlabModelImporter >> configureReaderForPipeline: reader [
1✔
352

1✔
353
        super configureReaderForPipeline: reader.
1✔
354

1✔
355
        reader for: GLHPipeline do: [ :mapping |
1✔
356
                mapping
1✔
357
                        mapProperty: #created_at
1✔
358
                        getter: [ :object | #ignore ]
1✔
359
                        setter: [ :object :value |
1✔
360
                                object created_at:
1✔
361
                                        (value ifNotNil: [ DateAndTime fromString: value ]).
1✔
362
                                object runDate:
1✔
363
                                        (value ifNotNil: [ DateAndTime fromString: value ]) ].
1✔
364

1✔
365
                mapping
1✔
366
                        mapProperty: #updated_at
1✔
367
                        getter: [ :object | #ignore ]
1✔
368
                        setter: [ :object :value |
1✔
369
                                object updated_at:
1✔
370
                                        (value ifNotNil: [ DateAndTime fromString: value ]) ].
1✔
371

1✔
372
                mapping
1✔
373
                        mapProperty: #finished_at
1✔
374
                        getter: [ :object | #ignore ]
1✔
375
                        setter: [ :object :value |
1✔
376
                                object finished_at:
1✔
377
                                        (value ifNotNil: [ DateAndTime fromString: value ]) ].
1✔
378

1✔
379
                mapping
1✔
380
                        mapProperty: #started_at
1✔
381
                        getter: [ :object | #ignore ]
1✔
382
                        setter: [ :object :value |
1✔
383
                                object started_at:
1✔
384
                                        (value ifNotNil: [ DateAndTime fromString: value ]) ].
1✔
385

1✔
386
                mapping
1✔
387
                        mapProperty: #source
1✔
388
                        getter: [ :object | #ignore ]
1✔
389
                        setter: [ :object :value | object sourceEvent: value ].
1✔
390

1✔
391
                mapping
1✔
392
                        mapProperty: #duration
1✔
393
                        getter: [ :object | #ignore ]
1✔
394
                        setter: [ :object :value |
1✔
395
                                object duration: (value ifNotNil: [ value asDuration ]) ].
1✔
396

1✔
397
                mapping
1✔
398
                        mapProperty: #user
1✔
399
                        getter: [ :object | #ignore ]
1✔
400
                        setter: [ :object :value |
1✔
401
                                value ifNotNil: [ object cacheAt: #userID put: (value at: #id) ] ] ].
1✔
402

1✔
403
]
1✔
404

405
{ #category : #'private - configure reader' }
406
GitlabModelImporter >> configureReaderForProject: reader [
1✔
407

1✔
408
        super configureReaderForProject: reader.
1✔
409
        
1✔
410
        reader for: GLHProject do: [ :mapping |
1✔
411
                mapping mapInstVar: #web_url to: #html_url.
1✔
412
                ].
1✔
413
]
1✔
414

415
{ #category : #'private - configure reader' }
416
GitlabModelImporter >> configureReaderForRelease: reader [
1✔
417

1✔
418
        super configureReaderForRelease: reader.
1✔
419

1✔
420

1✔
421
        reader
1✔
422
                for: GLHRelease
1✔
423
                do: [ :mapping | (mapping mapInstVar: #author) valueSchema: GLHUser ].
1✔
424

1✔
425
]
1✔
426

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

1✔
430
        reader mapInstVarsFor: GLHTag .
1✔
431
        
1✔
432
        reader for: GLHTag do: [ :mapping |
1✔
433
                
1✔
434
                (mapping mapInstVar: #commit) valueSchema: GLHCommit .
1✔
435
"                (mapping mapInstVar: #release) valueSchema: GLHRelease ."
1✔
436
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime .
1✔
437
                
1✔
438
                mapping
1✔
439
                        mapProperty: #release
1✔
440
                        getter: [ :object | #ignore ]
1✔
441
                        setter: [ :object :value |
1✔
442
                        object release: (value ifNotNil: [ GLHRelease new description: (value at:#description); tag_name: (value at: #tag_name); yourself ]).
1✔
443
                        ].
1✔
444
                 ].
1✔
445
        
1✔
446
        reader
1✔
447
                for: #ArrayOfTags
1✔
448
                customDo: [ :customMappting |
1✔
449
                customMappting listOfElementSchema: GLHTag ].
1✔
450
]
1✔
451

1✔
452
{ #category : #'private - configure reader' }
1✔
453
GitlabModelImporter >> configureReaderForUser: reader [
1✔
454

1✔
455
        super configureReaderForUser: reader. 
1✔
456
        
1✔
457
]
1✔
458

1✔
459
{ #category : #private }
1✔
460
GitlabModelImporter >> convertApiFileAsFile: aAPIFile [
1✔
461

1✔
462
        aAPIFile type = 'tree' ifTrue: [ 
1✔
463
                ^ GLHFileDirectory new
1✔
464
                          name: aAPIFile name;
1✔
465
                          yourself ].
1✔
466
        ^ GLHFileBlob new
1✔
467
                  name: aAPIFile name;
1✔
468
                  yourself
1✔
469
]
1✔
470

1✔
471
{ #category : #private }
1✔
472
GitlabModelImporter >> detectEntityType: aType overAttribut: aSelector equalTo: value [
1✔
473

1✔
474
        ^ (self glhModel allWithType: aType) detect: [ :entity |
1✔
475
                  (entity perform: aSelector) = value ] ifNone: [ nil ]. 
1✔
476
]
1✔
477

1✔
478
{ #category : #accessing }
1✔
479
GitlabModelImporter >> glhApi [
1✔
480

1✔
481
        self
1✔
482
                deprecated: 'Use #repoApi instead'
1✔
483
                on: '7 October 2024'
1✔
484
                in:
1✔
485
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
1✔
486

1✔
487
        ^ repoApi
1✔
488
]
1✔
489

1✔
490
{ #category : #accessing }
1✔
491
GitlabModelImporter >> glhApi: anObject [
1✔
492

1✔
493
        self
1✔
494
                deprecated: 'Use #repoApi: instead'
1✔
495
                on: '7 October 2024'
1✔
496
                in:
1✔
497
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
1✔
498

1✔
499
        repoApi := anObject
1✔
500
]
1✔
501

1✔
502
{ #category : #accessing }
1✔
503
GitlabModelImporter >> glhModel [
1✔
504

1✔
505
        ^ glhModel
1✔
506
]
1✔
507

1✔
508
{ #category : #accessing }
1✔
509
GitlabModelImporter >> glhModel: anObject [
1✔
510

1✔
511
        glhModel := anObject
1✔
512
]
1✔
513

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

1✔
517
        | params result users |
1✔
518
        params := { 
1✔
519
                #humans -> 'true'.
1✔
520
                #active -> 'true'.
1✔
521
                #without_project_bots -> 'true'
1✔
522
        } asDictionary.
1✔
523
        result := self repoApi users allWithParams: params.
1✔
524
        users := (result collect: [ :usersJson | self parseUsersResult: usersJson ]) flattened.
1✔
525
        
1✔
526
        self glhModel
1✔
527
                                 addAll: users
1✔
528
                                 unless: self blockOnIdEquality.
1✔
529

1✔
530
        ^ users
1✔
531
]
1✔
532

1✔
533
{ #category : #'import - groups' }
1✔
534
GitlabModelImporter >> importAllGroups [
1✔
535

1✔
536
        | params results groups |
1✔
537
        
1✔
538
        params := { 
1✔
539
                        #top_level_only -> 'true'
1✔
540
        } asDictionary.
1✔
541
        results := self repoApi groups getAllWithParams: params.
1✔
542
        
1✔
543
        groups := (results collect: [ :groupsJson | generalReader
1✔
544
                                            on: groupsJson readStream;
1✔
545
                                            nextAs: #ArrayOfGroups. ]) flattened.
1✔
546
        ^ groups
1✔
547
]
1✔
548

1✔
549
{ #category : #'import - pipelines' }
1✔
550
GitlabModelImporter >> importAllPipelinesOfProject: aGLHProject [
1✔
551
        
1✔
552
        (self allPipelinesOf: aGLHProject id) do: [ :pipeline |
1✔
553
                | pip |
1✔
554
                pip := self glhModel add: pipeline unless: self blockOnIdEquality.
1✔
555
                pip := aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
556
                self completeImportedPipeline: pip ].
1✔
557

1✔
558
        ^ aGLHProject pipelines
1✔
559
]
1✔
560

1✔
561
{ #category : #'import - commits' }
1✔
562
GitlabModelImporter >> importAndLoadLatestsCommitsOfProject: aGLHProject [
1✔
563

1✔
564
        | commits completedProject |
1✔
565
        completedProject := self completeImportedProject: aGLHProject.
1✔
566
        commits := self importLatestCommitsOfProject: completedProject.
1✔
567
        commits do: [ :commit | self completeImportedCommit: commit ].
1✔
568
        self chainsCommitsFrom: commits.
1✔
569
        ^ commits
1✔
570
]
1✔
571

1✔
572
{ #category : #'import - users' }
1✔
573
GitlabModelImporter >> importAuthorOfCommit: aGLHCommit [
1✔
574

1✔
575
        | user |
1✔
576
                self
1✔
577
                deprecated: 'Use importCreatorOfCommit: instead of current one'
1✔
578
                on: '19 September 2025'
1✔
579
                in:
1✔
580
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
581

1✔
582
        
1✔
583
        user := self importUserByUsername: aGLHCommit author_name.
1✔
584
        aGLHCommit commitCreator: user.
1✔
585
        ^ user
1✔
586
]
1✔
587

1✔
588
{ #category : #'import - branches' }
1✔
589
GitlabModelImporter >> importBranchesOf: aGLHProject [
1✔
590

1✔
591
        | resultBranches branches foundBranches |
1✔
592
        "aGLHProject repository branches removeAll "
1✔
593
        resultBranches := self repoApi branches getAllFromProject:
1✔
594
                                  aGLHProject id.
1✔
595

1✔
596
        foundBranches := (resultBranches collect: [ :branchesJson |
1✔
597
                                  self
1✔
598
                                          parseBranchesResult: branchesJson
1✔
599
                                           ]) flattened.
1✔
600

1✔
601
        'import the branches of project ' recordInfo.
1✔
602

1✔
603
        "WARNING: always add branch first into repository, than into model !"
1✔
604
        branches := aGLHProject repository branches
1✔
605
                            addAll: foundBranches
1✔
606
                            unless: self blockOnNameEquality.
1✔
607

1✔
608

1✔
609
        branches := self glhModel
1✔
610
                            addAll: branches
1✔
611
                            unless: self blockForBranchEquality.
1✔
612

1✔
613
        "WARNING : branch must load its HEAD commit (ref) in a second time "
1✔
614
        ^ branches
1✔
615
]
1✔
616

1✔
617
{ #category : #'import - commits' }
1✔
618
GitlabModelImporter >> importCommit: aCommitID ofProject: aGLHProject [
1✔
619

1✔
620
        | result parsedResult |
1✔
621
        (self glhModel allWithType: GLHCommit) asOrderedCollection
1✔
622
                detect: [ :commit | commit id = aCommitID ]
1✔
623
                ifFound: [ :commit | ^ commit ].
1✔
624

1✔
625
        result := self repoApi commits
1✔
626
                          get: aCommitID
1✔
627
                          inProject: aGLHProject id.
1✔
628

1✔
629
        parsedResult := self parseCommitResult: result.
1✔
630

1✔
631
        parsedResult := self glhModel
1✔
632
                                add: parsedResult
1✔
633
                                unless: self blockOnIdEquality.
1✔
634
        parsedResult := aGLHProject repository commits
1✔
635
                                add: parsedResult
1✔
636
                                unless: self blockOnIdEquality.
1✔
637

1✔
638
        self withCommitDiffs ifTrue: [ self importDiffOfCommit: parsedResult ].
1✔
639

1✔
640
        ^ parsedResult
1✔
641
]
1✔
642

1✔
643
{ #category : #'import - commits' }
1✔
644
GitlabModelImporter >> importCommitOfProject: anProject withId: anID [
1✔
645

1✔
646
        | commit result |
1✔
647
self
1✔
648
                deprecated: 'Use importCommit:ofProject: instead of current one'
1✔
649
                on: '27 August 2025'
1✔
650
                in: 'MSR 1.3.0 '
1✔
651
                transformWith: '`@rcv importCommitOfProject: `arg1 withId: `arg2' -> '`@rcv importCommit: `arg2 ofProject: `arg1'.
1✔
652
        anID ifNil: [ ^ nil ].
1✔
653

1✔
654
        ('looking for commit ' , anID printString , ' in project : '
1✔
655
         , anProject id printString) recordInfo.
1✔
656

1✔
657
        commit := (self
1✔
658
                           detectEntityType: GLHCommit
1✔
659
                           overAttribut: #id
1✔
660
                           equalTo: anID) ifNil: [
1✔
661
                          result := self repoApi commits
1✔
662
                                            get: anID
1✔
663
                                            inProject: anProject id.
1✔
664
                          commit := (self parseCommitsResult: '[' , result , ']')
1✔
665
                                            first.
1✔
666

1✔
667
                          commit := self glhModel
1✔
668
                                            add: commit
1✔
669
                                            unless: self blockOnIdEquality.
1✔
670
                          commit repository: anProject repository.
1✔
671

1✔
672
                          commit ].
1✔
673

1✔
674
        self withCommitDiffs ifTrue: [ self importDiffOfCommit: commit ].
1✔
675

1✔
676
        ^ commit
1✔
677
]
1✔
678

1✔
679
{ #category : #'import - commits' }
1✔
680
GitlabModelImporter >> importCommits: aGLHProject [
1✔
681
        "limited to the last 20 commits"
1✔
682

1✔
683
        | results parsedResults params |
1✔
684
        self
1✔
685
                deprecated:
1✔
686
                'Use importLatestCommitsOfProject: instead of current one'
1✔
687
                on: '19 September 2025'
1✔
688
                in:
1✔
689
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
690
                
1✔
691
        params := { (#with_stats -> 'true') } asDictionary.
1✔
692
        results := self repoApi commits
1✔
693
                           getByPage: 1
1✔
694
                           perPage: 20
1✔
695
                           inProject: aGLHProject id
1✔
696
                           withParams: params.
1✔
697

1✔
698
        parsedResults := self parseCommitsResult: results.
1✔
699
        self glhModel addAll: parsedResults unless: self blockOnIdEquality.
1✔
700

1✔
701
        parsedResults do: [ :commit |
1✔
702
                commit repository: aGLHProject repository ].
1✔
703

1✔
704
        self withCommitDiffs ifTrue: [
1✔
705
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
1✔
706

1✔
707
        ^ parsedResults
1✔
708
]
1✔
709

1✔
710
{ #category : #'import - commits' }
1✔
711
GitlabModelImporter >> importCommitsFollowing: aCommit upToDays: aNumberOfDay [
1✔
712
        "import the 'n' commits of a project starting from an initial 'aCommit' commit. 
1✔
713
        Lazy import does not import the entities inside the model"
1✔
714

1✔
715
        | date |
1✔
716
        date := aCommit created_at asDateAndTime.
1✔
717

1✔
718
        ^ self
1✔
719
                  importCommitsOfBranch: aCommit branch
1✔
720
                  since: date
1✔
721
                  until: date + aNumberOfDay day
1✔
722
]
1✔
723

1✔
724
{ #category : #'import - commits' }
1✔
725
GitlabModelImporter >> importCommitsFromTag: fromTag toTag: toTag [ 
1✔
726
        | results commits project|
1✔
727
                
1✔
728
        (fromTag isNil or: [ toTag isNil ] ) ifTrue: [ ^ OrderedCollection new.  ] .
1✔
729

1✔
730
        project := fromTag repository project.
1✔
731
        results := self repoApi repositories compareInProject: (project id) from: fromTag name to: toTag name.
1✔
732
        
1✔
733
        commits := (NeoJSONReader fromString: results ) at: #commits ifAbsent: ['[]'].
1✔
734
        
1✔
735
        
1✔
736
        commits := self parseCommitsResult: (NeoJSONWriter toString: commits).
1✔
737
         commits := glhModel addAll: commits unless: self blockOnIdEquality.
1✔
738
        commits := project repository commits addAll: commits unless: self blockOnIdEquality.
1✔
739
        
1✔
740
        self chainsCommitsFrom: commits. 
1✔
741
        
1✔
742
        ^ commits. 
1✔
743
        
1✔
744
]
1✔
745

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

1✔
749
        | commits |
1✔
750
        "        result := self glhApi
1✔
751
                          commitsOfProject: aGLHBranch repository project id
1✔
752
                          forRefName: aGLHBranch name."
1✔
753
        commits := self
1✔
754
                           importCommitsOfBranch: aGLHBranch
1✔
755
                           since: withCommitsSince.
1✔
756

1✔
757
        self chainsCommitsFrom: commits.
1✔
758

1✔
759
        commits do: [ :aCommit |
1✔
760
                aCommit repository: aGLHBranch repository.
1✔
761
                self completeImportedCommit: aCommit ].
1✔
762
        ^ commits
1✔
763
]
1✔
764

1✔
765
{ #category : #'import - commits' }
1✔
766
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch fromCommit: anInitialCommit [
1✔
767

1✔
768
        | commits |
1✔
769
        "        result := self glhApi
1✔
770
                          commitsOfProject: aGLHBranch repository project id
1✔
771
                          forRefName: aGLHBranch name."
1✔
772
        commits := self
1✔
773
                           importCommitsOfBranch: aGLHBranch
1✔
774
                           since: anInitialCommit committed_date.
1✔
775

1✔
776
        commits do: [ :aCommit |
1✔
777
                aCommit repository: aGLHBranch repository.
1✔
778
                self completeImportedCommit: aCommit ].
1✔
779
        ^ commits
1✔
780
]
1✔
781

1✔
782
{ #category : #'import - commits' }
1✔
783
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch since: fromDate [
1✔
784

1✔
785
        ^ self importCommitsOfBranch: aGLHBranch since: fromDate until: nil
1✔
786
]
1✔
787

1✔
788
{ #category : #'import - commits' }
1✔
789
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch since: fromDate until: toDate [
1✔
790

1✔
791
        | params result allCommits |
1✔
792
        params := {
1✔
793
                          (#ref_name -> aGLHBranch name).
1✔
794
                          (#since -> (fromDate
1✔
795
                                    ifNotNil: [ fromDate asDate asDateAndTime asString ]
1✔
796
                                    ifNil: [ '' ])).
1✔
797
                          (#until -> (toDate
1✔
798
                                    ifNotNil: [ toDate asDate asDateAndTime asString ]
1✔
799
                                    ifNil: [ '' ])).
1✔
800
                          (#with_stats -> 'true') } asDictionary.
1✔
801
        result := self repoApi commits
1✔
802
                          getAllInProject: aGLHBranch repository project id
1✔
803
                          withParams: params.
1✔
804

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

1✔
808
        aGLHBranch commits addAll: allCommits unless: self blockOnIdEquality.
1✔
809

1✔
810
        self glhModel
1✔
811
                addAll: aGLHBranch commits
1✔
812
                unless: self blockOnIdEquality.
1✔
813

1✔
814
        self chainsCommitsFrom: allCommits.
1✔
815

1✔
816
        ^ allCommits
1✔
817
]
1✔
818

1✔
819
{ #category : #'import - commits' }
1✔
820
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch until: toDate [
1✔
821

1✔
822
        ^ self importCommitsOfBranch: aGLHBranch since: nil until: toDate
1✔
823
]
1✔
824

1✔
825
{ #category : #'import - commits' }
1✔
826
GitlabModelImporter >> importCommitsOfProject: aProject since: fromDate until: toDate [
1✔
827

1✔
828
        | params results allCommits |
1✔
829
        params := {
1✔
830
                          (#since
1✔
831
                           ->
1✔
832
                           (fromDate
1✔
833
                                    ifNotNil: [ fromDate asDate asDateAndTime asString ]
1✔
834
                                    ifNil: [ '' ])).
1✔
835
                          (#until
1✔
836
                           ->
1✔
837
                           (toDate
1✔
838
                                    ifNotNil: [ toDate asDate asDateAndTime asString ]
1✔
839
                                    ifNil: [ '' ])).
1✔
840
                          (#with_stats -> 'true').
1✔
841
                          (#all -> 'true') } asDictionary.
1✔
842
        results := self repoApi commits
1✔
843
                           getAllInProject: aProject id
1✔
844
                           withParams: params.
1✔
845

1✔
846
        allCommits := (results collect: [ :commitsJson |
1✔
847
                               self parseCommitsResult: commitsJson ]) flattened.
1✔
848

1✔
849
        allCommits:= aProject repository commits
1✔
850
                addAll: allCommits
1✔
851
                unless: self blockOnIdEquality.
1✔
852

1✔
853
        ^ self glhModel addAll: allCommits unless: self blockOnIdEquality
1✔
854
]
1✔
855

1✔
856
{ #category : #'import - commits' }
1✔
857
GitlabModelImporter >> importCommitsOfTag: aGLHTag [
1✔
858

1✔
859
        | taggedCommit tags commits date |
1✔
860
        self
1✔
861
                deprecated: 'Use importCommitsFromTag:toTag: instead of current one'
1✔
862
                on: '21 July 2025'
1✔
863
                in:
1✔
864
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
865
        
1✔
866
        
1✔
867
        tags := self importTagsForProject: aGLHTag repository project.
1✔
868

1✔
869

1✔
870
        taggedCommit := aGLHTag commit ifNil: [
1✔
871
                                self
1✔
872
                                        importCommit: aGLHTag target
1✔
873
                                        ofProject: aGLHTag repository project ].
1✔
874

1✔
875
        date := (tags isEmptyOrNil and: [ tags size < 2 ])
1✔
876
                        ifTrue: [ aGLHTag created_at ]
1✔
877
                        ifFalse: [ tags second commit committed_date ].
1✔
878

1✔
879
        commits := self
1✔
880
                           importParentCommitsOfCommit: taggedCommit
1✔
881
                           since: tags third created_at.
1✔
882
        commits add: taggedCommit.
1✔
883
        self chainsCommitsFrom: commits.
1✔
884

1✔
885
        ^ commits
1✔
886
]
1✔
887

1✔
888
{ #category : #'import - projects' }
1✔
889
GitlabModelImporter >> importContributedProjectsOfUser: aGLHUser [
1✔
890

1✔
891
        | remaningProjects params results projects projectsIds |
1✔
892
        params := {
1✔
893
                          (#order_by -> 'last_activity_at').
1✔
894
                          (#simple -> 'true') } asDictionary.
1✔
895
        results := self repoApi projects
1✔
896
                           contributedProjectsOfUser: aGLHUser id
1✔
897
                           withParams: params.
1✔
898

1✔
899
        projectsIds := (results collect: [ :projectsJson |
1✔
900
                             (NeoJSONReader fromString: projectsJson) collect: [:projectJson | projectJson at: #id ] ]) flattened.
1✔
901
        
1✔
902
        projects := self importProjects: projectsIds.
1✔
903
        remaningProjects := self importProjects:
1✔
904
                                    ((projects collect: #id) difference:
1✔
905
                                             ((self userCatalogue atId: aGLHUser id) at:
1✔
906
                                                      #contributedProjects)).
1✔
907

1✔
908

1✔
909
        aGLHUser contributedProjects
1✔
910
                addAll: projects , remaningProjects
1✔
911
                unless: self blockOnIdEquality.
1✔
912

1✔
913
        self userCatalogue
1✔
914
                addUser: aGLHUser
1✔
915
                withProjects: (aGLHUser contributedProjects collect: #id).
1✔
916

1✔
917
        ^ projects
1✔
918
]
1✔
919

1✔
920
{ #category : #'import - users' }
1✔
921
GitlabModelImporter >> importCreatorOfCommit: aCommit [
1✔
922

1✔
923
        aCommit commitCreator ifNil: [
1✔
924
                aCommit commitCreator:
1✔
925
                        (self importUserByUsername: aCommit author_name) ].
1✔
926
        self userCatalogue
1✔
927
                addUser: aCommit commitCreator
1✔
928
                withProject: aCommit repository project id.
1✔
929
        ^ aCommit commitCreator
1✔
930
]
1✔
931

1✔
932
{ #category : #'import - commits' }
1✔
933
GitlabModelImporter >> importDiffOfCommit: aCommit [
1✔
934

1✔
935
        | result diffsResult |
1✔
936
        aCommit diffs ifNotEmpty: [
1✔
937
                'Diff already importer: ' , aCommit short_id printString recordInfo.
1✔
938
                ^ aCommit diffs ].
1✔
939
        ('Import diff of commit: ' , aCommit short_id printString) recordInfo.
1✔
940

1✔
941
        result := self repoApi commits
1✔
942
                          diffOf: aCommit id
1✔
943
                          inProject: aCommit repository project id
1✔
944
                          uniDiff: true.
1✔
945

1✔
946
        (self isServerError: result) ifTrue: [ ^ {  } ].
1✔
947
        diffsResult := self newParseDiffResult: result.
1✔
948

1✔
949
        aCommit diffs addAll: diffsResult unless: self blockForDiffEquality.
1✔
950
        
1✔
951
        "changes are added into the model during the import"
1✔
952
        aCommit diffs do: [ :diff | self importDiffRangesForDiff: diff ].
1✔
953

1✔
954
        ^ aCommit diffs
1✔
955
]
1✔
956

1✔
957
{ #category : #'import - merge-requests' }
1✔
958
GitlabModelImporter >> importDiffOfMergeRequest: aMergeRequest [
1✔
959

1✔
960
        | result diffsResult |
1✔
961
        aMergeRequest diffs ifNotEmpty: [
1✔
962
                'Diff of already importer: '
1✔
963
                , aMergeRequest iid printString recordInfo.
1✔
964
                ^ aMergeRequest diffs ].
1✔
965
        ('Import diff commits of MR ' , aMergeRequest iid printString)
1✔
966
                recordInfo.
1✔
967
        result := self repoApi mergeRequests
1✔
968
                          diffsOf: aMergeRequest iid
1✔
969
                          inProject: aMergeRequest project_id.
1✔
970
        diffsResult := result flatCollect: [ :aResult |
1✔
971
                               self newParseDiffResult: aResult ].
1✔
972

1✔
973

1✔
974
        aMergeRequest diffs
1✔
975
                addAll: diffsResult
1✔
976
                unless: self blockForDiffEquality.
1✔
977
        self glhModel
1✔
978
                addAll: aMergeRequest diffs
1✔
979
                unless: self blockForDiffEquality.
1✔
980

1✔
981
        aMergeRequest diffs do: [ :diff | self importDiffRangesForDiff: diff ].
1✔
982

1✔
983
        ^ aMergeRequest diffs
1✔
984
]
1✔
985

1✔
986
{ #category : #'import - repositories' }
1✔
987
GitlabModelImporter >> importDirectoryFiles: aDirectoryFile OfBranch: aBranch [
1✔
988

1✔
989
        | result files apiFiles params |
1✔
990
        params := { 
1✔
991
                #ref -> aBranch name.
1✔
992
                #path -> (aDirectoryFile path , '/')
1✔
993
        } asDictionary.
1✔
994
        result := self repoApi repositories repositoryTreeOfProject: aBranch repository project id withParams: params.
1✔
995
                         " treeOfRepository: aBranch repository project id
1✔
996
                          ofBranch: aBranch name
1✔
997
                          andPath: aDirectoryFile path , '/'."
1✔
998
        apiFiles := (result collect: [ :treeJson | self parseFileTreeResult: treeJson ]) flattened.
1✔
999
        files := apiFiles collect: [ :apiFile |
1✔
1000
                         self convertApiFileAsFile: apiFile ].
1✔
1001
        
1✔
1002
        files do: [ :file |
1✔
1003
                self glhModel add: file.
1✔
1004
                aDirectoryFile addFile: file ].
1✔
1005
        
1✔
1006
        files
1✔
1007
                select: [ :file | file isKindOf: GLHFileDirectory ]
1✔
1008
                thenCollect: [ :file |
1✔
1009
                self importDirectoryFiles: file OfBranch: aBranch ]
1✔
1010
]
1✔
1011

1✔
1012
{ #category : #'import - file' }
1✔
1013
GitlabModelImporter >> importFileWithPath: aPath ofProject: aGLHProject inBranch: aBranch [ 
1✔
1014
        self flag: 'imported file need need to be store inside the model'.
1✔
1015
        ^ self repoApi repositories getRawFile: aPath ofProject: aGLHProject id withParams: {#ref -> aBranch name} asDictionary .
1✔
1016
]
1✔
1017

1✔
1018
{ #category : #'import - repositories' }
1✔
1019
GitlabModelImporter >> importFilesOfBranch: aBranch [
1✔
1020

1✔
1021
        | result files apiFiles params |
1✔
1022
        params := { 
1✔
1023
                #ref -> aBranch name.
1✔
1024
        } asDictionary.
1✔
1025
        
1✔
1026
        result := self repoApi repositories repositoryTreeOfProject: aBranch repository project id withParams: params.
1✔
1027
        
1✔
1028
                          "treeOfRepository: aBranch repository project id
1✔
1029
                          ofBranch: aBranch name
1✔
1030
                          andPath: nil."
1✔
1031
        apiFiles := (result collect: [ :filesJson | self parseFileTreeResult: filesJson  ]) flattened.
1✔
1032
        files := apiFiles collect: [ :apiFile | 
1✔
1033
                         self convertApiFileAsFile: apiFile ].
1✔
1034
        files do: [ :file | 
1✔
1035
                self glhModel add: file.
1✔
1036
                aBranch addFile: file ].
1✔
1037
        files
1✔
1038
                select: [ :file | file isKindOf: GLHFileDirectory ]
1✔
1039
                thenCollect: [ :file | 
1✔
1040
                self importDirectoryFiles: file OfBranch: aBranch ].
1✔
1041
        
1✔
1042
   ^files. 
1✔
1043
]
1✔
1044

1✔
1045
{ #category : #'import - groups' }
1✔
1046
GitlabModelImporter >> importGroup: aGroupID [
1✔
1047

1✔
1048
        | result groupResult |
1✔
1049
        ('Import group: ' , aGroupID printString) recordInfo.
1✔
1050

1✔
1051
        result := self repoApi groups get: aGroupID.
1✔
1052
        
1✔
1053
        "group: aGroupID."
1✔
1054
        groupResult := self parseGroupResult: result.
1✔
1055
        groupResult := self addGroupResultToModel: groupResult.
1✔
1056

1✔
1057
        groupResult projects do: [ :project |
1✔
1058
                self completeImportedProject: project ].
1✔
1059

1✔
1060
        (self subGroupsOf: aGroupID) do: [ :subGroup |
1✔
1061
                
1✔
1062
                groupResult subGroups
1✔
1063
                        add: (self importGroup: subGroup id)
1✔
1064
                        unless: self blockOnIdEquality ].
1✔
1065
        ^ groupResult
1✔
1066
]
1✔
1067

1✔
1068
{ #category : #'import - jobs' }
1✔
1069
GitlabModelImporter >> importJobsOf: aPipeline [
1✔
1070

1✔
1071
        | jobs results |
1✔
1072
        results := self repoApi jobs
1✔
1073
                           getAllForPipeline: aPipeline id
1✔
1074
                           inProject: aPipeline project id.
1✔
1075
        "jobsOfProject: aPipeline project id
1✔
1076
                          ofPipelines: aPipeline id."
1✔
1077
        jobs := (results collect: [ :jobsJson |
1✔
1078
                         self parseJobsResult: jobsJson ]) flattened.
1✔
1079

1✔
1080

1✔
1081
        jobs := self glhModel addAll: jobs unless: self blockOnIdEquality.
1✔
1082
        jobs := aPipeline jobs addAll: jobs unless: self blockOnIdEquality.
1✔
1083

1✔
1084

1✔
1085
        jobs do: [ :job |
1✔
1086
                self completeImportedJob: job ].
1✔
1087

1✔
1088
        ^ jobs
1✔
1089
]
1✔
1090

1✔
1091
{ #category : #'import - commits' }
1✔
1092
GitlabModelImporter >> importLatestCommitsOfProject: aGLHProject [
1✔
1093
        "limited to the last 50 commits"
1✔
1094

1✔
1095
        | results parsedResults params |
1✔
1096
        params := { 
1✔
1097
                #with_stats -> 'true'.
1✔
1098
                #all -> true
1✔
1099
         } asDictionary.
1✔
1100
        results := self repoApi commits getByPage: 1 perPage: 50 inProject: aGLHProject id withParams: params.
1✔
1101

1✔
1102
        parsedResults := self parseCommitsResult: results.
1✔
1103
        parsedResults := self glhModel
1✔
1104
                                 addAll: parsedResults
1✔
1105
                                 unless: self blockOnIdEquality.
1✔
1106

1✔
1107
        aGLHProject repository commits
1✔
1108
                addAll: parsedResults
1✔
1109
                unless: self blockOnIdEquality.
1✔
1110

1✔
1111
        self withCommitDiffs ifTrue: [
1✔
1112
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
1✔
1113

1✔
1114
        ^ parsedResults
1✔
1115
]
1✔
1116

1✔
1117
{ #category : #'import - merge-requests' }
1✔
1118
GitlabModelImporter >> importLatestMergeRequestsOfProject: aGLHProject [ 
1✔
1119
        
1✔
1120
        |results parsedResults|
1✔
1121
        results := self repoApi mergeRequests getByPage: 1 perPage: 20  inProject: aGLHProject id. 
1✔
1122
        parsedResults := self parseMergeRequestsResult: results. 
1✔
1123
        
1✔
1124
        parsedResults := glhModel addAll: parsedResults unless: self blockOnIdEquality.
1✔
1125
        parsedResults := aGLHProject mergeRequests addAll: parsedResults unless: self blockOnIdEquality.
1✔
1126
        ^ parsedResults.
1✔
1127
]
1✔
1128

1✔
1129
{ #category : #'import - pipelines' }
1✔
1130
GitlabModelImporter >> importLatestPipelinesOfProject: aGLHProject [ 
1✔
1131
        (self pipelinesOf: aGLHProject id withLimit:20) do: [ :pipeline |
1✔
1132
                |pip|
1✔
1133
                pip := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1134
                pip := aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
1135
                self completeImportedPipeline: pip. 
1✔
1136
                ].
1✔
1137
        
1✔
1138
        ^ aGLHProject pipelines 
1✔
1139
]
1✔
1140

1✔
1141
{ #category : #'import - releases' }
1✔
1142
GitlabModelImporter >> importLatestReleaseOfProject: aGLHProject [ 
1✔
1143
        
1✔
1144
        |result foundRelease|
1✔
1145
        result := repoApi releases getLatestOfProject: aGLHProject id.
1✔
1146
        foundRelease := self parseReleaseResult: result. 
1✔
1147

1✔
1148
        foundRelease := glhModel add: foundRelease unless: self blockOnNameEquality.
1✔
1149
        foundRelease := aGLHProject releases add: foundRelease unless: self blockOnNameEquality.
1✔
1150

1✔
1151
        foundRelease author: (self importUser: foundRelease author id). 
1✔
1152
        
1✔
1153
        ^ foundRelease.
1✔
1154
]
1✔
1155

1✔
1156
{ #category : #'import - merge-requests' }
1✔
1157
GitlabModelImporter >> importMergeRequestCommits: aGLPHEMergeRequest [
1✔
1158

1✔
1159
        | commits result |
1✔
1160
        aGLPHEMergeRequest commits ifNotNil: [ ^ aGLPHEMergeRequest commits ].
1✔
1161
        
1✔
1162
        result := self repoApi mergeRequests commitsOf: aGLPHEMergeRequest iid inProject: aGLPHEMergeRequest project id.
1✔
1163
        
1✔
1164
        commits := (result collect: [ :commitsJson | self parseCommitsResult: commitsJson ]) flattened.
1✔
1165
        commits := commits collect: [ :commit | self importCommit: commit id ofProject: aGLPHEMergeRequest project ].
1✔
1166
        aGLPHEMergeRequest commits: commits.
1✔
1167

1✔
1168

1✔
1169
        ^ commits
1✔
1170
]
1✔
1171

1✔
1172
{ #category : #'import - merge-requests' }
1✔
1173
GitlabModelImporter >> importMergeRequestMergeCommits: aGLPHEMergeRequest [
1✔
1174

1✔
1175
        | foundCommits |
1✔
1176
        foundCommits := OrderedCollection new.
1✔
1177

1✔
1178
        ('Import commit sha of MR:  ' , aGLPHEMergeRequest iid printString)
1✔
1179
                recordInfo.
1✔
1180
        "the founds commits are added to the model during their respective import"
1✔
1181
        aGLPHEMergeRequest mergeRequestCommit: ((self
1✔
1182
                          importCommitOfProject: aGLPHEMergeRequest project
1✔
1183
                          withId: aGLPHEMergeRequest sha) ifNotNil: [ :commit |
1✔
1184
                         foundCommits add: commit ]).
1✔
1185

1✔
1186
        ('Import commit merge_commit_sha of MR:  '
1✔
1187
         , aGLPHEMergeRequest iid printString) recordInfo.
1✔
1188
        aGLPHEMergeRequest mergedCommit: ((self
1✔
1189
                          importCommitOfProject: aGLPHEMergeRequest project
1✔
1190
                          withId: aGLPHEMergeRequest merge_commit_sha) ifNotNil: [ :commit |
1✔
1191
                         foundCommits add: commit ]).
1✔
1192

1✔
1193
        ('Import commit squash_commit_sha of MR:  '
1✔
1194
         , aGLPHEMergeRequest iid printString) recordInfo.
1✔
1195
        aGLPHEMergeRequest squashCommit: ((self
1✔
1196
                          importCommitOfProject: aGLPHEMergeRequest project
1✔
1197
                          withId: aGLPHEMergeRequest squash_commit_sha) ifNotNil: [ :commit |
1✔
1198
                         foundCommits add: commit ]).
1✔
1199

1✔
1200

1✔
1201
        self chainsCommitsFrom: foundCommits.
1✔
1202
        ^ foundCommits
1✔
1203
]
1✔
1204

1✔
1205
{ #category : #'import - pipelines' }
1✔
1206
GitlabModelImporter >> importMergeRequestPipelines: aGLHMergeRequest [ 
1✔
1207
        "default limit to one page with last 100 pipelines"
1✔
1208
        
1✔
1209
        |results parseResults|
1✔
1210
        
1✔
1211
        results := self repoApi pipelines getByPage: 1 perPage: 100 inProject: aGLHMergeRequest project id forMergerRequestIid: aGLHMergeRequest iid. 
1✔
1212
        
1✔
1213
        parseResults := self parsePipelinesResult: results.
1✔
1214
        
1✔
1215
        parseResults := glhModel addAll: parseResults unless: self blockOnIdEquality.
1✔
1216
        parseResults := aGLHMergeRequest pipelines addAll: parseResults unless: self blockOnIdEquality.
1✔
1217
        ^ parseResults collect: [ :pip | self completeImportedPipeline: pip ]  .
1✔
1218
        
1✔
1219
]
1✔
1220

1✔
1221
{ #category : #'import - merge-requests' }
1✔
1222
GitlabModelImporter >> importMergeRequestsOfProject: aGLHProject [
1✔
1223

1✔
1224
        | results parsedResults mrs |
1✔
1225
        ('Import merge request of Project: ' , aGLHProject id printString)
1✔
1226
                recordInfo.
1✔
1227

1✔
1228
        results := self repoApi mergeRequests getAllOfProject: aGLHProject id.
1✔
1229
        parsedResults := (results collect: [ :projectsJson | self parseMergeRequestsResult: projectsJson ]) flattened. 
1✔
1230

1✔
1231
        aGLHProject mergeRequests
1✔
1232
                addAll: parsedResults
1✔
1233
                unless: self blockOnIdEquality.
1✔
1234

1✔
1235
        mrs := self glhModel
1✔
1236
                       addAll: aGLHProject mergeRequests
1✔
1237
                       unless: self blockOnIdEquality.
1✔
1238

1✔
1239

1✔
1240
        "gets it related commits"
1✔
1241
        aGLHProject mergeRequests do: [ :mr |
1✔
1242
                self importMergeRequestMergeCommits: mr ].
1✔
1243

1✔
1244

1✔
1245
        self withCommitDiffs ifTrue: [
1✔
1246
                aGLHProject mergeRequests do: [ :mr |
1✔
1247
                        self importDiffOfMergeRequest: mr ] ].
1✔
1248

1✔
1249
        ^ mrs
1✔
1250
]
1✔
1251

1✔
1252
{ #category : #'import - merge-requests' }
1✔
1253
GitlabModelImporter >> importMergeRequestsOfProject: aGLHProject since: fromDate until: toDate [
1✔
1254

1✔
1255
        | params result mergeRequests |
1✔
1256
        ('import MR of Project ' , aGLHProject name) recordInfo.
1✔
1257
        params := {
1✔
1258
                          (#created_after
1✔
1259
                           ->
1✔
1260
                           (fromDate
1✔
1261
                                    ifNotNil: [ fromDate asDateAndTime asString ]
1✔
1262
                                    ifNil: [ '' ])).
1✔
1263
                          (#created_before
1✔
1264
                           ->
1✔
1265
                           (toDate
1✔
1266
                                    ifNotNil: [ toDate asDateAndTime asString ]
1✔
1267
                                    ifNil: [ '' ])).
1✔
1268
                          (#scope -> 'all') } asDictionary.
1✔
1269

1✔
1270
        result := self repoApi mergeRequests
1✔
1271
                          getAllOfProject: aGLHProject id
1✔
1272
                          withParams: params.
1✔
1273
        mergeRequests := (result collect: [ :mergeRequestsJson |
1✔
1274
                                  self parseMergeRequestsResult: mergeRequestsJson ])
1✔
1275
                                 flattened.
1✔
1276

1✔
1277
        aGLHProject mergeRequests
1✔
1278
                addAll: mergeRequests
1✔
1279
                unless: self blockOnIdEquality.
1✔
1280

1✔
1281
        "gets it related commits"
1✔
1282
        aGLHProject mergeRequests do: [ :mr |
1✔
1283
                self importMergeRequestMergeCommits: mr ].
1✔
1284

1✔
1285
        self withCommitDiffs ifTrue: [
1✔
1286
                aGLHProject mergeRequests do: [ :mr |
1✔
1287
                        self importDiffOfMergeRequest: mr ] ].
1✔
1288

1✔
1289
        self glhModel
1✔
1290
                addAll: mergeRequests
1✔
1291
                unless: (self blockEqualityOn: #iid).
1✔
1292

1✔
1293
        ^ mergeRequests
1✔
1294
]
1✔
1295

1✔
1296
{ #category : #'import - merge-requests' }
1✔
1297
GitlabModelImporter >> importMergeResquestApprovals: aGLPHEMergeRequest [
1✔
1298

1✔
1299
        | results parsedResult |
1✔
1300
        (String streamContents: [ :str |
1✔
1301
                 str << 'Check approvals of '.
1✔
1302
                 aGLPHEMergeRequest printOn: str ]) recordInfo.
1✔
1303
        results := self repoApi mergeRequests approvalsOf: aGLPHEMergeRequest iid inProject: aGLPHEMergeRequest project id.
1✔
1304

1✔
1305
        parsedResult := generalReader
1✔
1306
                                on: results readStream;
1✔
1307
                                next.
1✔
1308

1✔
1309
        (parsedResult at: #approved_by) do: [ :approvedUser |
1✔
1310
                aGLPHEMergeRequest addApproved_by:
1✔
1311
                        (self importUser: ((approvedUser at: #user) at: #id)) ].
1✔
1312
        aGLPHEMergeRequest approved: (parsedResult at: #approved).
1✔
1313
        ^ aGLPHEMergeRequest
1✔
1314
]
1✔
1315

1✔
1316
{ #category : #'import - merge-requests' }
1✔
1317
GitlabModelImporter >> importMergeResquestAuthor: aGLPHEMergeRequest [
1✔
1318

1✔
1319
        | authorID |
1✔
1320
        aGLPHEMergeRequest author ifNotNil: [ ^ aGLPHEMergeRequest author ].
1✔
1321
        authorID := aGLPHEMergeRequest cacheAt: #authorID ifAbsent: [
1✔
1322
                            | result |
1✔
1323
                            result := self repoApi mergeRequests
1✔
1324
                                              get: aGLPHEMergeRequest iid
1✔
1325
                                              inProject: aGLPHEMergeRequest project_id.
1✔
1326

1✔
1327
                            (generalReader
1✔
1328
                                     on: result readStream;
1✔
1329
                                     next) at: #author at: #id ].
1✔
1330
        ^aGLPHEMergeRequest author: (self importUser: authorID)
1✔
1331
]
1✔
1332

1✔
1333
{ #category : #'import - merge-requests' }
1✔
1334
GitlabModelImporter >> importMergeResquestMerger: aGLPHEMergeRequest [
1✔
1335

1✔
1336
        | authorID |
1✔
1337
        aGLPHEMergeRequest merge_user ifNotNil: [
1✔
1338
                ^ aGLPHEMergeRequest merge_user ].
1✔
1339
        authorID := aGLPHEMergeRequest cacheAt: #mergeUserID ifAbsent: [
1✔
1340
                            | result |
1✔
1341
                            result := self repoApi mergeRequests
1✔
1342
                                              get: aGLPHEMergeRequest iid
1✔
1343
                                              inProject: aGLPHEMergeRequest project_id.
1✔
1344
                            (generalReader
1✔
1345
                                     on: result readStream;
1✔
1346
                                     next)
1✔
1347
                                    at: #merge_user
1✔
1348
                                    ifPresent: [ :mergeUser |
1✔
1349
                                    mergeUser ifNotNil: [ :mruser | mruser at: #id ] ] ].
1✔
1350
        ^aGLPHEMergeRequest merge_user: (self importUser: authorID)
1✔
1351
]
1✔
1352

1✔
1353
{ #category : #'import - notes' }
1✔
1354
GitlabModelImporter >> importNotesOfMergeRequest: mergeRequest [
1✔
1355
        | results notes |
1✔
1356
        
1✔
1357
        results := self repoApi notes allInMergeRequest: mergeRequest iid ofProject: mergeRequest project id.
1✔
1358
        
1✔
1359
        notes := results collect: [ :note | 
1✔
1360
                self parseNoteJson: note ].
1✔
1361
        "notes := self parseNoteJson: results."
1✔
1362
        notes do: [ :tabNotes | tabNotes do: [ :note |
1✔
1363
                        note author: (self importUser: (note author at: #id)).
1✔
1364
                        note name: note id asString]. ].
1✔
1365
        notes := notes flattened.
1✔
1366
        notes := self glhModel addAll: notes unless: self blockOnIdEquality. 
1✔
1367
        notes := mergeRequest note addAll: notes unless: self blockOnIdEquality. 
1✔
1368
        ^notes
1✔
1369
        
1✔
1370
]
1✔
1371

1✔
1372
{ #category : #'import - commits' }
1✔
1373
GitlabModelImporter >> importParentCommitsOfCommit: aGLHCommit since: aDate [
1✔
1374

1✔
1375
        | parentsIds commits |
1✔
1376
        commits := Set new.
1✔
1377
        aGLHCommit created_at asDateAndTime < aDate asDateAndTime ifTrue: [
1✔
1378
                 
1✔
1379
                ^ commits
1✔
1380
                          add: aGLHCommit;
1✔
1381
                          yourself ].
1✔
1382

1✔
1383
        parentsIds := aGLHCommit parent_ids.
1✔
1384

1✔
1385
        commits addAll: (parentsIds collect: [ :id |
1✔
1386
                         self
1✔
1387
                                 importCommit: id ofProject: aGLHCommit repository project  ]).
1✔
1388

1✔
1389
        
1✔
1390
        commits addAll: (commits collect: [ :parentCommit |
1✔
1391
                   self importParentCommitsOfCommit: parentCommit since: aDate ]).
1✔
1392

1✔
1393
        ^ commits flattened asSet. 
1✔
1394
]
1✔
1395

1✔
1396
{ #category : #'import - pipelines' }
1✔
1397
GitlabModelImporter >> importPipeline: pipelineId OfProject: aGLHProject [
1✔
1398

1✔
1399
        
1✔
1400
        | result pipeline|
1✔
1401
        
1✔
1402
        aGLHProject pipelines detect: [ :pip | pip id = pipelineId ] ifOne: [ :pip| ^pip ].
1✔
1403
        
1✔
1404
        ('Search pipelines of: ' , aGLHProject id printString) recordInfo.
1✔
1405
        result := self repoApi pipelines get: pipelineId inProject: aGLHProject id.
1✔
1406
        result isString ifTrue: [ ^ self parsePipelineResult: result ].
1✔
1407

1✔
1408
        pipeline :=  self parsePipelineResult: result.
1✔
1409

1✔
1410
        pipeline := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1411
        pipeline := aGLHProject pipelines add: pipeline unless: self blockOnIdEquality.
1✔
1412
        
1✔
1413
        ^ self completeImportedPipeline: pipeline. 
1✔
1414
]
1✔
1415

1✔
1416
{ #category : #'import - pipelines' }
1✔
1417
GitlabModelImporter >> importPipelinesOfProject: aGLHProject [
1✔
1418

1✔
1419
        self flag: 'WARNING: this import ALL the pipelines at ones. Prefered ImportLatestPipleinesOfProject: for faster performance (if possible)'. 
1✔
1420
        ^ self importAllPipelinesOfProject: aGLHProject
1✔
1421
]
1✔
1422

1✔
1423
{ #category : #'import - pipelines' }
1✔
1424
GitlabModelImporter >> importPipelinesOfProject: aGLHProject after: after andBefore: before [
1✔
1425
        ^ (self pipelinesOf: aGLHProject id after: after andBefore: before) collect: [ :pipeline |
1✔
1426
                |pip|
1✔
1427
                pip := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1428
                pip := aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
1429
                
1✔
1430
                ].
1✔
1431
        
1✔
1432
]
1✔
1433

1✔
1434
{ #category : #'import - pipelines' }
1✔
1435
GitlabModelImporter >> importPipelinesOfProject: aGLHProject after: after andBefore: before onBranch: aBranch [
1✔
1436
        | result parsedResults|
1✔
1437
        ('Search pipelines of: ' , aGLHProject id printString) recordInfo.
1✔
1438
        
1✔
1439
        result := self repoApi pipelines getAllInProject: aGLHProject id 
1✔
1440
                                                                                                withParams: {        #updated_before -> before.
1✔
1441
                                                                                                                                        #updated_after -> after.
1✔
1442
                                                                                                                                        #ref -> aBranch name} asDictionary .
1✔
1443
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
1✔
1444

1✔
1445
        parsedResults := (result collect: [ :pipelinesJson |
1✔
1446
                           self parsePipelinesResult: pipelinesJson ]) flattened.
1✔
1447
        
1✔
1448

1✔
1449
        ^ parsedResults collect: [ :pipeline |
1✔
1450
                |pip|
1✔
1451
                pip := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1452
                aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
1453
                ].
1✔
1454
        
1✔
1455
]
1✔
1456

1✔
1457
{ #category : #'import - projects' }
1✔
1458
GitlabModelImporter >> importProject: aProjectID [
1✔
1459

1✔
1460
        | result projectResult |
1✔
1461
        ('Import project with id:  ' , aProjectID printString) recordInfo.
1✔
1462

1✔
1463
        (glhModel allWithType: GLHProject)
1✔
1464
                detect: [ :project | project id = aProjectID ]
1✔
1465
                ifFound: [ :project | ^ project ].
1✔
1466

1✔
1467
        result := self repoApi projects get: aProjectID.
1✔
1468
        projectResult := self parseProjectResult: result.
1✔
1469

1✔
1470
        ^ self completeImportedProject: projectResult
1✔
1471
]
1✔
1472

1✔
1473
{ #category : #'import - projects' }
1✔
1474
GitlabModelImporter >> importProjects [
1✔
1475

1✔
1476
        | result projects |
1✔
1477
        ('import all Projects') recordInfo.
1✔
1478

1✔
1479

1✔
1480
        result := self repoApi projects all.
1✔
1481
        projects := (result collect: [ :projectsJson | self parseArrayOfProject: projectsJson ]) flattened.
1✔
1482
        
1✔
1483
        self glhModel addAll: projects unless: self blockOnIdEquality.
1✔
1484

1✔
1485
        ^ projects
1✔
1486
]
1✔
1487

1✔
1488
{ #category : #'import - projects' }
1✔
1489
GitlabModelImporter >> importProjectsSince: since [
1✔
1490
        "heavy import of all projects"
1✔
1491

1✔
1492
        "copy import from commits"
1✔
1493

1✔
1494
        | newlyFoundProjects page foundProject amount |
1✔
1495
        ('import all Projects since: ' , since printString) recordInfo.
1✔
1496

1✔
1497
        "number of projects per page"
1✔
1498
        amount := 100.
1✔
1499
        page := 0.
1✔
1500
        foundProject := OrderedCollection new.
1✔
1501
        newlyFoundProjects := { true }.
1✔
1502
        [ newlyFoundProjects isNotEmpty ] whileTrue: [
1✔
1503
                | results |
1✔
1504
                page := page + 1.
1✔
1505
                ('import projects page #' , page printString) recordInfo.
1✔
1506

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

1✔
1509
                newlyFoundProjects := self glhModel
1✔
1510
                                              addAll: (self parseArrayOfProject: results)
1✔
1511
                                              unless: self blockOnIdEquality.
1✔
1512
                foundProject addAll: newlyFoundProjects ].
1✔
1513
]
1✔
1514

1✔
1515
{ #category : #'import - repositories' }
1✔
1516
GitlabModelImporter >> importRepository: aGLHRepository [
1✔
1517

1✔
1518
        | branches |
1✔
1519
        [
1✔
1520
        ('import the repository of project ' , aGLHRepository project name)
1✔
1521
                recordInfo.
1✔
1522
        branches := self importBranchesOf: aGLHRepository project.
1✔
1523
        self withFiles ifTrue: [
1✔
1524
                branches do: [ :branch | self importFilesOfBranch: branch ] ] ]
1✔
1525
                on: NeoJSONParseError
1✔
1526
                do: [
1✔
1527
                self inform: aGLHRepository project name , ' has no repository' ].
1✔
1528

1✔
1529
        withInitialCommits ifTrue: [
1✔
1530
                aGLHRepository branches do: [ :branch |
1✔
1531
                        self importCommitsOfBranch: branch ] ]
1✔
1532
]
1✔
1533

1✔
1534
{ #category : #'import - commits' }
1✔
1535
GitlabModelImporter >> importSZZFromCommit: aCommit [
1✔
1536

1✔
1537
        | diffRanges diffs szzCommits |
1✔
1538
        szzCommits := Set new.
1✔
1539
        diffs := self importDiffOfCommit: aCommit.
1✔
1540
        diffRanges := diffs flatCollect: #diffRanges.
1✔
1541
        diffRanges do: [ :range |
1✔
1542
                | blames |
1✔
1543
                blames := NeoJSONReader fromString: (self repoApi repositories
1✔
1544
                                           getBlameOf: range diff new_path
1✔
1545
                                           inRef: aCommit id
1✔
1546
                                           start: range start
1✔
1547
                                           end: range end
1✔
1548
                                           ofProject: aCommit repository project id).
1✔
1549
                blames collect: [ :blame |
1✔
1550
                        blame isDictionary ifTrue: [
1✔
1551
                                szzCommits add: (self
1✔
1552
                                                 importCommit: (blame at: #commit at: #id)
1✔
1553
                                                 ofProject: aCommit repository project) ] ] ].
1✔
1554
        ^ szzCommits
1✔
1555
]
1✔
1556

1✔
1557
{ #category : #'import - tags' }
1✔
1558
GitlabModelImporter >> importTagsForProject: aProject [ 
1✔
1559
        |results tags |
1✔
1560
        results  := repoApi tags getAllOfProject: aProject id.
1✔
1561
        "get a group of tags"
1✔
1562
        tags := results flatCollect: [ :result |
1✔
1563
                        self parseTagsResult: result. 
1✔
1564
                 ].
1✔
1565

1✔
1566
        "add the tags inside the model"
1✔
1567
        tags := glhModel addAll: tags unless: self blockOnNameEquality.
1✔
1568
        tags := aProject repository tags addAll: tags unless: self blockOnNameEquality.
1✔
1569
        
1✔
1570
        "update tag's commit if already imported"
1✔
1571
        tags do: [ :tag |
1✔
1572
                tag commit: (self importCommit: tag commit id ofProject: aProject).
1✔
1573
                 ].
1✔
1574
        
1✔
1575
        "update tag's release if already imported"
1✔
1576
        tags do: [ :tag |
1✔
1577
                |release|
1✔
1578
                tag release ifNotNil: [ 
1✔
1579
                        release := glhModel add: tag release unless: (self blockEqualityOn: #tag_name).
1✔
1580
                        release := aProject releases add: tag release unless: (self blockEqualityOn: #tag_name).
1✔
1581
                        tag release: release. 
1✔
1582
                         ].
1✔
1583
                 ].
1✔
1584
        
1✔
1585
        ^ tags
1✔
1586
]
1✔
1587

1✔
1588
{ #category : #'import - users' }
1✔
1589
GitlabModelImporter >> importUser: aUserID [
1✔
1590

1✔
1591
        | result userResult |
1✔
1592
        (self glhModel allWithType: GLHUser)
1✔
1593
                detect: [ :user | user id = aUserID ]
1✔
1594
                ifFound: [ :user | ^ user ].
1✔
1595
        ('Import user: ' , aUserID printString) recordInfo.
1✔
1596
        
1✔
1597
        result := self repoApi users get: aUserID.
1✔
1598
        userResult := self parseUserResult: result.
1✔
1599
        
1✔
1600
        userResult := self glhModel add: userResult unless: self blockOnIdEquality.
1✔
1601
        userCatalogue addUser: userResult.
1✔
1602
        ^ userResult 
1✔
1603
]
1✔
1604

1✔
1605
{ #category : #'import - users' }
1✔
1606
GitlabModelImporter >> importUserByUsername: anUsername [
1✔
1607

1✔
1608
        | dicUsername resultUser |
1✔
1609
        dicUsername := ((self glhModel allWithType: GLHUser) collect: [ :user |
1✔
1610
                                user username -> user ]) asSet asDictionary.
1✔
1611

1✔
1612
        dicUsername addAll: self userCatalogue collectUsernames.
1✔
1613

1✔
1614

1✔
1615
        resultUser := dicUsername
1✔
1616
                              at: anUsername
1✔
1617
                              ifAbsent: [ "thus we have to import this new user"
1✔
1618
                                      | result userId searchResult params |
1✔
1619
                                      ('Import user with username: '
1✔
1620
                                       , anUsername printString) recordInfo.
1✔
1621
                                      params := { (#search -> anUsername) } asDictionary.
1✔
1622
                                      result := self repoApi users allWithParams: params.
1✔
1623
                                                        
1✔
1624
                                                         "when result is an error"
1✔
1625
                                                         (result isString) ifTrue: [ result := { result } ].
1✔
1626
                                                        
1✔
1627
                                      searchResult := result ifEmpty: [ result ] ifNotEmpty: [(result collect: [ :usersJson |
1✔
1628
                                                               NeoJSONReader fromString: usersJson ]) first].
1✔
1629
                                                         
1✔
1630
                                      (searchResult class = Dictionary and: [
1✔
1631
                                               (searchResult at: #message) includesSubstring:
1✔
1632
                                                       '403 Forbidden' ])
1✔
1633
                                              ifTrue: [ "if the result is an 403 error we fake a new user"
1✔
1634
                                                      self glhModel
1✔
1635
                                                              add: (GLHUser new
1✔
1636
                                                                               username: anUsername;
1✔
1637
                                                                               name: anUsername;
1✔
1638
                                                                               yourself)
1✔
1639
                                                              unless: [ :nu :ou | nu username = ou username ] ]
1✔
1640
                                              ifFalse: [
1✔
1641
                                                      searchResult
1✔
1642
                                                              ifEmpty: [ "results can be empty thus we force a new user with the info we have "
1✔
1643
                                                                      self glhModel
1✔
1644
                                                                              add: (GLHUser new
1✔
1645
                                                                                               username: anUsername;
1✔
1646
                                                                                               name: anUsername;
1✔
1647
                                                                                               yourself)
1✔
1648
                                                                              unless: [ :nu :ou | nu username = ou username ] ]
1✔
1649
                                                              ifNotEmpty: [ "because we may already have the researched user, we look by ID in the model"
1✔
1650
                                                                      userId := searchResult first at: #id.
1✔
1651
                                                                      (self glhModel allWithType: GLHUser)
1✔
1652
                                                                              detect: [ :user | user id = userId ]
1✔
1653
                                                                              ifNone: [ self importUser: userId ] ] ] ].
1✔
1654

1✔
1655
        self userCatalogue addUser: resultUser withName: anUsername.
1✔
1656

1✔
1657
        ^ resultUser
1✔
1658
]
1✔
1659

1✔
1660
{ #category : #initialization }
1✔
1661
GitlabModelImporter >> initReader [
1✔
1662
        
1✔
1663
        "add specific reader for this importer here"
1✔
1664
        super initReader
1✔
1665
]
1✔
1666

1✔
1667
{ #category : #initialization }
1✔
1668
GitlabModelImporter >> initialize [
1✔
1669

1✔
1670
        super initialize.
1✔
1671
        withCommitDiffs := true.
1✔
1672
        withInitialCommits := false.
1✔
1673
        withInitialMergeRequest := false.
1✔
1674

1✔
1675
        self withCommitsSince: 1 week.
1✔
1676

1✔
1677
        
1✔
1678
]
1✔
1679

1✔
1680
{ #category : #private }
1✔
1681
GitlabModelImporter >> isServerError: aString [
1✔
1682
        ^ aString = '{"message":"500 Internal Server Error"}'
1✔
1683
]
1✔
1684

1✔
1685
{ #category : #'import - projects' }
1✔
1686
GitlabModelImporter >> loadAllProjectsFromRepositorySoftware [
1✔
1687
        "heavy import that load all the active project inside the model. Only import the project entities"
1✔
1688
        |projects|
1✔
1689
        
1✔
1690
        projects := self repoApi projects. 
1✔
1691
]
1✔
1692

1✔
1693
{ #category : #'private - parsing' }
1✔
1694
GitlabModelImporter >> newParseCommitResult: result [
1✔
1695

1✔
1696
        generalReader  on: result readStream.
1✔
1697

1✔
1698
        ^ generalReader nextAs: GLHCommit
1✔
1699
]
1✔
1700

1✔
1701
{ #category : #'private - parsing' }
1✔
1702
GitlabModelImporter >> newParseDiffResult: result [
1✔
1703

1✔
1704
        generalReader on: result readStream.
1✔
1705
        ^ generalReader nextAs: #ArrayOfDiff
1✔
1706
]
1✔
1707

1✔
1708
{ #category : #'private - parsing' }
1✔
1709
GitlabModelImporter >> parseArrayOfProject: arrayOfProjects [
1✔
1710

1✔
1711
        | reader |
1✔
1712
        reader := generalReader on: arrayOfProjects readStream.
1✔
1713
        
1✔
1714
        ^ reader nextAs: #ArrayOfProject
1✔
1715
]
1✔
1716

1✔
1717
{ #category : #'private - parsing' }
1✔
1718
GitlabModelImporter >> parseBranchesResult: result [
1✔
1719

1✔
1720
        | reader |
1✔
1721
        reader := generalReader on: result readStream.
1✔
1722

1✔
1723

1✔
1724
        ^ reader nextAs: #ArrayOfBranch
1✔
1725
]
1✔
1726

1✔
1727
{ #category : #'private - parsing' }
1✔
1728
GitlabModelImporter >> parseBranchesResult: result ofProject: aGLHProject [
1✔
1729

1✔
1730
        | reader |
1✔
1731
        self
1✔
1732
                deprecated: 'Use parseBranchesResult: instead of current one'
1✔
1733
                on: '23 September 2025'
1✔
1734
                in:
1✔
1735
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
1736

1✔
1737

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

1✔
1741
        reader for: GLHBranch do: [ :mapping |
1✔
1742
                mapping
1✔
1743
                        mapProperty: #commit
1✔
1744
                        getter: [  ]
1✔
1745
                        setter: [ :branch :rawCommit |
1✔
1746
                                branch sha: (rawCommit at: #id)
1✔
1747
                                "commit := self
1✔
1748
                                                  importCommit: (rawCommit at: #id)
1✔
1749
                                                  ofProject: aGLHProject.
1✔
1750
                                branch commits add: commit unless: self blockOnIdEquality " ] ].
1✔
1751

1✔
1752
        reader
1✔
1753
                for: #ArrayOfBranch
1✔
1754
                customDo: [ :customMappting |
1✔
1755
                customMappting listOfElementSchema: GLHBranch ].
1✔
1756

1✔
1757
        ^ reader nextAs: #ArrayOfBranch
1✔
1758
]
1✔
1759

1✔
1760
{ #category : #'private - parsing' }
1✔
1761
GitlabModelImporter >> parseCommitResult: result [
1✔
1762

1✔
1763
        | reader |
1✔
1764
        reader := NeoJSONReader on: result readStream.
1✔
1765

1✔
1766
        reader for: GLHCommit do: [ :mapping |
1✔
1767
                mapping mapInstVars:
1✔
1768
                        #( id short_id title author_name author_email committer_name
1✔
1769
                           committer_email message web_url ).
1✔
1770
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
1771
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
1772
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
1773
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
1774
                mapping
1✔
1775
                        mapProperty: 'stats'
1✔
1776
                        getter: [ :el | "Not used" ]
1✔
1777
                        setter: [ :commit :value |
1✔
1778
                                commit deletions: (value at: #deletions).
1✔
1779
                                commit additions: (value at: #additions) ] ].
1✔
1780

1✔
1781
        reader for: DateAndTime customDo: [ :mapping |
1✔
1782
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
1783

1✔
1784
        reader
1✔
1785
                for: #ArrayOfIds
1✔
1786
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
1787

1✔
1788

1✔
1789
        ^ reader nextAs: GLHCommit
1✔
1790
]
1✔
1791

1✔
1792
{ #category : #'private - parsing' }
1✔
1793
GitlabModelImporter >> parseCommitsResult: result [
1✔
1794

1✔
1795
        | reader |
1✔
1796
        reader := NeoJSONReader on: result readStream.
1✔
1797

1✔
1798
          reader for: GLHCommit do: [ :mapping |
1✔
1799
                mapping mapInstVars:
1✔
1800
                        #( id short_id title author_name author_email committer_name
1✔
1801
                           committer_email message web_url ).
1✔
1802
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
1803
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
1804
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
1805
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
1806
                mapping
1✔
1807
                        mapProperty: 'stats'
1✔
1808
                        getter: [ :el | "Not used" ]
1✔
1809
                        setter: [ :commit :value |
1✔
1810
                                commit deletions: (value at: #deletions).
1✔
1811
                                commit additions: (value at: #additions) ] ].
1✔
1812

1✔
1813
        reader for: DateAndTime customDo: [ :mapping |
1✔
1814
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
1815

1✔
1816
        reader
1✔
1817
                for: #ArrayOfIds
1✔
1818
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
1819
  
1✔
1820
        reader
1✔
1821
                for: #ArrayOfCommit
1✔
1822
                customDo: [ :customMappting |
1✔
1823
                customMappting listOfElementSchema: GLHCommit ].
1✔
1824

1✔
1825
        ^ reader nextAs: #ArrayOfCommit
1✔
1826
]
1✔
1827

1✔
1828
{ #category : #private }
1✔
1829
GitlabModelImporter >> parseDiffResult: result [
1✔
1830

1✔
1831
        | reader |
1✔
1832
        self
1✔
1833
                deprecated: 'Use #newParseDiffResult: instead'
1✔
1834
                on: '28 June 2024'
1✔
1835
                in:
1✔
1836
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
1✔
1837
        reader := NeoJSONReader on: result readStream.
1✔
1838
        reader for: GLHDiff do: [ :mapping |
1✔
1839
                mapping mapInstVars:
1✔
1840
                        #( deleted_file new_file new_path old_path renamed_file ).
1✔
1841
                mapping mapInstVar: #diffString to: #diff ].
1✔
1842

1✔
1843
        reader
1✔
1844
                for: #ArrayOfDiffs
1✔
1845
                customDo: [ :customMappting |
1✔
1846
                customMappting listOfElementSchema: GLHDiff ].
1✔
1847
        ^ reader nextAs: #ArrayOfDiffs
1✔
1848
]
1✔
1849

1✔
1850
{ #category : #'private - parsing' }
1✔
1851
GitlabModelImporter >> parseFileTreeResult: aResult [
1✔
1852

1✔
1853
        | reader |
1✔
1854
        reader := NeoJSONReader on: aResult readStream.
1✔
1855
        reader mapInstVarsFor: GLHApiFile.
1✔
1856
        reader
1✔
1857
                for: #ArrayOfFile
1✔
1858
                customDo: [ :customMappting | 
1✔
1859
                customMappting listOfElementSchema: GLHApiFile ].
1✔
1860
        ^ reader nextAs: #ArrayOfFile
1✔
1861
]
1✔
1862

1✔
1863
{ #category : #'private - parsing' }
1✔
1864
GitlabModelImporter >> parseGroupResult: aResult [
1✔
1865

1✔
1866
        | reader |
1✔
1867
        reader := generalReader on: aResult readStream.
1✔
1868

1✔
1869
        ^ reader nextAs: GLHGroup
1✔
1870
]
1✔
1871

1✔
1872
{ #category : #parsing }
1✔
1873
GitlabModelImporter >> parseJobsResult: result [ 
1✔
1874
        | reader |
1✔
1875
        reader := generalReader on: result readStream.
1✔
1876

1✔
1877
        ^ reader nextAs: #ArrayOfJob
1✔
1878
]
1✔
1879

1✔
1880
{ #category : #'private - parsing' }
1✔
1881
GitlabModelImporter >> parseJobsResult: result ofProject: aProject [
1✔
1882

1✔
1883
        | reader |
1✔
1884
        reader := generalReader on: result readStream.
1✔
1885
        reader for: GLHJob do: [ :mapping |
1✔
1886
                mapping
1✔
1887
                        mapProperty: #commit
1✔
1888
                        getter: [ :object | #ignore ]
1✔
1889
                        setter: [ :object :value |
1✔
1890
                                value ifNotNil: [
1✔
1891
                                        object commit:
1✔
1892
                                                (self importCommit: (value at: #id) ofProject: aProject) ] ] ].
1✔
1893

1✔
1894

1✔
1895
        ^ reader nextAs: #ArrayOfJob
1✔
1896
]
1✔
1897

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

1✔
1901
        generalReader on: result readStream.
1✔
1902
        ^ generalReader nextAs: #ArrayOfMergeRequest
1✔
1903
]
1✔
1904

1✔
1905
{ #category : #'private - parsing' }
1✔
1906
GitlabModelImporter >> parseNoteJson: results [
1✔
1907

1✔
1908
        | reader |
1✔
1909
        "Créer un lecteur JSON"
1✔
1910
        reader := generalReader on: results readStream.
1✔
1911

1✔
1912
        "Corriger la conversion des dates"
1✔
1913
        "reader for: DateAndTime customDo: [ :mapping |
1✔
1914
                mapping decoder: [ :string |
1✔
1915
                        DateAndTime readFrom: string readStream ] ]."
1✔
1916

1✔
1917
        
1✔
1918
        ^ reader nextAs: #ArrayOfNote
1✔
1919
]
1✔
1920

1✔
1921
{ #category : #'private - parsing' }
1✔
1922
GitlabModelImporter >> parsePipelineResult: result [
1✔
1923

1✔
1924
        | reader |
1✔
1925
        
1✔
1926
        (result includesSubstring: '{"message":"40' )ifTrue: [ ^ {  } ].
1✔
1927
        
1✔
1928
        reader := generalReader on: result readStream.
1✔
1929
        
1✔
1930
        ^ reader nextAs: GLHPipeline
1✔
1931
]
1✔
1932

1✔
1933
{ #category : #'private - parsing' }
1✔
1934
GitlabModelImporter >> parsePipelinesResult: result [
1✔
1935

1✔
1936
        | reader |
1✔
1937
        (result includesSubstring: '{"message":"40') ifTrue: [ ^ {  } ].
1✔
1938

1✔
1939
        reader := generalReader on: result readStream.
1✔
1940

1✔
1941
        ^ reader nextAs: #ArrayOfPipeline
1✔
1942
]
1✔
1943

1✔
1944
{ #category : #'private - parsing' }
1✔
1945
GitlabModelImporter >> parseProjectResult: aResult [
1✔
1946

1✔
1947
        | reader |
1✔
1948
        reader := generalReader on: aResult readStream.
1✔
1949

1✔
1950
        ^ reader nextAs: GLHProject
1✔
1951
]
1✔
1952

1✔
1953
{ #category : #'private - parsing' }
1✔
1954
GitlabModelImporter >> parseReleaseResult: result [
1✔
1955
        |reader|
1✔
1956
        reader := generalReader on: result readStream.
1✔
1957
        
1✔
1958
        ^ reader nextAs: GLHRelease 
1✔
1959
]
1✔
1960

1✔
1961
{ #category : #'private - parsing' }
1✔
1962
GitlabModelImporter >> parseReleasesResult: result [
1✔
1963

1✔
1964
        | reader |
1✔
1965
        reader := generalReader on: result readStream.
1✔
1966

1✔
1967
        ^ reader nextAs: #ArrayOfRelease
1✔
1968
]
1✔
1969

1✔
1970
{ #category : #'private - parsing' }
1✔
1971
GitlabModelImporter >> parseSubGroupResult: aResult [
1✔
1972

1✔
1973
        | reader |
1✔
1974
        reader := generalReader on: aResult readStream.
1✔
1975
        
1✔
1976
        ^ reader nextAs: #ArrayOfGroup
1✔
1977
]
1✔
1978

1✔
1979
{ #category : #'private - parsing' }
1✔
1980
GitlabModelImporter >> parseTagsResult: result [
1✔
1981
        |reader|
1✔
1982
        reader := generalReader on: result readStream.
1✔
1983
        
1✔
1984
        ^ reader nextAs: #ArrayOfTags
1✔
1985
]
1✔
1986

1✔
1987
{ #category : #'private - parsing' }
1✔
1988
GitlabModelImporter >> parseUserResult: result [
1✔
1989

1✔
1990
        | reader |
1✔
1991
        
1✔
1992
        reader := generalReader on: result readStream.
1✔
1993
        
1✔
1994
        ^ reader nextAs: GLHUser
1✔
1995

1✔
1996
        
1✔
1997

1✔
1998
]
1✔
1999

1✔
2000
{ #category : #'private - parsing' }
1✔
2001
GitlabModelImporter >> parseUsersResult: result [
1✔
2002

1✔
2003
        | reader |
1✔
2004
        
1✔
2005
        reader := generalReader on: result readStream.
1✔
2006
        
1✔
2007
        ^ reader nextAs: #ArrayOfUser
1✔
2008
        
1✔
2009
]
1✔
2010

1✔
2011
{ #category : #'import - projects' }
1✔
2012
GitlabModelImporter >> partiallyImportProject: aProjectID [
1✔
2013

1✔
2014
        | result projectResult |
1✔
2015
        ('Import project with id:  ' , aProjectID printString) recordInfo.
1✔
2016

1✔
2017
        (glhModel allWithType: GLHProject)
1✔
2018
                detect: [ :project | project id = aProjectID ]
1✔
2019
                ifFound: [ :project | ^ project ].
1✔
2020

1✔
2021
        result := self repoApi projects get: aProjectID.
1✔
2022
        projectResult := self parseProjectResult: result.
1✔
2023

1✔
2024
        projectResult repository: GLHRepository new.
1✔
2025
        self glhModel add: projectResult repository.
1✔
2026
        self importRepository: projectResult repository.
1✔
2027

1✔
2028
        ^ projectResult
1✔
2029
]
1✔
2030

1✔
2031
{ #category : #'import - pipelines' }
1✔
2032
GitlabModelImporter >> pipelinesOf: aProjectID after: after andBefore: before [
1✔
2033

1✔
2034
        | result |
1✔
2035
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
1✔
2036
        
1✔
2037
        result := self repoApi pipelines getAllInProject: aProjectID 
1✔
2038
                                                                                                withParams: {        #updated_before -> before.
1✔
2039
                                                                                                                                        #updated_after -> after} asDictionary .
1✔
2040
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
1✔
2041

1✔
2042
        ^ (result collect: [ :pipelinesJson |
1✔
2043
                           self parsePipelinesResult: pipelinesJson ]) flattened
1✔
2044
]
1✔
2045

1✔
2046
{ #category : #'import - pipelines' }
1✔
2047
GitlabModelImporter >> pipelinesOf: aProjectID withLimit: aLimit [
1✔
2048

1✔
2049
        | result |
1✔
2050
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
1✔
2051
        result := self repoApi pipelines getByPage: 1 perPage: aLimit inProject: aProjectID.
1✔
2052
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
1✔
2053

1✔
2054
        ^ (result collect: [ :pipelinesJson |
1✔
2055
                           self parsePipelinesResult: pipelinesJson ]) flattened
1✔
2056
]
1✔
2057

1✔
2058
{ #category : #accessing }
1✔
2059
GitlabModelImporter >> repoApi: anObject [
1✔
2060
        super repoApi: anObject.
1✔
2061
        self repoApi output: 'json'
1✔
2062
]
1✔
2063

1✔
2064
{ #category : #'search - merge request' }
1✔
2065
GitlabModelImporter >> searchMergeRequestMentionning: aString [ 
1✔
2066
        |mergeRequests results|
1✔
2067
        results := repoApi mergeRequests search: aString.
1✔
2068
        mergeRequests := self parseMergeRequestsResult: results.
1✔
2069
        mergeRequests :=        mergeRequests collect: [ :mr |
1✔
2070
                mr project: (self importProject: mr project_id).
1✔
2071
                mr
1✔
2072
                 ].
1✔
2073
        
1✔
2074
        ^ glhModel addAll: mergeRequests unless: self blockOnIdEquality. 
1✔
2075
]
1✔
2076

1✔
2077
{ #category : #private }
1✔
2078
GitlabModelImporter >> selectEntityType: aType overAttribut: aSelector equalTo: value [
1✔
2079

1✔
2080
        ^ (self glhModel allWithType: aType)
1✔
2081
                select: [ :entity | (entity perform: aSelector) = value ]
1✔
2082
]
1✔
2083

1✔
2084
{ #category : #'import - groups' }
1✔
2085
GitlabModelImporter >> subGroupsOf: aGroupID [
1✔
2086

1✔
2087
        | results subgroups |
1✔
2088
        ('Search subgroup of: ' , aGroupID printString) recordInfo.
1✔
2089
        results := self repoApi groups subgroupsOf: aGroupID.
1✔
2090
        subgroups := (results collect: [ :subgroupsJson | self parseSubGroupResult: subgroupsJson ]) flattened.
1✔
2091
        
1✔
2092
        ^ subgroups
1✔
2093
]
1✔
2094

1✔
2095
{ #category : #accessing }
1✔
2096
GitlabModelImporter >> withInitialCommits: boolean [
1✔
2097
        withInitialCommits := boolean 
1✔
2098
]
1✔
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