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

moosetechnology / GitProjectHealth / 13374988886

17 Feb 2025 04:42PM UTC coverage: 61.181% (+6.6%) from 54.598%
13374988886

Pull #131

github

web-flow
Merge bcce50bd4 into 5974fca57
Pull Request #131: Revert "Renaming importer"

99 of 325 new or added lines in 15 files covered. (30.46%)

110 existing lines in 7 files now uncovered.

9614 of 15714 relevant lines covered (61.18%)

0.61 hits per line

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

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

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

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

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

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

39
{ #category : #private }
40
GLHModelImporter >> chainsCommitsFrom: commitsCollection [
1✔
41

1✔
42
        | dic |
1✔
43
        
1✔
44
        ('Chains ', commitsCollection size printString , ' commits') recordInfo.
1✔
45
        
1✔
46
        dic := ((self glhModel allWithType: GLHCommit) collect: [ :commit |
1✔
47
                        commit id -> commit ]) asSet asDictionary.
1✔
48

1✔
49
        commitsCollection do: [ :commit |
1✔
50
                commit parent_ids do: [ :parentId | 
1✔
51
                        dic
1✔
52
                                at: parentId
1✔
53
                                ifPresent: [ :parentCommit |
1✔
54
                                        parentCommit childCommits
1✔
55
                                                add: commit
1✔
56
                                                unless: self blockOnIdEquality ]
1✔
57
                                ifAbsent: [  ] ] ].
1✔
58
        ^ commitsCollection
1✔
59
]
1✔
60

61

62
{ #category : #'import - projects' }
63
GLHModelImporter >> completeImportProject: aGLHProject [
1✔
64

1✔
65
        | importedProject |
1✔
66
        ('Complete import of project: ' , aGLHProject id printString)
1✔
67
                recordInfo.
1✔
68
        aGLHProject repository ifNotNil: [ ^ aGLHProject ].
1✔
69

1✔
70
        importedProject := self glhModel
1✔
71
                                   add: aGLHProject
1✔
72
                                   unless: self blockOnIdEquality.
1✔
73

1✔
74
        self importPipelinesOfProject: importedProject.
1✔
75

1✔
76
        "aGLHProject creator: (self importUser: aGLHProject creator_id)."
1✔
77

1✔
78
        (self importUser: importedProject creator_id) addCreatedProject:
1✔
79
                importedProject.
1✔
80

1✔
81

1✔
82
        importedProject repository: GLHRepository new.
1✔
83
        self glhModel add: importedProject repository.
1✔
84
        self importRepository: importedProject repository.
1✔
85

1✔
86
        ^ importedProject
1✔
87
]
1✔
88

89
{ #category : #'import - commits' }
90
GLHModelImporter >> completeImportedCommit: aCommit [
1✔
91

1✔
92
        ('completing commit: ' , aCommit short_id printString) recordInfo.
1✔
93
        self importCreatorOfCommit: aCommit.
1✔
94

1✔
95
        self withCommitDiffs ifTrue: [
1✔
96
                | diffs |
1✔
97
                aCommit diffs ifEmpty: [
1✔
98
                        diffs := self importDiffOfCommit: aCommit.
1✔
99
                        self glhModel addAll: diffs unless: self blockForDiffEquality ] ].
1✔
100

1✔
101
        ^ aCommit
1✔
102
]
1✔
103

104
{ #category : #'private - configure reader' }
105
GLHModelImporter >> configureReaderForCommit: reader [
1✔
106

1✔
107
          reader for: GLHCommit do: [ :mapping |
1✔
108
                mapping mapInstVars:
1✔
109
                        #( id short_id title author_name author_email committer_name
1✔
110
                           committer_email message web_url ).
1✔
111
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
112
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
113
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
114
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
115
                mapping
1✔
116
                        mapProperty: 'stats'
1✔
117
                        getter: [ :el | "Not used" ]
1✔
118
                        setter: [ :commit :value |
1✔
119
                                commit deletions: (value at: #deletions).
1✔
120
                                commit additions: (value at: #additions) ] ].
1✔
121

1✔
122
        reader for: DateAndTime customDo: [ :mapping |
1✔
123
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
124

1✔
125
        reader
1✔
126
                for: #ArrayOfIds
1✔
127
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
128
  
1✔
129
        reader
1✔
130
                for: #ArrayOfCommit
1✔
131
                customDo: [ :customMappting |
1✔
132
                customMappting listOfElementSchema: GLHCommit ].
1✔
133

1✔
134
]
1✔
135

136
{ #category : #'private - configure reader' }
137
GLHModelImporter >> configureReaderForDiffs: reader [
1✔
138

1✔
139
        reader for: GLHDiff do: [ :mapping |
1✔
140
                mapping mapInstVars:
1✔
141
                        #( deleted_file new_file new_path old_path renamed_file ).
1✔
142
                mapping mapInstVar: #diffString to: #diff ].
1✔
143

1✔
144
        reader
1✔
145
                for: #ArrayOfDiffs
1✔
146
                customDo: [ :customMappting |
1✔
147
                customMappting listOfElementSchema: GLHDiff ].
1✔
148
        ^ reader
1✔
149
]
1✔
150

151
{ #category : #'private - configure reader' }
152
GLHModelImporter >> configureReaderForGroup: reader [
1✔
153

1✔
154
        reader for: GLHGroup do: [ :mapping |
1✔
155
                mapping mapInstVars.
1✔
156
                (mapping mapInstVar: #projects) valueSchema: #ArrayOfProjects ].
1✔
157
        reader mapInstVarsFor: GLHProject.
1✔
158
        reader
1✔
159
                for: #ArrayOfProjects
1✔
160
                customDo: [ :customMappting |
1✔
161
                customMappting listOfElementSchema: GLHProject ].
1✔
162
        reader
1✔
163
                for: #ArrayOfGroups
1✔
164
                customDo: [ :customMappting |
1✔
165
                customMappting listOfElementSchema: GLHGroup ]
1✔
166
]
1✔
167

168
{ #category : #private }
169
GLHModelImporter >> convertApiFileAsFile: aAPIFile [
×
170

×
171
        aAPIFile type = 'tree' ifTrue: [ 
×
172
                ^ GLHFileDirectory new
×
173
                          name: aAPIFile name;
×
174
                          yourself ].
×
175
        ^ GLHFileBlob new
×
176
                  name: aAPIFile name;
×
177
                  yourself
×
UNCOV
178
]
×
179

180
{ #category : #private }
181
GLHModelImporter >> detectEntityType: aType overAttribut: aSelector equalTo: value [
1✔
182

1✔
183
        ^ (self glhModel allWithType: aType) detect: [ :entity |
1✔
184
                  (entity perform: aSelector) = value ] ifNone: [ nil ]. 
1✔
185
]
1✔
186

187
{ #category : #accessing }
188
GLHModelImporter >> glhApi [
×
189

×
190
        self
×
191
                deprecated: 'Use #repoApi instead'
×
192
                on: '7 October 2024'
×
193
                in:
×
194
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
×
195

×
196
        ^ repoApi
×
UNCOV
197
]
×
198

199
{ #category : #accessing }
200
GLHModelImporter >> glhApi: anObject [
×
201

×
202
        self
×
203
                deprecated: 'Use #repoApi: instead'
×
204
                on: '7 October 2024'
×
205
                in:
×
206
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
×
207

×
208
        repoApi := anObject
×
UNCOV
209
]
×
210

211
{ #category : #accessing }
212
GLHModelImporter >> glhModel [
1✔
213

1✔
214
        ^ glhModel
1✔
215
]
1✔
216

217
{ #category : #accessing }
218
GLHModelImporter >> glhModel: anObject [
1✔
219

1✔
220
        glhModel := anObject
1✔
221
]
1✔
222

223
{ #category : #'import - users' }
224
GLHModelImporter >> importActiveHumanUsers [
×
225

×
226
        | params result users |
×
227
        params := { 
×
228
                #humans -> 'true'.
×
229
                #active -> 'true'.
×
230
                #without_project_bots -> 'true'
×
231
        } asDictionary.
×
232
        result := self repoApi users allWithParams: params.
×
233
        users := (result collect: [ :usersJson | self parseUsersResult: usersJson ]) flattened.
×
234
        
×
235
        self glhModel
×
236
                                 addAll: users
×
237
                                 unless: self blockOnIdEquality.
×
238

×
239
        ^ users
×
UNCOV
240
]
×
241

242
{ #category : #'import - groups' }
243
GLHModelImporter >> importAllGroups [
×
244

×
245
        | params results groups |
×
246
        
×
247
        params := { 
×
248
                        #top_level_only -> 'true'
×
249
        } asDictionary.
×
250
        results := self repoApi groups getAllWithParams: params.
×
251
        
×
252
        groups := (results collect: [ :groupsJson | generalReader
×
253
                                            on: groupsJson readStream;
×
254
                                            nextAs: #ArrayOfGroups. ]) flattened.
×
255
        ^ groups
×
UNCOV
256
]
×
257

258
{ #category : #'import - commits' }
259
GLHModelImporter >> importAndLoadLatestsCommitsOfProject: aGLHProject [
×
260

×
261
        | commits completedProject |
×
262
        completedProject := self completeImportProject: aGLHProject.
×
263
        commits := self importLastestCommitsOfProject: completedProject.
×
264
        commits do: [ :commit | self completeImportedCommit: commit ].
×
265
        self chainsCommitsFrom: commits.
×
266
        ^ commits
×
UNCOV
267
]
×
268

269
{ #category : #'import - commits' }
270
GLHModelImporter >> importCommit: aCommitID ofProject: aGLHProject [
×
271

×
272
        | result parsedResult |
×
273
        (self glhModel allWithType: GLHCommit) asOrderedCollection
×
274
                detect: [ :commit | commit id = aCommitID ]
×
275
                ifFound: [ :commit | ^ commit ].
×
276
        result := self repoApi commits get: aCommitID inProject: aGLHProject id.
×
277
        
×
278
        parsedResult := self parseCommitResult: result.
×
279
        
×
280
        self
×
281
                addCommits: { parsedResult }
×
282
                toRepository: aGLHProject repository.
×
283
        ^ parsedResult
×
UNCOV
284
]
×
285

286
{ #category : #'import - commits' }
287
GLHModelImporter >> importCommitOfProject: anProject withId: anID [
1✔
288

1✔
289
        | commit result |
1✔
290
        anID ifNil: [ ^ nil ].
1✔
291

1✔
292
        ('looking for commit ' , anID printString , ' in project : '
1✔
293
         , anProject id printString) recordInfo.
1✔
294

1✔
295
        commit := (self
1✔
296
                           detectEntityType: GLHCommit
1✔
297
                           overAttribut: #id
1✔
298
                           equalTo: anID) ifNil: [
1✔
299
                          result := self repoApi commits get: anID inProject: anProject id.
1✔
300
                          commit := (self parseCommitsResult: '[' , result , ']')
1✔
301
                                            first.
1✔
302

1✔
303
                          self glhModel add: commit unless: self blockOnIdEquality.
1✔
304
                          commit repository: anProject repository.
1✔
305

1✔
306
                          commit ].
1✔
307

1✔
308
        self withCommitDiffs ifTrue: [ self importDiffOfCommit: commit ].
1✔
309

1✔
310
        ^ commit
1✔
311
]
1✔
312

313
{ #category : #'import - commits' }
314
GLHModelImporter >> importCommits: aGLHProject [
×
315
        "limited to the last 20 commits"
×
316

×
317
        | results parsedResults params |
×
318
        params := { 
×
319
         #with_stats -> 'true'
×
320
        } asDictionary.
×
321
        results := self repoApi commits getByPage: 1 perPage: 20 inProject: aGLHProject id withParams: params.
×
322
        
×
323
        parsedResults := self parseCommitsResult: results.
×
324
        self glhModel addAll: parsedResults unless: self blockOnIdEquality.
×
325

×
326
        parsedResults do: [ :commit |
×
327
                commit repository: aGLHProject repository ].
×
328

×
329
        self withCommitDiffs ifTrue: [
×
330
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
×
331
        
×
332
        ^ parsedResults. 
×
UNCOV
333
]
×
334

335
{ #category : #'import - commits' }
336
GLHModelImporter >> importCommitsFollowing: aCommit upToDays: aNumberOfDay [
×
337
        "import the 'n' commits of a project starting from an initial 'aCommit' commit. 
×
338
        Lazy import does not import the entities inside the model"
×
339

×
340
        | date |
×
341
        date := aCommit created_at asDateAndTime.
×
342

×
343
        ^ self
×
344
                  importCommitsOfBranch: aCommit branch
×
345
                  forRefName: aCommit branch name
×
346
                  since: date
×
347
                  until: (date + aNumberOfDay day)
×
UNCOV
348
]
×
349

350
{ #category : #commit }
351
GLHModelImporter >> importCommitsOf: aGLHProject withStats: aBoolean until: toDate [
×
352

×
353
        | newlyFoundCommit page |
×
354
        
×
355
        self deprecated: [  ] .
×
356
        
×
357
        page := 0.
×
358
        newlyFoundCommit := { true }.
×
359
        [ newlyFoundCommit isNotEmpty ] whileTrue: [
×
360
                | results parsedResults existingCommits |
×
361
                page := page + 1.
×
362
                ('import commit page ' , page printString) recordInfo.
×
363
                results := self repoApi
×
364
                                   commitsOfProject: aGLHProject id
×
365
                                   forRefName: nil
×
366
                                   since: nil
×
367
                                   until: nil
×
368
                                   path: nil
×
369
                                   author: nil
×
370
                                   all: nil
×
371
                                   with_stats: aBoolean
×
372
                                   firstParent: nil
×
373
                                   order: nil
×
374
                                   trailers: nil
×
375
                                   perPage: 100
×
376
                                   page: page.
×
377
                parsedResults := self parseCommitsResult: results.
×
378
                existingCommits := aGLHProject mooseModel allWithType: GLHCommit.
×
379

×
380
                newlyFoundCommit := parsedResults reject: [ :commitParsed |
×
381
                                            (toDate isNil or: [
×
382
                                                     commitParsed committed_date
×
383
                                                     < toDate asDateAndTime ]) or: [
×
384
                                                    existingCommits anySatisfy: [ :existingCommit |
×
385
                                                            existingCommit id = commitParsed id ] ] ].
×
386
                aGLHProject mooseModel addAll: newlyFoundCommit.
×
387
                aGLHProject repository commits addAll: newlyFoundCommit ].
×
388

×
389

×
390
        self withCommitDiffs ifTrue: [
×
391
                aGLHProject repository commits do: [ :commit |
×
392
                        self importDiffOfCommit: commit ] ]
×
UNCOV
393
]
×
394

395
{ #category : #'import - commits' }
396
GLHModelImporter >> importCommitsOfBranch: aGLHBranch forRefName: refName since: fromDate [
×
397

×
398
        ^ self
×
399
                  importCommitsOfBranch: aGLHBranch
×
400
                  forRefName: aGLHBranch name
×
401
                  since: fromDate
×
402
                  until: nil
×
UNCOV
403
]
×
404

405
{ #category : #'import - commits' }
406
GLHModelImporter >> importCommitsOfBranch: aGLHBranch forRefName: refName since: fromDate until: toDate [
×
407

×
408
        | params result allCommits |
×
409
        params := { 
×
410
          #ref_name -> aGLHBranch name.
×
411
          #since ->  (fromDate ifNotNil: [ fromDate asDate asDateAndTime asString ] ifNil: [ '' ]).
×
412
          #until -> (toDate ifNotNil: [ toDate asDate asDateAndTime asString ] ifNil: [ '' ]). 
×
413

×
414
        } asDictionary.
×
415
        result := self repoApi commits getAllInProject: aGLHBranch repository project id withParams: params.
×
416
        
×
417
        allCommits := (result collect: [ :commitsJson | self parseCommitsResult: commitsJson ]) flattened.
×
418
        
×
419
        aGLHBranch commits
×
420
                        addAll: allCommits
×
421
                        unless: self blockOnIdEquality.
×
422

×
423
        self glhModel
×
424
                addAll: aGLHBranch commits
×
425
                unless: self blockOnIdEquality.
×
426

×
427
        ^ allCommits
×
UNCOV
428
]
×
429

430
{ #category : #'import - commits' }
431
GLHModelImporter >> importCommitsOfBranch: aGLHBranch forRefName: refName until: toDate [
×
432

×
433
        ^ self
×
434
                  importCommitsOfBranch: aGLHBranch
×
435
                  forRefName: aGLHBranch name
×
436
                  since: nil
×
437
                  until: toDate
×
UNCOV
438
]
×
439

440
{ #category : #'import - commits' }
441
GLHModelImporter >> importCommitsOfProject: aProject since: fromDate until: toDate [
1✔
442

1✔
443
        | params results allCommits |
1✔
444
        params := {
1✔
445
                          (#since
1✔
446
                           ->
1✔
447
                           (fromDate
1✔
448
                                    ifNotNil: [ fromDate asDate asDateAndTime asString ]
1✔
449
                                    ifNil: [ '' ])).
1✔
450
                          (#until
1✔
451
                           ->
1✔
452
                           (toDate
1✔
453
                                    ifNotNil: [ toDate asDate asDateAndTime asString ]
1✔
454
                                    ifNil: [ '' ])).
1✔
455
                          (#with_stats -> 'true').
1✔
456
                          (#all -> 'true') } asDictionary.
1✔
457
        results := self repoApi commits
1✔
458
                           getAllInProject: aProject id
1✔
459
                           withParams: params.
1✔
460

1✔
461
        allCommits := (results collect: [ :commitsJson |
1✔
462
                               self parseCommitsResult: commitsJson ]) flattened.
1✔
463

1✔
464
        allCommits:= aProject repository commits
1✔
465
                addAll: allCommits
1✔
466
                unless: self blockOnIdEquality.
1✔
467

1✔
468
        ^ self glhModel addAll: allCommits unless: self blockOnIdEquality
1✔
469
]
1✔
470

471

472
{ #category : #'import - projects' }
473
GLHModelImporter >> importContributedProjectsOfUser: aGLHUser [
×
474

×
475
        | remaningProjects params results projects projectsIds |
×
476
        params := {
×
477
                          (#order_by -> 'last_activity_at').
×
478
                          (#simple -> 'true') } asDictionary.
×
479
        results := self repoApi projects
×
480
                           contributedProjectsOfUser: aGLHUser id
×
481
                           withParams: params.
×
482

×
483
        projectsIds := (results collect: [ :projectsJson |
×
484
                             (NeoJSONReader fromString: projectsJson) collect: [:projectJson | projectJson at: #id ] ]) flattened.
×
485
        
×
486
        projects := self importProjects: projectsIds.
×
487
        remaningProjects := self importProjects:
×
488
                                    ((projects collect: #id) difference:
×
489
                                             ((self userCatalogue atId: aGLHUser id) at:
×
490
                                                      #contributedProjects)).
×
491

×
492

×
493
        aGLHUser contributedProjects
×
494
                addAll: projects , remaningProjects
×
495
                unless: self blockOnIdEquality.
×
496

×
497
        self userCatalogue
×
498
                addUser: aGLHUser
×
499
                withProjects: (aGLHUser contributedProjects collect: #id).
×
500

×
UNCOV
501
        ^ projects
×
UNCOV
502
]
×
503

504
{ #category : #'import - commits' }
505
GLHModelImporter >> importCreatorOfCommit: aCommit [
1✔
506

1✔
507
        aCommit commitCreator ifNil: [
1✔
508
                aCommit commitCreator:
1✔
509
                        (self importUserByUsername: aCommit author_name) ].
1✔
510
        self userCatalogue
1✔
511
                addUser: aCommit commitCreator
1✔
512
                withProject: aCommit repository project id.
1✔
513
        ^ aCommit commitCreator
1✔
514
]
1✔
515

516
{ #category : #'import - commits' }
517
GLHModelImporter >> importDiffOfCommit: aCommit [
1✔
518

1✔
519
        | result diffsResult |
1✔
520
        aCommit diffs ifNotEmpty: [
1✔
521
                'Diff already importer: ' , aCommit short_id printString recordInfo.
1✔
522
                ^ aCommit diffs ].
1✔
523
        ('Import diff of commit: ' , aCommit short_id printString) recordInfo.
1✔
524
        
1✔
525
        result := self repoApi commits diffOf: aCommit id inProject: aCommit repository project id  uniDiff: true.
1✔
526
        
1✔
527
        (self isServerError: result) ifTrue: [ ^ {  } ].
1✔
528
        diffsResult := self newParseDiffResult: result.
1✔
529

1✔
530
        ^ aCommit diffs addAll: diffsResult unless: self blockForDiffEquality.
1✔
531

1✔
532
]
1✔
533

534
{ #category : #'import - repositories' }
535
GLHModelImporter >> importDirectoryFiles: aDirectoryFile OfBranch: aBranch [
×
536

×
537
        | result files apiFiles params |
×
538
        params := { 
×
539
                #ref -> aBranch name.
×
540
                #path -> (aDirectoryFile path , '/')
×
541
        } asDictionary.
×
542
        result := self repoApi repositories repositoryTreeOfProject: aBranch repository project id withParams: params.
×
543
                         " treeOfRepository: aBranch repository project id
×
544
                          ofBranch: aBranch name
×
545
                          andPath: aDirectoryFile path , '/'."
×
546
        apiFiles := (result collect: [ :treeJson | self parseFileTreeResult: treeJson ]) flattened.
×
547
        files := apiFiles collect: [ :apiFile |
×
548
                         self convertApiFileAsFile: apiFile ].
×
549
        
×
550
        files do: [ :file |
×
551
                self glhModel add: file.
×
552
                aDirectoryFile addFile: file ].
×
553
        
×
554
        files
×
555
                select: [ :file | file isKindOf: GLHFileDirectory ]
×
556
                thenCollect: [ :file |
×
UNCOV
557
                self importDirectoryFiles: file OfBranch: aBranch ]
×
UNCOV
558
]
×
559

560
{ #category : #'import - repositories' }
561
GLHModelImporter >> importFilesOfBranch: aBranch [
×
562

×
563
        | result files apiFiles params |
×
564
        params := { 
×
565
                #ref -> aBranch name.
×
566
        } asDictionary.
×
567
        
×
568
        result := self repoApi repositories repositoryTreeOfProject: aBranch repository project id withParams: params.
×
569
        
×
570
                          "treeOfRepository: aBranch repository project id
×
571
                          ofBranch: aBranch name
×
572
                          andPath: nil."
×
573
        apiFiles := (result collect: [ :filesJson | self parseFileTreeResult: filesJson  ]) flattened.
×
574
        files := apiFiles collect: [ :apiFile | 
×
575
                         self convertApiFileAsFile: apiFile ].
×
576
        files do: [ :file | 
×
577
                self glhModel add: file.
×
578
                aBranch addFile: file ].
×
579
        files
×
580
                select: [ :file | file isKindOf: GLHFileDirectory ]
×
581
                thenCollect: [ :file | 
×
UNCOV
582
                self importDirectoryFiles: file OfBranch: aBranch ]
×
UNCOV
583
]
×
584

585
{ #category : #'import - groups' }
586
GLHModelImporter >> importGroup: aGroupID [
1✔
587

1✔
588
        | result groupResult |
1✔
589
        ('Import group: ' , aGroupID printString) recordInfo.
1✔
590

1✔
591
        result := self repoApi groups get: aGroupID.
1✔
592
        
1✔
593
        "group: aGroupID."
1✔
594
        groupResult := self parseGroupResult: result.
1✔
595
        groupResult := self addGroupResultToModel: groupResult.
1✔
596

1✔
597
        groupResult projects do: [ :project |
1✔
598
                self completeImportProject: project ].
1✔
599

1✔
600
        (self subGroupsOf: aGroupID) do: [ :subGroup |
1✔
601
                
1✔
602
                groupResult subGroups
1✔
603
                        add: (self importGroup: subGroup id)
1✔
604
                        unless: self blockOnIdEquality ].
1✔
605
        ^ groupResult
1✔
606
]
1✔
607

608
{ #category : #'import - jobs' }
609
GLHModelImporter >> importJobsOf: aPipeline [
×
610

×
611
        | jobs results |
×
612
        results := self repoApi jobs allForPipeline: aPipeline id inProject: aPipeline project id.
×
613
                          "jobsOfProject: aPipeline project id
×
614
                          ofPipelines: aPipeline id."
×
615
        jobs := (results collect: [ :jobsJson | self parseJobsResult: jobsJson ofProject: aPipeline project ]) flattened.
×
616
        jobs do: [ :job | aPipeline addJob: job ].
×
617
        self glhModel addAll: jobs.
×
618
        
×
619
        ^jobs
×
UNCOV
620

×
UNCOV
621
]
×
622

623
{ #category : #'import - commits' }
624
GLHModelImporter >> importLastestCommitsOfProject: aGLHProject [
1✔
625
        "limited to the last 50 commits"
1✔
626

1✔
627
        | results parsedResults params |
1✔
628
        params := { 
1✔
629
                #with_stats -> 'true'.
1✔
630
                #all -> true
1✔
631
         } asDictionary.
1✔
632
        results := self repoApi commits getByPage: 1 perPage: 50 inProject: aGLHProject id withParams: params.
1✔
633

1✔
634
        parsedResults := self parseCommitsResult: results.
1✔
635
        parsedResults := self glhModel
1✔
636
                                 addAll: parsedResults
1✔
637
                                 unless: self blockOnIdEquality.
1✔
638

1✔
639
        aGLHProject repository commits
1✔
640
                addAll: parsedResults
1✔
641
                unless: self blockOnIdEquality.
1✔
642

1✔
643
        self withCommitDiffs ifTrue: [
1✔
644
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
1✔
645

1✔
646
        ^ parsedResults
1✔
647
]
1✔
648

649
{ #category : #'import - commits' }
650
GLHModelImporter >> importParentCommitsOfCommit: aGLHCommit since: aDate [
×
651

×
652
        | parentsIds commits |
×
653
        commits := OrderedCollection new.
×
654
        aGLHCommit created_at asDateAndTime < aDate asDateAndTime ifTrue: [
×
655
                 
×
656
                ^ commits
×
657
                          add: aGLHCommit;
×
658
                          yourself ].
×
659

×
660
        parentsIds := aGLHCommit parent_ids.
×
661

×
662
        commits addAll: (parentsIds collect: [ :id |
×
663
                         self
×
664
                                 importCommitOfProject: aGLHCommit repository project
×
665
                                 withId: id ]).
×
666

×
667

×
668
        ^ (commits collect: [ :parentCommit |
×
669
                   self importParentCommitsOfCommit: parentCommit since: aDate ])
×
UNCOV
670
                  flatten
×
UNCOV
671
]
×
672

673
{ #category : #'imports - pipelines' }
674
GLHModelImporter >> importPipelinesOfProject: aGLHProject [
1✔
675

1✔
676
        (self pipelinesOf: aGLHProject id) do: [ :pipeline |
1✔
677
                self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
678
                aGLHProject pipelines add: pipeline unless: self blockOnIdEquality]
1✔
679
]
1✔
680

681
{ #category : #'import - projects' }
682
GLHModelImporter >> importProject: aProjectID [
×
683

×
684
        | result projectResult |
×
685
        ('Import project with id: ' , aProjectID printString) recordInfo.
×
686

×
687
        result := self repoApi projects get: aProjectID.
×
688
        projectResult := self parseProjectResult: result.
×
689

×
UNCOV
690
        ^ self completeImportProject: projectResult
×
UNCOV
691
]
×
692

693
{ #category : #'import - projects' }
694
GLHModelImporter >> importProjects [
×
695

×
696
        | result projects |
×
697
        ('import all Projects') recordInfo.
×
698

×
699

×
700
        result := self repoApi projects all.
×
701
        projects := (result collect: [ :projectsJson | self parseArrayOfProject: projectsJson ]) flattened.
×
702
        
×
703
        self glhModel addAll: projects unless: self blockOnIdEquality.
×
704

×
UNCOV
705
        ^ projects
×
UNCOV
706
]
×
707

708
{ #category : #imports }
709
GLHModelImporter >> importProjectsSince: since [
×
710
        "heavy import of all projects"
×
711

×
UNCOV
712
        "copy import from commits"
×
UNCOV
713

×
714
        | newlyFoundProjects page foundProject amount |
×
715
        ('import all Projects since: ' , since printString) recordInfo.
×
716

×
717
        "number of projects per page"
×
718
        amount := 100.
×
719
        page := 0.
×
720
        foundProject := OrderedCollection new.
×
721
        newlyFoundProjects := { true }.
×
722
        [ newlyFoundProjects isNotEmpty ] whileTrue: [
×
723
                | results |
×
724
                page := page + 1.
×
725
                ('import projects page #' , page printString) recordInfo.
×
726

×
727
                results := self repoApi projects: amount since: since page: page.
×
728

×
729
                newlyFoundProjects := self glhModel
×
730
                                              addAll: (self parseArrayOfProject: results)
×
731
                                              unless: self blockOnIdEquality.
×
732
                foundProject addAll: newlyFoundProjects ].
×
733
]
×
734

735
{ #category : #'import - projects' }
NEW
736
GLHModelImporter >> importProjects: aCollectionOfProjectID [
×
NEW
737

×
NEW
738

×
NEW
UNCOV
739
        ^ aCollectionOfProjectID collect: [ :id | self importProject: id ]
×
NEW
UNCOV
740
]
×
741

742
{ #category : #'import - repositories' }
743
GLHModelImporter >> importRepository: aGLHRepository [
1✔
744

1✔
745
        | resultBranches branches |
1✔
746
        [
1✔
747
        ('import the repository of project ' , aGLHRepository project name)
1✔
748
                recordInfo.
1✔
749

1✔
750
        resultBranches := self repoApi branches getAllFromProject: aGLHRepository project id.
1✔
751
        
1✔
752
        branches := (resultBranches collect: [ :branchesJson | self parseBranchesResult: branchesJson ]) flattened.
1✔
753

1✔
754
        'import the branches of project ' recordInfo.
1✔
755

1✔
756
        branches := aGLHRepository branches
1✔
757
                            addAll: branches
1✔
758
                            unless: self blockOnNameEquality.
1✔
759
        branches := self glhModel
1✔
760
                            addAll: branches
1✔
761
                            unless: self blockOnNameEquality.
1✔
762

1✔
763

1✔
764
        self withFiles ifTrue: [
1✔
765
                branches do: [ :branch | self importFilesOfBranch: branch ] ] ]
1✔
766
                on: NeoJSONParseError
1✔
767
                do: [
1✔
768
                self inform: aGLHRepository project name , ' has no repository' ]
1✔
769
]
1✔
770

771
{ #category : #'import - users' }
772
GLHModelImporter >> importUser: aUserID [
1✔
773

1✔
774
        | result userResult |
1✔
775
        (self glhModel allWithType: GLHUser)
1✔
776
                detect: [ :user | user id = aUserID ]
1✔
777
                ifFound: [ :user | ^ user ].
1✔
778
        ('Import user: ' , aUserID printString) recordInfo.
1✔
779
        
1✔
780
        result := self repoApi users get: aUserID.
1✔
781
        userResult := self parseUserResult: result.
1✔
782
        
1✔
783
        ^ self glhModel add: userResult unless: self blockOnIdEquality
1✔
784
]
1✔
785

786
{ #category : #'import - users' }
787
GLHModelImporter >> importUserByUsername: anUsername [
1✔
788

1✔
789
        | dicUsername resultUser |
1✔
790
        dicUsername := ((self glhModel allWithType: GLHUser) collect: [ :user |
1✔
791
                                user username -> user ]) asSet asDictionary.
1✔
792

1✔
793
        dicUsername addAll: self userCatalogue collectUsernames.
1✔
794

1✔
795

1✔
796
        resultUser := dicUsername
1✔
797
                              at: anUsername
1✔
798
                              ifAbsent: [ "thus we have to import this new user"
1✔
799
                                      | result userId searchResult params |
1✔
800
                                      ('Import user with username: '
1✔
801
                                       , anUsername printString) recordInfo.
1✔
802
                                      params := { (#search -> anUsername) } asDictionary.
1✔
803
                                      result := self repoApi users allWithParams: params.
1✔
804
                                                        
1✔
805
                                                         "when result is an error"
1✔
806
                                                         (result isString) ifTrue: [ result := { result } ].
1✔
807
                                                        
1✔
808
                                      searchResult := result ifEmpty: [ result ] ifNotEmpty: [(result collect: [ :usersJson |
1✔
809
                                                               NeoJSONReader fromString: usersJson ]) first].
1✔
810
                                                         
1✔
811
                                      (searchResult class = Dictionary and: [
1✔
812
                                               (searchResult at: #message) includesSubstring:
1✔
813
                                                       '403 Forbidden' ])
1✔
814
                                              ifTrue: [ "if the result is an 403 error we fake a new user"
1✔
815
                                                      self glhModel
1✔
816
                                                              add: (GLHUser new
1✔
817
                                                                               username: anUsername;
1✔
818
                                                                               name: anUsername;
1✔
819
                                                                               yourself)
1✔
820
                                                              unless: [ :nu :ou | nu username = ou username ] ]
1✔
821
                                              ifFalse: [
1✔
822
                                                      searchResult
1✔
823
                                                              ifEmpty: [ "results can be empty thus we force a new user with the info we have "
1✔
824
                                                                      self glhModel
1✔
825
                                                                              add: (GLHUser new
1✔
826
                                                                                               username: anUsername;
1✔
827
                                                                                               name: anUsername;
1✔
828
                                                                                               yourself)
1✔
829
                                                                              unless: [ :nu :ou | nu username = ou username ] ]
1✔
830
                                                              ifNotEmpty: [ "because we may already have the researched user, we look by ID in the model"
1✔
831
                                                                      userId := searchResult first at: #id.
1✔
832
                                                                      (self glhModel allWithType: GLHUser)
1✔
833
                                                                              detect: [ :user | user id = userId ]
1✔
834
                                                                              ifNone: [ self importUser: userId ] ] ] ].
1✔
835

1✔
836
        self userCatalogue addUser: resultUser withName: anUsername.
1✔
837

1✔
838
        ^ resultUser
1✔
839
]
1✔
840

841
{ #category : #initialization }
842
GLHModelImporter >> initReader [
1✔
843

1✔
844
        generalReader := NeoJSONReader new.
1✔
845
        self configureReaderForCommit: generalReader.
1✔
846
        self configureReaderForGroup: generalReader.
1✔
847
        self configureReaderForDiffs: generalReader. 
1✔
848
]
1✔
849

850
{ #category : #initialization }
851
GLHModelImporter >> initialize [
1✔
852

1✔
853
        super initialize.
1✔
854
        withCommitDiffs := false.
1✔
855
        withInitialCommits := false.
1✔
856
        withInitialMergeRequest := false.
1✔
857

1✔
858
        withCommitsSince := (Date today - 1 week) asDateAndTime.
1✔
859

1✔
860
        self initReader.
1✔
861

1✔
862
]
1✔
863

864
{ #category : #private }
865
GLHModelImporter >> isServerError: aString [
1✔
866
        ^ aString = '{"message":"500 Internal Server Error"}'
1✔
867
]
1✔
868

869
{ #category : #'import - projects' }
870
GLHModelImporter >> loadAllProjectsFromRepositorySoftware [
×
871
        "heavy import that load all the active project inside the model. Only import the project entities"
×
872
        |projects|
×
873
        
×
874
        projects := self repoApi projects. 
×
875
]
×
876

877
{ #category : #'private - parsing' }
878
GLHModelImporter >> newParseCommitResult: result [
×
879

×
880
        generalReader  on: result readStream.
×
881

×
882
        ^ generalReader nextAs: GLHCommit
×
883
]
×
884

885
{ #category : #'private - parsing' }
886
GLHModelImporter >> newParseDiffResult: result [
1✔
887

1✔
888
        generalReader on: result readStream.
1✔
889
        ^ generalReader nextAs: #ArrayOfDiffs
1✔
890
]
1✔
891

892
{ #category : #'private - parsing' }
893
GLHModelImporter >> parseArrayOfProject: arrayOfProjects [
×
894

×
895
        | reader |
×
896
        reader := NeoJSONReader on: arrayOfProjects readStream.
×
897
        reader
×
898
                for: #ArrayOfProjects
×
899
                customDo: [ :customMappting |
×
900
                customMappting listOfElementSchema: GLHProject ].
×
901
        reader for: GLHProject do: [ :mapping |
×
902
                mapping mapInstVar: #name to: #name.
×
903
                mapping mapInstVar: #description to: #description.
×
904
                mapping mapInstVar: #id to: #id.
×
905
                mapping mapInstVar: #archived to: #archived.
×
906
                mapping mapInstVar: #web_url to: #html_url.
×
907
                mapping mapInstVar: #topics to: #topics ].
×
908
        ^ reader nextAs: #ArrayOfProjects
×
909
]
×
910

911
{ #category : #'private - parsing' }
912
GLHModelImporter >> parseBranchesResult: result [
1✔
913

1✔
914
        | reader |
1✔
915
        reader := NeoJSONReader on: result readStream.
1✔
916
        reader mapInstVarsFor: GLHBranch.
1✔
917
        reader
1✔
918
                for: #ArrayOfBranch
1✔
919
                customDo: [ :customMappting | 
1✔
920
                customMappting listOfElementSchema: GLHBranch ].
1✔
921
        ^ reader nextAs: #ArrayOfBranch
1✔
922
]
1✔
923

924
{ #category : #'private - parsing' }
925
GLHModelImporter >> parseCommitResult: result [
×
926

×
927
        | reader |
×
928
        reader := NeoJSONReader on: result readStream.
×
929

×
930
        reader for: GLHCommit do: [ :mapping |
×
931
                mapping mapInstVars:
×
932
                        #( id short_id title author_name author_email committer_name
×
933
                           committer_email message web_url ).
×
934
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
×
935
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
×
936
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
×
937
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
×
938
                mapping
×
939
                        mapProperty: 'stats'
×
940
                        getter: [ :el | "Not used" ]
×
941
                        setter: [ :commit :value |
×
942
                                commit deletions: (value at: #deletions).
×
943
                                commit additions: (value at: #additions) ] ].
×
944

×
945
        reader for: DateAndTime customDo: [ :mapping |
×
946
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
×
947

×
948
        reader
×
949
                for: #ArrayOfIds
×
950
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
×
951

×
952

×
953
        ^ reader nextAs: GLHCommit
×
954
]
×
955

956
{ #category : #'private - parsing' }
957
GLHModelImporter >> parseCommitsResult: result [
1✔
958

1✔
959
        | reader |
1✔
960
        reader := NeoJSONReader on: result readStream.
1✔
961

1✔
962
          reader for: GLHCommit do: [ :mapping |
1✔
963
                mapping mapInstVars:
1✔
964
                        #( id short_id title author_name author_email committer_name
1✔
965
                           committer_email message web_url ).
1✔
966
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
967
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
968
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
969
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
970
                mapping
1✔
971
                        mapProperty: 'stats'
1✔
972
                        getter: [ :el | "Not used" ]
1✔
973
                        setter: [ :commit :value |
1✔
974
                                commit deletions: (value at: #deletions).
1✔
975
                                commit additions: (value at: #additions) ] ].
1✔
976

1✔
977
        reader for: DateAndTime customDo: [ :mapping |
1✔
978
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
979

1✔
980
        reader
1✔
981
                for: #ArrayOfIds
1✔
982
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
983
  
1✔
984
        reader
1✔
985
                for: #ArrayOfCommit
1✔
986
                customDo: [ :customMappting |
1✔
987
                customMappting listOfElementSchema: GLHCommit ].
1✔
988

1✔
989
        ^ reader nextAs: #ArrayOfCommit
1✔
990
]
1✔
991

992
{ #category : #private }
993
GLHModelImporter >> parseDiffResult: result [
×
994

×
995
        | reader |
×
996
        self
×
997
                deprecated: 'Use #newParseDiffResult: instead'
×
998
                on: '28 June 2024'
×
999
                in:
×
1000
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
×
1001
        reader := NeoJSONReader on: result readStream.
×
1002
        reader for: GLHDiff do: [ :mapping |
×
1003
                mapping mapInstVars:
×
1004
                        #( deleted_file new_file new_path old_path renamed_file ).
×
1005
                mapping mapInstVar: #diffString to: #diff ].
×
1006

×
1007
        reader
×
1008
                for: #ArrayOfDiffs
×
1009
                customDo: [ :customMappting |
×
1010
                customMappting listOfElementSchema: GLHDiff ].
×
1011
        ^ reader nextAs: #ArrayOfDiffs
×
1012
]
×
1013

1014
{ #category : #'private - parsing' }
1015
GLHModelImporter >> parseFileTreeResult: aResult [
×
1016

×
1017
        | reader |
×
1018
        reader := NeoJSONReader on: aResult readStream.
×
1019
        reader mapInstVarsFor: GLHApiFile.
×
1020
        reader
×
1021
                for: #ArrayOfFile
×
1022
                customDo: [ :customMappting | 
×
1023
                customMappting listOfElementSchema: GLHApiFile ].
×
1024
        ^ reader nextAs: #ArrayOfFile
×
1025
]
×
1026

1027
{ #category : #'private - parsing' }
1028
GLHModelImporter >> parseGroupResult: aResult [
1✔
1029

1✔
1030
        | reader |
1✔
1031

1✔
1032
        reader := NeoJSONReader on: aResult readStream.
1✔
1033
        reader for: GLHGroup do: [ :mapping |
1✔
1034
                mapping mapInstVars.
1✔
1035
                (mapping mapInstVar: #projects) valueSchema: #ArrayOfProjects ].
1✔
1036
        reader mapInstVarsFor: GLHProject.
1✔
1037
        reader
1✔
1038
                for: #ArrayOfProjects
1✔
1039
                customDo: [ :customMappting |
1✔
1040
                customMappting listOfElementSchema: GLHProject ].
1✔
1041
        ^ reader nextAs: GLHGroup
1✔
1042
]
1✔
1043

1044
{ #category : #'private - parsing' }
1045
GLHModelImporter >> parseJobsResult: result ofProject: aProject [
×
1046

×
1047
        | reader |
×
1048
        reader := NeoJSONReader on: result readStream.
×
1049
        reader for: GLHJob do: [ :mapping |
×
1050
                mapping mapInstVars: #( id allow_failure web_url name ).
×
1051

×
1052
                mapping
×
1053
                        mapProperty: #user
×
1054
                        getter: [ :object | #ignore ]
×
1055
                        setter: [ :object :value |
×
1056
                        object user: (self importUser: (value at: #id)) ].
×
1057

×
1058
                mapping
×
1059
                        mapProperty: #commit
×
1060
                        getter: [ :object | #ignore ]
×
1061
                        setter: [ :object :value |
×
1062
                                value ifNotNil: [
×
1063
                                        object commit:
×
1064
                                                (self importCommit: (value at: #id) ofProject: aProject) ] ].
×
1065

×
1066
                mapping
×
1067
                        mapProperty: #duration
×
1068
                        getter: [ :object | #ignore ]
×
1069
                        setter: [ :object :value |
×
1070
                        value ifNotNil: [ object duration: value seconds ] ] ].
×
1071

×
1072
        reader
×
1073
                for: #ArrayOfGLHJob
×
1074
                customDo: [ :customMappting |
×
1075
                customMappting listOfElementSchema: GLHJob ].
×
1076
        ^ reader nextAs: #ArrayOfGLHJob
×
1077
]
×
1078

1079
{ #category : #'private - parsing' }
1080
GLHModelImporter >> parsePipelinesResult: result [
×
1081

×
1082
        | reader |
×
1083
        
×
1084
        (result includesSubstring: '{"message":"40' )ifTrue: [ ^ {  } ].
×
1085
        
×
1086
        reader := NeoJSONReader on: result readStream.
×
1087
        reader mapInstVarsFor: GLHPipeline.
×
1088
        reader for: GLHPipeline do: [ :mapping |
×
1089
                mapping
×
1090
                        mapProperty: #created_at
×
1091
                        getter: [ :object | #ignore ]
×
1092
                        setter: [ :object :value |
×
1093
                        object runDate: (DateAndTime fromString: value) ] ].
×
1094
        reader
×
1095
                for: #ArrayOfPipelines
×
1096
                customDo: [ :customMappting |
×
1097
                customMappting listOfElementSchema: GLHPipeline ].
×
1098
        ^ reader nextAs: #ArrayOfPipelines
×
1099
]
×
1100

1101
{ #category : #'private - parsing' }
1102
GLHModelImporter >> parseProjectResult: aResult [ 
×
1103
                | reader |
×
1104
        reader := NeoJSONReader on: aResult readStream.
×
1105
        reader for: GLHProject do: [ :mapping |
×
1106
                mapping mapInstVars. ].
×
1107
"        reader mapInstVarsFor: GLHProject."
×
1108

×
1109
        ^ reader nextAs: GLHProject
×
1110
]
×
1111

×
1112
{ #category : #'private - parsing' }
×
1113
GLHModelImporter >> parseSubGroupResult: aResult [
×
1114

×
1115
        | reader |
×
1116
        reader := NeoJSONReader on: aResult readStream.
×
1117
        self configureReaderForGroup: reader.
×
1118
        ^ reader nextAs: #ArrayOfGroups
×
1119
]
×
1120

×
1121
{ #category : #'private - parsing' }
×
1122
GLHModelImporter >> parseUserResult: result [
×
1123

×
1124
        | reader |
×
1125
        reader := NeoJSONReader on: result readStream.
×
1126
        reader mapInstVarsFor: GLHUser.
×
1127
        ^ reader nextAs: GLHUser
×
1128
]
×
1129

×
1130
{ #category : #'private - parsing' }
×
1131
GLHModelImporter >> parseUsersResult: result [
×
1132

×
1133
        | reader |
×
1134
        reader := NeoJSONReader on: result readStream.
×
1135

×
1136
        reader mapInstVarsFor: GLHUser.
×
1137

×
1138
        reader
×
1139
                for: #ArrayOfUser
×
1140
                customDo: [ :customMappting |
×
1141
                customMappting listOfElementSchema: GLHUser ].
×
1142

×
1143
        ^ reader nextAs: #ArrayOfUser
×
1144
]
×
1145

×
1146
{ #category : #'imports - pipelines' }
×
1147
GLHModelImporter >> pipelinesOf: aProjectID [
×
1148

×
1149
        | result |
×
1150
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
×
1151
        result := self repoApi pipelines getAllInProject: aProjectID.
×
NEW
1152
        "pipelinesOfProject: aProjectID."
×
NEW
1153
        ^ (result collect: [ :pipelinesJson | self parsePipelinesResult: pipelinesJson ]) flattened
×
1154
]
×
1155

×
1156
{ #category : #private }
×
1157
GLHModelImporter >> selectEntityType: aType overAttribut: aSelector equalTo: value [
×
1158

×
1159
        ^ (self glhModel allWithType: aType)
×
1160
                select: [ :entity | (entity perform: aSelector) = value ]
×
1161
]
×
1162

×
1163
{ #category : #'import - groups' }
×
1164
GLHModelImporter >> subGroupsOf: aGroupID [
×
1165

×
1166
        | results subgroups |
×
1167
        ('Search subgroup of: ' , aGroupID printString) recordInfo.
×
1168
        results := self repoApi groups subgroupsOf: aGroupID.
×
1169
        subgroups := (results collect: [ :subgroupsJson | self parseSubGroupResult: subgroupsJson ]) flattened.
×
1170
        
×
1171
        ^ subgroups
×
1172
]
×
1173

×
1174
{ #category : #accessing }
×
1175
GLHModelImporter >> withInitialCommits: boolean [
×
1176
        withInitialCommits := boolean 
×
1177
]
×
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