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

moosetechnology / GitProjectHealth / 11294373435

11 Oct 2024 02:41PM UTC coverage: 58.623% (+2.4%) from 56.272%
11294373435

push

github

web-flow
Merge pull request #81 from moosetechnology/refactoring/rename

Refactoring/rename

34 of 105 new or added lines in 7 files covered. (32.38%)

5 existing lines in 1 file now uncovered.

8957 of 15279 relevant lines covered (58.62%)

0.59 hits per line

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

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

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

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

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

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

40
{ #category : #'as yet unclassified' }
41
GLHModelImporter >> chainsCommitsFrom: commitsCollection [
1✔
42

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

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

62
{ #category : #'private - api' }
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 : #'as yet unclassified' }
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
×
178
]
×
179

180
{ #category : #'as yet unclassified' }
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 [
1✔
189

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

1✔
196
        ^ repoApi
1✔
197
]
1✔
198

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

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

1✔
208
        repoApi := anObject
1✔
209
]
1✔
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 : #'as yet unclassified' }
224
GLHModelImporter >> importActiveHumanUsers [
×
225

×
226
        | newlyFoundUser page foundUsers |
×
227
        page := 0.
×
228
        foundUsers := OrderedCollection new.
×
229
        newlyFoundUser := { true }.
×
230
        [ newlyFoundUser isNotEmpty ] whileTrue: [
×
231
                | results |
×
232
                page := page + 1.
×
233
                ('import users page ' , page printString) recordInfo.
×
234
                results := self glhApi
×
235
                                   usersHuman: true
×
236
                                   active: true
×
237
                                   withoutProjectBots: true
×
238
                                   perPage: 100
×
239
                                   page: page.
×
240

×
241
                newlyFoundUser := self parseUsersResult: results.
×
242
                "newlyFoundCommit do: [ :c | c repository: aProject repository ]."
×
243

×
244
                foundUsers addAll:
×
245
                        (self glhModel
×
246
                                 addAll: newlyFoundUser
×
247
                                 unless: self blockOnIdEquality) ].
×
248

×
249

×
250
        ^ foundUsers
×
251
]
×
252

253
{ #category : #api }
254
GLHModelImporter >> importAllGroups [
×
255

×
256
        | page foundGroups newlyFoundGroups |
×
257
        page := 0.
×
258
        foundGroups := OrderedCollection new.
×
259
        newlyFoundGroups := { true }.
×
260
        [ newlyFoundGroups isNotEmpty ] whileTrue: [
×
261
                | results |
×
262
                page := page + 1.
×
263
                results := self glhApi listGroupsWithTopLevelOnly: true page: page.
×
264

×
265
                newlyFoundGroups := generalReader
×
266
                                            on: results readStream;
×
267
                                            nextAs: #ArrayOfGroups.
×
268
                foundGroups addAll: newlyFoundGroups ].
×
269
        ^ foundGroups
×
270
]
×
271

272
{ #category : #'as yet unclassified' }
273
GLHModelImporter >> importAndLoadLatestsCommitsOfProject: aGLHProject [
×
274

×
275
        | commits |
×
276
        self completeImportProject: aGLHProject.
×
277
        commits := self importLastestCommitsOfProject: aGLHProject.
×
278
        commits do: [ :commit | self completeImportedCommit: commit ].
×
279
        self chainsCommitsFrom: commits.
×
280
        ^ commits
×
281
]
×
282

283
{ #category : #'private - api' }
284
GLHModelImporter >> importCommit: aCommitID ofProject: aGLHProject [
×
285

×
286
        | result parsedResult |
×
287
        (self glhModel allWithType: GLHCommit) asOrderedCollection
×
288
                detect: [ :commit | commit id = aCommitID ]
×
289
                ifFound: [ :commit | ^ commit ].
×
290
        result := self glhApi
×
291
                          commit: aCommitID
×
292
                          ofProject: aGLHProject id
×
293
                          withStat: true.
×
294
        parsedResult := self parseCommitResult: result.
×
295
        self
×
296
                addCommits: { parsedResult }
×
297
                toRepository: aGLHProject repository.
×
298
        ^ parsedResult
×
299
]
×
300

301
{ #category : #'as yet unclassified' }
302
GLHModelImporter >> importCommitOfProject: anProject withId: anID [
1✔
303

1✔
304
        | commit result |
1✔
305
        anID ifNil: [ ^ nil ].
1✔
306

1✔
307
        ('looking for commit ' , anID printString , ' in project : '
1✔
308
         , anProject id printString) recordInfo.
1✔
309

1✔
310
        commit := (self
1✔
311
                           detectEntityType: GLHCommit
1✔
312
                           overAttribut: #id
1✔
313
                           equalTo: anID) ifNil: [
1✔
314
                          result := self glhApi commit: anID ofProject: anProject id.
1✔
315
                          commit := (self parseCommitsResult: '[' , result , ']')
1✔
316
                                            first.
1✔
317

1✔
318
                          self glhModel add: commit unless: self blockOnIdEquality.
1✔
319
                          commit repository: anProject repository.
1✔
320

1✔
321
                          commit ].
1✔
322

1✔
323
        self withCommitDiffs ifTrue: [ self importDiffOfCommit: commit ].
1✔
324

1✔
325
        ^ commit
1✔
326
]
1✔
327

328
{ #category : #'private - api' }
329
GLHModelImporter >> importCommits: aGLHProject [
×
330
        "limited to the last 20 commits"
×
331

×
332
        | results parsedResults |
×
333
        results := self glhApi
×
334
                           commitsOfProject: aGLHProject id
×
335
                           forRefName: nil
×
336
                           since: nil
×
337
                           until: nil
×
338
                           path: nil
×
339
                           author: nil
×
340
                           all: nil
×
341
                           with_stats: true
×
342
                           firstParent: nil
×
343
                           order: nil
×
344
                           trailers: nil
×
345
                           perPage: nil
×
346
                           page: nil.
×
347
        parsedResults := self parseCommitsResult: results.
×
348
        self glhModel addAll: parsedResults unless: self blockOnIdEquality.
×
349

×
350
        parsedResults do: [ :commit |
×
351
                commit repository: aGLHProject repository ].
×
352

×
353
        self withCommitDiffs ifTrue: [
×
354
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
×
355
        
×
356
        ^ parsedResults. 
×
357
]
×
358

359
{ #category : #'as yet unclassified' }
360
GLHModelImporter >> importCommitsFollowing: aCommit upToDays: aNumberOfDay [
×
361
        "import the 'n' commits of a project starting from an initial 'aCommit' commit. 
×
362
        Lazy import does not import the entities inside the model"
×
363

×
364
        | date |
×
365
        date := aCommit created_at asDateAndTime.
×
366

×
367
        ^ self
×
368
                  importCommitsOfBranch: aCommit branch
×
369
                  forRefName: aCommit branch name
×
370
                  since: date
×
371
                  until: (date + aNumberOfDay day)
×
372
]
×
373

374
{ #category : #commit }
375
GLHModelImporter >> importCommitsOf: aGLHProject withStats: aBoolean until: toDate [
×
376

×
377
        | newlyFoundCommit page |
×
378
        
×
379
        self deprecated: [  ] .
×
380
        
×
381
        page := 0.
×
382
        newlyFoundCommit := { true }.
×
383
        [ newlyFoundCommit isNotEmpty ] whileTrue: [
×
384
                | results parsedResults existingCommits |
×
385
                page := page + 1.
×
386
                ('import commit page ' , page printString) recordInfo.
×
387
                results := self glhApi
×
388
                                   commitsOfProject: aGLHProject id
×
389
                                   forRefName: nil
×
390
                                   since: nil
×
391
                                   until: nil
×
392
                                   path: nil
×
393
                                   author: nil
×
394
                                   all: nil
×
395
                                   with_stats: aBoolean
×
396
                                   firstParent: nil
×
397
                                   order: nil
×
398
                                   trailers: nil
×
399
                                   perPage: 100
×
400
                                   page: page.
×
401
                parsedResults := self parseCommitsResult: results.
×
402
                existingCommits := aGLHProject mooseModel allWithType: GLHCommit.
×
403

×
404
                newlyFoundCommit := parsedResults reject: [ :commitParsed |
×
405
                                            (toDate isNil or: [
×
406
                                                     commitParsed committed_date
×
407
                                                     < toDate asDateAndTime ]) or: [
×
408
                                                    existingCommits anySatisfy: [ :existingCommit |
×
409
                                                            existingCommit id = commitParsed id ] ] ].
×
410
                aGLHProject mooseModel addAll: newlyFoundCommit.
×
411
                aGLHProject repository commits addAll: newlyFoundCommit ].
×
412

×
413

×
414
        self withCommitDiffs ifTrue: [
×
415
                aGLHProject repository commits do: [ :commit |
×
416
                        self importDiffOfCommit: commit ] ]
×
417
]
×
418

419
{ #category : #commit }
420
GLHModelImporter >> importCommitsOfBranch: aGLHBranch forRefName: refName since: fromDate [
×
421

×
422
        ^ self
×
423
                  importCommitsOfBranch: aGLHBranch
×
424
                  forRefName: aGLHBranch name
×
425
                  since: fromDate
×
426
                  until: nil
×
427
]
×
428

429
{ #category : #commit }
430
GLHModelImporter >> importCommitsOfBranch: aGLHBranch forRefName: refName since: fromDate until: toDate [
×
431

×
432
        | newlyFoundCommit page foundCommit|
×
433
        page := 0.
×
434
        foundCommit := OrderedCollection new. 
×
435
        newlyFoundCommit := { true }.
×
436
        [ newlyFoundCommit isNotEmpty ] whileTrue: [
×
437
                | results |
×
438
                page := page + 1.
×
439
                ('import commit page ' , page printString) recordInfo.
×
440
                results := self glhApi
×
441
                                   commitsOfProject: aGLHBranch repository project id
×
442
                                   forRefName: aGLHBranch name
×
443
                                   since:
×
444
                                   (fromDate ifNotNil: [ fromDate asDateAndTime asString ])
×
445
                                   until:
×
446
                                   (toDate ifNotNil: [ toDate asDateAndTime asString ])
×
447
                                   path: nil
×
448
                                   author: nil
×
449
                                   all: nil
×
450
                                   with_stats: nil
×
451
                                   firstParent: nil
×
452
                                   order: nil
×
453
                                   trailers: nil
×
454
                                   perPage: 100
×
455
                                   page: page.
×
456

×
457
                newlyFoundCommit := self parseCommitsResult: results.
×
458
        aGLHBranch commits
×
459
                        addAll: newlyFoundCommit
×
460
                        unless: self blockOnIdEquality.
×
461
        foundCommit addAll: newlyFoundCommit.  
×
462
                        ].
×
463

×
464
        self glhModel
×
465
                addAll: aGLHBranch commits
×
466
                unless: self blockOnIdEquality.
×
467

×
468
        "self withCommitDiffs ifTrue: [
×
469
                aGLHBranch commits: [ :commit | self importDiffOfCommit: commit ] ]."
×
470

×
471
        ^ foundCommit
×
472
]
×
473

474
{ #category : #commit }
475
GLHModelImporter >> importCommitsOfBranch: aGLHBranch forRefName: refName until: toDate [
×
476

×
477
        ^ self
×
478
                  importCommitsOfBranch: aGLHBranch
×
479
                  forRefName: aGLHBranch name
×
480
                  since: nil
×
481
                  until: toDate
×
482
]
×
483

484
{ #category : #commit }
485
GLHModelImporter >> importCommitsOfProject: aProject since: fromDate until: toDate [
1✔
486

1✔
487
        | newlyFoundCommit page foundCommit |
1✔
488
        page := 0.
1✔
489
        foundCommit := OrderedCollection new.
1✔
490
        newlyFoundCommit := { true }.
1✔
491
        [ newlyFoundCommit isNotEmpty ] whileTrue: [
1✔
492
                | results |
1✔
493
                page := page + 1.
1✔
494
                ('import commit page ' , page printString) recordInfo.
1✔
495
                results := self glhApi
1✔
496
                                   commitsOfProject: aProject id
1✔
497
                                   forRefName: nil
1✔
498
                                   since:
1✔
499
                                   (fromDate ifNotNil: [ fromDate asDateAndTime asString ])
1✔
500
                                   until:
1✔
501
                                   (toDate ifNotNil: [ toDate asDateAndTime asString ])
1✔
502
                                   path: nil
1✔
503
                                   author: nil
1✔
504
                                   all: true
1✔
505
                                   with_stats: true
1✔
506
                                   firstParent: nil
1✔
507
                                   order: nil
1✔
508
                                   trailers: nil
1✔
509
                                   perPage: 100
1✔
510
                                   page: page.
1✔
511

1✔
512
                newlyFoundCommit := self parseCommitsResult: results.
1✔
513
                "newlyFoundCommit do: [ :c | c repository: aProject repository ]."
1✔
514

1✔
515
                foundCommit addAll: (aProject repository commits
1✔
516
                        addAll: newlyFoundCommit
1✔
517
                        unless: self blockOnIdEquality). ].
1✔
518

1✔
519

1✔
520
        ^ self glhModel addAll: foundCommit unless: self blockOnIdEquality
1✔
521
]
1✔
522

523
{ #category : #'as yet unclassified' }
524
GLHModelImporter >> importContributedProjectsOfUser: aGLHUser [
×
525

×
526
        | newlyFoundElmts page foundElmts remaningProjects |
×
527
        page := 0.
×
528
        foundElmts := OrderedCollection new.
×
529
        newlyFoundElmts := { true }.
×
530
        [ newlyFoundElmts isNotEmpty ] whileTrue: [
×
531
                | results |
×
532
                page := page + 1.
×
533
                ('import contributed project of user ' , aGLHUser name , ' page '
×
534
                 , page printString) recordInfo.
×
535
                results := self repoApi
×
536
                                   contributedProjectsOfUserId: aGLHUser id
×
537
                                   orderBy: 'last_activity_at'
×
538
                                   simple: true
×
539
                                   sort: 'desc'
×
540
                                   perPage: 100
×
541
                                   page: page.
×
542

×
543
                newlyFoundElmts := self parseArrayOfProject: results.
×
544

×
545
                foundElmts addAll:
×
546
                        (self glhModel
×
547
                                 addAll: newlyFoundElmts
×
548
                                 unless: self blockOnIdEquality) ].
×
549
        remaningProjects := self importProjects:
×
550
                                    ((foundElmts collect: #id) difference:
×
551
                                             ((self userCatalogue atId: aGLHUser id) at:
×
552
                                                      #contributedProjects)).
×
553

×
554
        aGLHUser contributedProjects
×
555
                addAll: foundElmts , remaningProjects
×
556
                unless: self blockOnIdEquality.
×
557

×
558
        self userCatalogue
×
559
                addUser: aGLHUser
×
560
                withProjects: (aGLHUser contributedProjects collect: #id).
×
561

×
562
        ^ foundElmts
×
563
]
×
564

565
{ #category : #'as yet unclassified' }
566
GLHModelImporter >> importCreatorOfCommit: aCommit [
1✔
567

1✔
568
        aCommit commitCreator ifNil: [                
1✔
569
                aCommit commitCreator:
1✔
570
                        (self importUserByUsername: aCommit author_name) ].
1✔
571
        self userCatalogue addUser: aCommit commitCreator withProject: aCommit repository project id.
1✔
572
        ^ aCommit commitCreator
1✔
573
]
1✔
574

575
{ #category : #api }
576
GLHModelImporter >> importDiffOfCommit: aCommit [
1✔
577

1✔
578
        | result diffsResult |
1✔
579
        aCommit diffs ifNotEmpty: [
1✔
580
                'Diff already importer: ' , aCommit short_id printString recordInfo.
1✔
581
                ^ aCommit diffs ].
1✔
582
        ('Import diff of commit: ' , aCommit short_id printString) recordInfo.
1✔
583
        result := self repoApi
1✔
584
                          commitDiff: aCommit id
1✔
585
                          ofProject: aCommit repository project id
1✔
586
                          unidiff: true.
1✔
587
        (self isServerError: result) ifTrue: [ ^ {  } ].
1✔
588
        diffsResult := self newParseDiffResult: result.
1✔
589

1✔
590
        ^ aCommit diffs addAll: diffsResult unless: self blockForDiffEquality.
1✔
591

1✔
592
]
1✔
593

594
{ #category : #'private - api' }
595
GLHModelImporter >> importDirectoryFiles: aDirectoryFile OfBranch: aBranch [
×
596

×
597
        | result files apiFiles |
×
598
        result := self glhApi
×
599
                          treeOfRepository: aBranch repository project id
×
600
                          ofBranch: aBranch name
×
601
                          andPath: aDirectoryFile path , '/'.
×
602
        apiFiles := self parseFileTreeResult: result.
×
603
        files := apiFiles collect: [ :apiFile |
×
604
                         self convertApiFileAsFile: apiFile ].
×
605
        files do: [ :file |
×
606
                
×
607
                self glhModel add: file.
×
608
                aDirectoryFile addFile: file ].
×
609
        files
×
610
                select: [ :file | file isKindOf: GLHFileDirectory ]
×
611
                thenCollect: [ :file |
×
612
                self importDirectoryFiles: file OfBranch: aBranch ]
×
613
]
×
614

615
{ #category : #'private - api' }
616
GLHModelImporter >> importFilesOfBranch: aBranch [
×
617

×
618
        | result files apiFiles |
×
619
        result := self glhApi
×
620
                          treeOfRepository: aBranch repository project id
×
621
                          ofBranch: aBranch name
×
622
                          andPath: nil.
×
623
        apiFiles := self parseFileTreeResult: result.
×
624
        files := apiFiles collect: [ :apiFile | 
×
625
                         self convertApiFileAsFile: apiFile ].
×
626
        files do: [ :file | 
×
627
                self glhModel add: file.
×
628
                aBranch addFile: file ].
×
629
        files
×
630
                select: [ :file | file isKindOf: GLHFileDirectory ]
×
631
                thenCollect: [ :file | 
×
632
                self importDirectoryFiles: file OfBranch: aBranch ]
×
633
]
×
634

635
{ #category : #api }
636
GLHModelImporter >> importGroup: aGroupID [
1✔
637

1✔
638
        | result groupResult |
1✔
639
        ('Import group: ' , aGroupID printString) recordInfo.
1✔
640

1✔
641
        result := self glhApi group: aGroupID.
1✔
642
        groupResult := self parseGroupResult: result.
1✔
643
        groupResult := self addGroupResultToModel: groupResult.
1✔
644

1✔
645
        groupResult projects do: [ :project |
1✔
646
                self completeImportProject: project ].
1✔
647

1✔
648
        (self subGroupsOf: aGroupID) do: [ :subGroup |
1✔
649
                
1✔
650
                groupResult subGroups
1✔
651
                        add: (self importGroup: subGroup id)
1✔
652
                        unless: self blockOnIdEquality ].
1✔
653
        ^ groupResult
1✔
654
]
1✔
655

656
{ #category : #api }
657
GLHModelImporter >> importJobsOf: aPipeline [
×
658

×
659
        | result jobs |
×
660
        result := self glhApi
×
661
                          jobsOfProject: aPipeline project id
×
662
                          ofPipelines: aPipeline id.
×
663
        jobs := self parseJobsResult: result ofProject: aPipeline project.
×
664
        jobs do: [ :job | aPipeline addJob: job ].
×
665
        self glhModel addAll: jobs
×
666

×
667
]
×
668

669
{ #category : #'private - api' }
670
GLHModelImporter >> importLastestCommitsOfProject: aGLHProject [
1✔
671
        "limited to the last 50 commits"
1✔
672

1✔
673
        | results parsedResults |
1✔
674
        results := self repoApi
1✔
675
                           commitsOfProject: aGLHProject id
1✔
676
                           forRefName: nil
1✔
677
                           since: nil
1✔
678
                           until: nil
1✔
679
                           path: nil
1✔
680
                           author: nil
1✔
681
                           all: true
1✔
682
                           with_stats: true
1✔
683
                           firstParent: nil
1✔
684
                           order: nil
1✔
685
                           trailers: nil
1✔
686
                           perPage: 50
1✔
687
                           page: nil.
1✔
688
        parsedResults := self parseCommitsResult: results.
1✔
689
        parsedResults := self glhModel
1✔
690
                                 addAll: parsedResults
1✔
691
                                 unless: self blockOnIdEquality.
1✔
692

1✔
693
        aGLHProject repository commits
1✔
694
                addAll: parsedResults
1✔
695
                unless: self blockOnIdEquality.
1✔
696
        "parsedResults do: [ :commit |
1✔
697
                commit repository: aGLHProject repository ]."
1✔
698

1✔
699
        self withCommitDiffs ifTrue: [
1✔
700
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
1✔
701

1✔
702
        ^ parsedResults
1✔
703
]
1✔
704

705
{ #category : #commit }
706
GLHModelImporter >> importParentCommitsOfCommit: aGLHCommit since: aDate [
×
707

×
708
        | parentsIds commits |
×
709
        commits := OrderedCollection new.
×
710
        aGLHCommit created_at asDateAndTime < aDate asDateAndTime ifTrue: [
×
711
                 
×
712
                ^ commits
×
713
                          add: aGLHCommit;
×
714
                          yourself ].
×
715

×
716
        parentsIds := aGLHCommit parent_ids.
×
717

×
718
        commits addAll: (parentsIds collect: [ :id |
×
719
                         self
×
720
                                 importCommitOfProject: aGLHCommit repository project
×
721
                                 withId: id ]).
×
722

×
723

×
724
        ^ (commits collect: [ :parentCommit |
×
725
                   self importParentCommitsOfCommit: parentCommit since: aDate ])
×
726
                  flatten
×
727
]
×
728

729
{ #category : #'private - api' }
730
GLHModelImporter >> importPipelinesOfProject: aGLHProject [
1✔
731

1✔
732
        (self pipelinesOf: aGLHProject id) do: [ :pipeline |
1✔
733
                self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
734
                aGLHProject pipelines add: pipeline unless: self blockOnIdEquality]
1✔
735
]
1✔
736

737
{ #category : #projects }
738
GLHModelImporter >> importProject: aProjectID [
×
739

×
740
        | result projectResult |
×
741
        ('Import project with id: ' , aProjectID printString) recordInfo.
×
742

×
743
        result := self glhApi project: aProjectID.
×
744
        projectResult := self parseProjectResult: result.
×
745

×
746
        ^ self completeImportProject: projectResult
×
747
]
×
748

749
{ #category : #imports }
750
GLHModelImporter >> importProjects [
×
751

×
752
        ^ self importProjectsSince: nil
×
753
]
×
754

755
{ #category : #projects }
756
GLHModelImporter >> importProjects: aCollectionOfProjectID [
×
757

×
758
        ^ aCollectionOfProjectID collect: [ :id | self importProject: id ]
×
759
]
×
760

761
{ #category : #imports }
762
GLHModelImporter >> importProjectsSince: since [
×
763
        "heavy import of all projects"
×
764

×
765
        "copy import from commits"
×
766

×
767
        | newlyFoundProjects page foundProject amount |
×
768
        ('import all Projects since: ' , since printString) recordInfo.
×
769

×
770
        "number of projects per page"
×
771
        amount := 100.
×
772
        page := 0.
×
773
        foundProject := OrderedCollection new.
×
774
        newlyFoundProjects := { true }.
×
775
        [ newlyFoundProjects isNotEmpty ] whileTrue: [
×
776
                | results |
×
777
                page := page + 1.
×
778
                ('import projects page #' , page printString) recordInfo.
×
779

×
780
                results := self glhApi projects: amount since: since page: page.
×
781

×
782
                newlyFoundProjects := self glhModel
×
783
                                              addAll: (self parseArrayOfProject: results)
×
784
                                              unless: self blockOnIdEquality.
×
785
                foundProject addAll: newlyFoundProjects ].
×
786

×
787
        ^ foundProject
×
788
]
×
789

790
{ #category : #'private - api' }
791
GLHModelImporter >> importRepository: aGLHRepository [
1✔
792

1✔
793
        | resultBranches branches |
1✔
794
        [
1✔
795
        ('import the repository of project ' , aGLHRepository project name)
1✔
796
                recordInfo.
1✔
797

1✔
798
        resultBranches := self repoApi branchesOfRepository:
1✔
799
                                  aGLHRepository project id.
1✔
800
        branches := self parseBranchesResult: resultBranches.
1✔
801

1✔
802
        'import the branches of project ' recordInfo.
1✔
803

1✔
804
        branches := aGLHRepository branches
1✔
805
                            addAll: branches
1✔
806
                            unless: self blockOnNameEquality.
1✔
807
        branches := self glhModel
1✔
808
                            addAll: branches
1✔
809
                            unless: self blockOnNameEquality.
1✔
810

1✔
811

1✔
812
        self withFiles ifTrue: [
1✔
813
                branches do: [ :branch | self importFilesOfBranch: branch ] ] ]
1✔
814
                on: NeoJSONParseError
1✔
815
                do: [
1✔
816
                self inform: aGLHRepository project name , ' has no repository' ]
1✔
817
]
1✔
818

819
{ #category : #'private - api' }
820
GLHModelImporter >> importUser: aUserID [
1✔
821

1✔
822
        | result userResult |
1✔
823
        (self glhModel allWithType: GLHUser)
1✔
824
                detect: [ :user | user id = aUserID ]
1✔
825
                ifFound: [ :user | ^ user ].
1✔
826
        ('Import user: ' , aUserID printString) recordInfo.
1✔
827
        result := self repoApi user: aUserID.
1✔
828
        userResult := self parseUserResult: result.
1✔
829
        ^ self glhModel add: userResult unless: self blockOnIdEquality
1✔
830
]
1✔
831

832
{ #category : #user }
833
GLHModelImporter >> importUserByUsername: anUsername [
1✔
834

1✔
835
        | dicUsername resultUser |
1✔
836
        dicUsername := ((self glhModel allWithType: GLHUser) collect: [ :user |
1✔
837
                                user username -> user ]) asSet asDictionary.
1✔
838

1✔
839
        dicUsername addAll: self userCatalogue collectUsernames.
1✔
840

1✔
841

1✔
842
        resultUser := dicUsername
1✔
843
                              at: anUsername
1✔
844
                              ifAbsent: [ "thus we have to import this new user"
1✔
845
                                      | result userId searchResult |
1✔
846
                                      ('Import user with username: '
1✔
847
                                       , anUsername printString) recordInfo.
1✔
848
                                      result := self repoApi usersSearchByUsername:
1✔
849
                                                        anUsername.
1✔
850
                                      searchResult := NeoJSONReader fromString: result.
1✔
851

1✔
852
                                      (searchResult class = Dictionary and: [
1✔
853
                                               (searchResult at: #message) includesSubstring:
1✔
854
                                                       '403 Forbidden' ])
1✔
855
                                              ifTrue: [ "if the result is an 403 error we fake a new user"
1✔
856
                                                      self glhModel
1✔
857
                                                              add: (GLHUser new
1✔
858
                                                                               username: anUsername;
1✔
859
                                                                               name: anUsername;
1✔
860
                                                                               yourself)
1✔
861
                                                              unless: [ :nu :ou | nu username = ou username ] ]
1✔
862
                                              ifFalse: [
1✔
863
                                                      searchResult
1✔
864
                                                              ifEmpty: [ "results can be empty thus we force a new user with the info we have "
1✔
865
                                                                      self glhModel
1✔
866
                                                                              add: (GLHUser new
1✔
867
                                                                                               username: anUsername;
1✔
868
                                                                                               name: anUsername;
1✔
869
                                                                                               yourself)
1✔
870
                                                                              unless: [ :nu :ou | nu username = ou username ] ]
1✔
871
                                                              ifNotEmpty: [ "because we may already have the researched user, we look by ID in the model"
1✔
872
                                                                      userId := searchResult first at: #id.
1✔
873
                                                                      (self glhModel allWithType: GLHUser)
1✔
874
                                                                              detect: [ :user | user id = userId ]
1✔
875
                                                                              ifNone: [ self importUser: userId ] ] ] ].
1✔
876

1✔
877
        self userCatalogue addUser: resultUser withName: anUsername.
1✔
878

1✔
879
        ^ resultUser
1✔
880
]
1✔
881

882
{ #category : #initialization }
883
GLHModelImporter >> initReader [
1✔
884

1✔
885
        generalReader := NeoJSONReader new.
1✔
886
        self configureReaderForCommit: generalReader.
1✔
887
        self configureReaderForGroup: generalReader.
1✔
888
        self configureReaderForDiffs: generalReader. 
1✔
889
]
1✔
890

891
{ #category : #initialization }
892
GLHModelImporter >> initialize [
1✔
893

1✔
894
        super initialize.
1✔
895
        withCommitDiffs := false.
1✔
896
        withInitialCommits := false.
1✔
897
        withInitialMergeRequest := false.
1✔
898

1✔
899
        withCommitsSince := (Date today - 1 week) asDateAndTime.
1✔
900

1✔
901
        self initReader.
1✔
902

1✔
903
]
1✔
904

905
{ #category : #api }
906
GLHModelImporter >> isServerError: aString [
1✔
907
        ^ aString = '{"message":"500 Internal Server Error"}'
1✔
908
]
1✔
909

910
{ #category : #importer }
911
GLHModelImporter >> loadAllProjectsFromRepositorySoftware [
×
912
        "heavy import that load all the active project inside the model. Only import the project entities"
×
913
        |projects|
×
914
        
×
915
        projects := self glhApi projects. 
×
916
]
×
917

918
{ #category : #private }
919
GLHModelImporter >> newParseCommitResult: result [
×
920

×
921
        generalReader  on: result readStream.
×
922

×
923
        ^ generalReader nextAs: GLHCommit
×
924
]
×
925

926
{ #category : #private }
927
GLHModelImporter >> newParseDiffResult: result [
1✔
928

1✔
929
        generalReader on: result readStream.
1✔
930
        ^ generalReader nextAs: #ArrayOfDiffs
1✔
931
]
1✔
932

933
{ #category : #parsing }
934
GLHModelImporter >> parseArrayOfProject: arrayOfProjects [
×
935

×
936
        | reader |
×
937
        reader := NeoJSONReader on: arrayOfProjects readStream.
×
938
        reader
×
939
                for: #ArrayOfProjects
×
940
                customDo: [ :customMappting |
×
941
                customMappting listOfElementSchema: GLHProject ].
×
942
        reader for: GLHProject do: [ :mapping |
×
943
                mapping mapInstVar: #name to: #name.
×
944
                mapping mapInstVar: #description to: #description.
×
945
                mapping mapInstVar: #id to: #id.
×
946
                mapping mapInstVar: #archived to: #archived.
×
947
                mapping mapInstVar: #web_url to: #html_url.
×
948
                mapping mapInstVar: #topics to: #topics ].
×
949
        ^ reader nextAs: #ArrayOfProjects
×
950
]
×
951

952
{ #category : #private }
953
GLHModelImporter >> parseBranchesResult: result [
1✔
954

1✔
955
        | reader |
1✔
956
        reader := NeoJSONReader on: result readStream.
1✔
957
        reader mapInstVarsFor: GLHBranch.
1✔
958
        reader
1✔
959
                for: #ArrayOfBranch
1✔
960
                customDo: [ :customMappting | 
1✔
961
                customMappting listOfElementSchema: GLHBranch ].
1✔
962
        ^ reader nextAs: #ArrayOfBranch
1✔
963
]
1✔
964

965
{ #category : #private }
966
GLHModelImporter >> parseCommitResult: result [
×
967

×
968
        | reader |
×
969
        reader := NeoJSONReader on: result readStream.
×
970

×
971
        reader for: GLHCommit do: [ :mapping |
×
972
                mapping mapInstVars:
×
973
                        #( id short_id title author_name author_email committer_name
×
974
                           committer_email message web_url ).
×
975
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
×
976
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
×
977
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
×
978
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
×
979
                mapping
×
980
                        mapProperty: 'stats'
×
981
                        getter: [ :el | "Not used" ]
×
982
                        setter: [ :commit :value |
×
983
                                commit deletions: (value at: #deletions).
×
984
                                commit additions: (value at: #additions) ] ].
×
985

×
986
        reader for: DateAndTime customDo: [ :mapping |
×
987
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
×
988

×
989
        reader
×
990
                for: #ArrayOfIds
×
991
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
×
992

×
993

×
994
        ^ reader nextAs: GLHCommit
×
995
]
×
996

997
{ #category : #private }
998
GLHModelImporter >> parseCommitsResult: result [
1✔
999

1✔
1000
        | reader |
1✔
1001
        reader := NeoJSONReader on: result readStream.
1✔
1002

1✔
1003
          reader for: GLHCommit do: [ :mapping |
1✔
1004
                mapping mapInstVars:
1✔
1005
                        #( id short_id title author_name author_email committer_name
1✔
1006
                           committer_email message web_url ).
1✔
1007
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
1008
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
1009
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
1010
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
1011
                mapping
1✔
1012
                        mapProperty: 'stats'
1✔
1013
                        getter: [ :el | "Not used" ]
1✔
1014
                        setter: [ :commit :value |
1✔
1015
                                commit deletions: (value at: #deletions).
1✔
1016
                                commit additions: (value at: #additions) ] ].
1✔
1017

1✔
1018
        reader for: DateAndTime customDo: [ :mapping |
1✔
1019
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
1020

1✔
1021
        reader
1✔
1022
                for: #ArrayOfIds
1✔
1023
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
1024
  
1✔
1025
        reader
1✔
1026
                for: #ArrayOfCommit
1✔
1027
                customDo: [ :customMappting |
1✔
1028
                customMappting listOfElementSchema: GLHCommit ].
1✔
1029

1✔
1030
        ^ reader nextAs: #ArrayOfCommit
1✔
1031
]
1✔
1032

1033
{ #category : #private }
1034
GLHModelImporter >> parseDiffResult: result [
×
1035

×
1036
        | reader |
×
1037
        self
×
1038
                deprecated: 'Use #newParseDiffResult: instead'
×
1039
                on: '28 June 2024'
×
1040
                in:
×
1041
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
×
1042
        reader := NeoJSONReader on: result readStream.
×
1043
        reader for: GLHDiff do: [ :mapping |
×
1044
                mapping mapInstVars:
×
1045
                        #( deleted_file new_file new_path old_path renamed_file ).
×
1046
                mapping mapInstVar: #diffString to: #diff ].
×
1047

×
1048
        reader
×
1049
                for: #ArrayOfDiffs
×
1050
                customDo: [ :customMappting |
×
1051
                customMappting listOfElementSchema: GLHDiff ].
×
1052
        ^ reader nextAs: #ArrayOfDiffs
×
1053
]
×
1054

1055
{ #category : #private }
1056
GLHModelImporter >> parseFileTreeResult: aResult [
×
1057

×
1058
        | reader |
×
1059
        reader := NeoJSONReader on: aResult readStream.
×
1060
        reader mapInstVarsFor: GLHApiFile.
×
1061
        reader
×
1062
                for: #ArrayOfFile
×
1063
                customDo: [ :customMappting | 
×
1064
                customMappting listOfElementSchema: GLHApiFile ].
×
1065
        ^ reader nextAs: #ArrayOfFile
×
1066
]
×
1067

1068
{ #category : #private }
1069
GLHModelImporter >> parseGroupResult: aResult [
1✔
1070

1✔
1071
        | reader |
1✔
1072

1✔
1073
        reader := NeoJSONReader on: aResult readStream.
1✔
1074
        reader for: GLHGroup do: [ :mapping |
1✔
1075
                mapping mapInstVars.
1✔
1076
                (mapping mapInstVar: #projects) valueSchema: #ArrayOfProjects ].
1✔
1077
        reader mapInstVarsFor: GLHProject.
1✔
1078
        reader
1✔
1079
                for: #ArrayOfProjects
1✔
1080
                customDo: [ :customMappting |
1✔
1081
                customMappting listOfElementSchema: GLHProject ].
1✔
1082
        ^ reader nextAs: GLHGroup
1✔
1083
]
1✔
1084

1085
{ #category : #private }
1086
GLHModelImporter >> parseJobsResult: result ofProject: aProject [
×
1087

×
1088
        | reader |
×
1089
        reader := NeoJSONReader on: result readStream.
×
1090
        reader for: GLHJob do: [ :mapping |
×
1091
                mapping mapInstVars: #( id allow_failure web_url name ).
×
1092

×
1093
                mapping
×
1094
                        mapProperty: #user
×
1095
                        getter: [ :object | #ignore ]
×
1096
                        setter: [ :object :value |
×
1097
                        object user: (self importUser: (value at: #id)) ].
×
1098

×
1099
                mapping
×
1100
                        mapProperty: #commit
×
1101
                        getter: [ :object | #ignore ]
×
1102
                        setter: [ :object :value |
×
1103
                                value ifNotNil: [
×
1104
                                        object commit:
×
1105
                                                (self importCommit: (value at: #id) ofProject: aProject) ] ].
×
1106

×
1107
                mapping
×
1108
                        mapProperty: #duration
×
1109
                        getter: [ :object | #ignore ]
×
1110
                        setter: [ :object :value |
×
1111
                        value ifNotNil: [ object duration: value seconds ] ] ].
×
1112

×
1113
        reader
×
1114
                for: #ArrayOfGLHJob
×
1115
                customDo: [ :customMappting |
×
1116
                customMappting listOfElementSchema: GLHJob ].
×
1117
        ^ reader nextAs: #ArrayOfGLHJob
×
1118
]
×
1119

1120
{ #category : #private }
1121
GLHModelImporter >> parsePipelinesResult: result [
1✔
1122

1✔
1123
        | reader |
1✔
1124
        
1✔
1125
        (result includesSubstring: '{"message":"40' )ifTrue: [ ^ {  } ].
1✔
1126
        
1✔
1127
        reader := NeoJSONReader on: result readStream.
1✔
1128
        reader mapInstVarsFor: GLHPipeline.
1✔
1129
        reader for: GLHPipeline do: [ :mapping |
1✔
1130
                mapping
1✔
1131
                        mapProperty: #created_at
1✔
1132
                        getter: [ :object | #ignore ]
1✔
1133
                        setter: [ :object :value |
1✔
1134
                        object runDate: (DateAndTime fromString: value) ] ].
1✔
1135
        reader
1✔
1136
                for: #ArrayOfPipelines
1✔
1137
                customDo: [ :customMappting |
1✔
1138
                customMappting listOfElementSchema: GLHPipeline ].
1✔
1139
        ^ reader nextAs: #ArrayOfPipelines
1✔
1140
]
1✔
1141

1142
{ #category : #parsing }
1143
GLHModelImporter >> parseProjectResult: aResult [ 
×
1144
                | reader |
×
1145
        reader := NeoJSONReader on: aResult readStream.
×
1146
        reader for: GLHProject do: [ :mapping |
×
1147
                mapping mapInstVars. ].
×
1148
"        reader mapInstVarsFor: GLHProject."
×
1149

×
1150
        ^ reader nextAs: GLHProject
×
1151
]
×
1152

×
1153
{ #category : #private }
×
1154
GLHModelImporter >> parseSubGroupResult: aResult [
×
1155

×
1156
        | reader |
×
1157
        reader := NeoJSONReader on: aResult readStream.
×
1158
        self configureReaderForGroup: reader.
×
1159
        ^ reader nextAs: #ArrayOfGroups
×
1160
]
×
1161

×
1162
{ #category : #private }
×
1163
GLHModelImporter >> parseUserResult: result [
×
1164

×
1165
        | reader |
×
1166
        reader := NeoJSONReader on: result readStream.
×
1167
        reader mapInstVarsFor: GLHUser.
×
1168
        ^ reader nextAs: GLHUser
×
1169
]
×
1170

×
1171
{ #category : #private }
×
1172
GLHModelImporter >> parseUsersResult: result [
×
1173

×
1174
        | reader |
×
1175
        reader := NeoJSONReader on: result readStream.
×
1176

×
1177
        reader mapInstVarsFor: GLHUser.
×
1178

×
1179
        reader
×
1180
                for: #ArrayOfUser
×
1181
                customDo: [ :customMappting |
×
1182
                customMappting listOfElementSchema: GLHUser ].
×
1183

×
1184
        ^ reader nextAs: #ArrayOfUser
×
1185
]
×
1186

×
1187
{ #category : #'private - api' }
×
1188
GLHModelImporter >> pipelinesOf: aProjectID [
×
1189

×
1190
        | result |
×
1191
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
×
NEW
1192
        result := self repoApi pipelinesOfProject: aProjectID.
×
1193
        ^ self parsePipelinesResult: result .
×
1194
]
×
1195

×
1196
{ #category : #'as yet unclassified' }
×
1197
GLHModelImporter >> selectEntityType: aType overAttribut: aSelector equalTo: value [
×
1198

×
1199
        ^ (self glhModel allWithType: aType)
×
1200
                select: [ :entity | (entity perform: aSelector) = value ]
×
1201
]
×
1202

×
1203
{ #category : #'private - api' }
×
1204
GLHModelImporter >> subGroupsOf: aGroupID [
×
1205

×
1206
        | results parsedResult result page |
×
1207
        ('Search subgroup of: ' , aGroupID printString) recordInfo.
×
1208
        results := OrderedCollection new.
×
1209
        page := 0.
×
1210
        
×
1211
        parsedResult := { true }.
×
1212
        [ parsedResult size > 0 ] whileTrue: [ 
×
1213
                result := self glhApi subgroupsOfGroup: aGroupID page: page.
×
1214
                parsedResult := self parseSubGroupResult: result.
×
1215
                results addAll: parsedResult.
×
1216
                                page := page + 1. ].
×
1217
        
×
1218
        ^ results
×
1219
]
×
1220

×
1221
{ #category : #accessing }
×
1222
GLHModelImporter >> withCommitDiffs [
×
1223

×
1224
        ^ withCommitDiffs
×
1225
]
×
1226

×
1227
{ #category : #accessing }
×
1228
GLHModelImporter >> withCommitDiffs: anObject [
×
1229

×
1230
        withCommitDiffs := anObject
×
1231
]
×
1232

×
1233
{ #category : #accessing }
×
1234
GLHModelImporter >> withInitialCommits: boolean [
×
1235
        withInitialCommits := boolean 
×
1236
]
×
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