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

moosetechnology / GitProjectHealth / 11496852352

24 Oct 2024 09:49AM UTC coverage: 58.319% (-0.6%) from 58.906%
11496852352

Pull #92

github

web-flow
Merge pull request #91 from moosetechnology/feature-merge-metamodel

Merge Extended and default metamodel
Pull Request #92: Develop

1334 of 2585 new or added lines in 64 files covered. (51.61%)

21 existing lines in 6 files now uncovered.

9446 of 16197 relevant lines covered (58.32%)

0.58 hits per line

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

95.84
/src/BitBucketHealth-Model-Importer/BitBucketModelImporter.class.st
1
Class {
2
        #name : 'BitBucketModelImporter',
3
        #superclass : 'GPModelImporter',
4
        #instVars : [
5
                'withInitialCommits'
6
        ],
7
        #category : 'BitBucketHealth-Model-Importer',
8
        #package : 'BitBucketHealth-Model-Importer'
9
}
10

11
{ #category : 'accessing' }
UNCOV
12
BitBucketModelImporter >> bitBucketApi [
×
UNCOV
13

×
NEW
14
        self
×
NEW
15
                deprecated: 'Use #repoApi instead'
×
NEW
16
                on: '7 October 2024'
×
NEW
17
                in:
×
NEW
18
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
×
NEW
19

×
NEW
20
        ^ repoApi
×
UNCOV
21
]
×
22

23
{ #category : 'accessing' }
24
BitBucketModelImporter >> bitBucketApi: anObject [
1✔
25

1✔
26
        self
1✔
27
                deprecated: 'Use #repoApi: instead'
1✔
28
                on: '7 October 2024'
1✔
29
                in:
1✔
30
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
1✔
31

1✔
32
        repoApi := anObject
1✔
33
]
1✔
34

35
{ #category : 'import - projects' }
36
BitBucketModelImporter >> completeImportProject: aGLHProject [
1✔
37

1✔
38
        aGLHProject repository: GLHRepository new.
1✔
39
        self glhModel add: aGLHProject repository.
1✔
40
        "TODO: import repository"
1✔
41
        ^ aGLHProject
1✔
42
]
1✔
43

44
{ #category : 'commit' }
45
BitBucketModelImporter >> completeImportedCommit: aCommit [ 
1✔
46
        
1✔
47
        ('completing commit: ' , aCommit short_id printString) recordInfo.
1✔
48
        self importCreatorOfCommit: aCommit.
1✔
49

1✔
50
        self withCommitDiffs ifTrue: [
1✔
51
                | diffs |
1✔
52
                aCommit diffs ifEmpty: [
1✔
53
                        diffs := self importDiffOfCommit: aCommit.
1✔
54
                        self glhModel addAll: diffs unless: self blockForDiffEquality ] ].
1✔
55

1✔
56
        ^ aCommit
1✔
57
]
1✔
58

59
{ #category : 'private - api' }
60
BitBucketModelImporter >> convertBitBucketDiffToGitDiff: response [
1✔
61

1✔
62
        | fromHash toHash sourceLine sourceSpan destinationLine destinationSpan result filePathSource filePathDestination |
1✔
63
        fromHash := (response at: 'fromHash') ifNil: ''.
1✔
64
        toHash := (response at: 'toHash') ifNil: ''.
1✔
65

1✔
66

1✔
67
        "Iterate over each diff in 'diffs'"
1✔
68
        result := (response at: #diffs) collect: [ :diff | "Extract file path, hashes"
1✔
69
                          | gitDiff |
1✔
70
                          gitDiff := ''.
1✔
71
                          filePathSource := (diff at: 'source')
1✔
72
                                                    ifNil: ''
1✔
73
                                                    ifNotNil: [ :source |
1✔
74
                                                    source at: 'toString' ].
1✔
75
                          filePathDestination := (diff at: 'destination')
1✔
76
                                                         ifNil: ''
1✔
77
                                                         ifNotNil: [ :destination |
1✔
78
                                                         destination at: 'toString' ].
1✔
79

1✔
80
                          "Build the diff header"
1✔
81
                          " gitDiff := gitDiff , 'diff --git a/', filePath, ' b/', filePath, String cr."
1✔
82
                          " gitDiff := gitDiff , 'index ', fromHash, '..', toHash, ' 100644', String cr."
1✔
83
                          gitDiff := gitDiff , '--- a/' , filePathSource , String cr.
1✔
84
                          gitDiff := gitDiff , '+++ b/' , filePathDestination
1✔
85
                                     , String cr.
1✔
86

1✔
87
                          "Iterate over hunks"
1✔
88
                          (diff at: 'hunks') do: [ :hunk |
1✔
89
                                  sourceLine := hunk at: 'sourceLine'.
1✔
90
                                  sourceSpan := hunk at: 'sourceSpan'.
1✔
91
                                  destinationLine := hunk at: 'destinationLine'.
1✔
92
                                  destinationSpan := hunk at: 'destinationSpan'.
1✔
93

1✔
94
                                  "Hunk header"
1✔
95
                                  gitDiff := gitDiff
1✔
96
                                             , ('@@ -{1},{2} +{3},{4} @@' format: {
1✔
97
                                                                      sourceLine.
1✔
98
                                                                      sourceSpan.
1✔
99
                                                                      destinationLine.
1✔
100
                                                                      destinationSpan }) , String cr.
1✔
101

1✔
102
                                  "Iterate over segments"
1✔
103
                                  (hunk at: 'segments') do: [ :segment |
1✔
104
                                          (segment at: 'lines') do: [ :line |
1✔
105
                                                  (segment at: 'type') = 'CONTEXT' ifTrue: [
1✔
106
                                                          gitDiff := gitDiff , (line at: 'line') , String cr ].
1✔
107
                                                  (segment at: 'type') = 'REMOVED' ifTrue: [
1✔
108
                                                          gitDiff := gitDiff , '-' , (line at: 'line')
1✔
109
                                                                     , String cr ].
1✔
110
                                                  (segment at: 'type') = 'ADDED' ifTrue: [
1✔
111
                                                          gitDiff := gitDiff , '+' , (line at: 'line')
1✔
112
                                                                     , String cr ] ] ] ].
1✔
113
                          GLHDiff new
1✔
114
                                  diffString: gitDiff;
1✔
115
                                  old_path: filePathSource;
1✔
116
                                  new_path: filePathDestination ].
1✔
117

1✔
118
        ^ result
1✔
119
]
1✔
120

121
{ #category : 'private - api' }
122
BitBucketModelImporter >> getContributionFromDiffs: diffs [
1✔
123

1✔
124
        | contribution |
1✔
125
        contribution := {
1✔
126
                                ('additions' -> 0).
1✔
127
                                ('deletions' -> 0) } asDictionary.
1✔
128

1✔
129
        diffs do: [ :diff |
1✔
130
                | hunks segments |
1✔
131
                hunks := diff at: #hunks ifAbsent: Array new.
1✔
132

1✔
133
                hunks do: [ :hunk |
1✔
134
                        | addedSegment removedSegment |
1✔
135
                        segments := hunk at: #segments.
1✔
136

1✔
137
                        addedSegment := segments
1✔
138
                                                detect: [ :segment |
1✔
139
                                                (segment at: #type) = 'ADDED' ]
1✔
140
                                                ifNone: [ nil ].
1✔
141
                        removedSegment := segments
1✔
142
                                                  detect: [ :segment |
1✔
143
                                                  (segment at: #type) = 'REMOVED' ]
1✔
144
                                                  ifNone: [ nil ].
1✔
145

1✔
146
                        addedSegment ifNotNil: [
1✔
147
                                contribution
1✔
148
                                        at: #additions
1✔
149
                                        put:
1✔
150
                                        (contribution at: #additions) + (addedSegment at: #lines) size ].
1✔
151
                        removedSegment ifNotNil: [
1✔
152
                                contribution
1✔
153
                                        at: #deletions
1✔
154
                                        put:
1✔
155
                                        (contribution at: #deletions) + (removedSegment at: #lines) size ] ] ].
1✔
156

1✔
157
        ^ contribution
1✔
158
]
1✔
159

160
{ #category : 'import - commits' }
161
BitBucketModelImporter >> importAndLoadLatestsCommitsOfProject: aGLHProject [
1✔
162

1✔
163
        | commits |
1✔
164
        self completeImportProject: aGLHProject.
1✔
165

1✔
166
        commits := self
1✔
167
                           importCommitsOfProject: aGLHProject
1✔
168
                           since: (Date today - 3 week) asDateAndTime
1✔
169
                           until: Date today asDateAndTime.
1✔
170
        commits do: [ :commit | self completeImportedCommit: commit ].
1✔
171
        
1✔
172
        self chainsCommitsFrom: commits.
1✔
173
        
1✔
174
        ^ commits
1✔
175
]
1✔
176

177
{ #category : 'import - commits' }
178
BitBucketModelImporter >> importCommitsOfProject: aGLHProject since: since until: until [
1✔
179

1✔
180
        | commits |
1✔
181
        commits := self repoApi
1✔
182
                           commitsOfRepoProjectId: aGLHProject id
1✔
183
                           inProjectGroupId: aGLHProject group id
1✔
184
                           since: since
1✔
185
                           until: until.
1✔
186

1✔
187
        commits := commits collect: [ :commit |
1✔
188
                     
1✔
189
                           self parseCommitIntoGLHCommit: commit ofProject: aGLHProject.
1✔
190

1✔
191
                         ].
1✔
192

1✔
193

1✔
194
        commits := self glhModel
1✔
195
                           addAll: commits
1✔
196
                           unless: self blockOnIdEquality.
1✔
197
        ^ aGLHProject repository commits
1✔
198
                  addAll: commits
1✔
199
                  unless: self blockOnIdEquality
1✔
200
]
1✔
201

202
{ #category : 'import - projects' }
203
BitBucketModelImporter >> importContributedProjectsOfUser: aGLHUser [
1✔
204

1✔
205
        | projects repositories repositoriesCommits userRepositories userProjects |
1✔
206
        "get all projects"
1✔
207
        projects := self repoApi projects.
1✔
208

1✔
209
        "get all repos of projects"
1✔
210
        repositories := projects flatCollect: [ :project |
1✔
211
                                self repoApi repositoryProjectsOfProjectGroupId:
1✔
212
                                        (project at: #key) ].
1✔
213

1✔
214

1✔
215
        "get all commits of repo"
1✔
216
        repositoriesCommits := repositories collect: [ :repository |
1✔
217
                                       repository -> (self repoApi
1✔
218
                                                commitsOfRepoProjectId: (repository at: #slug)
1✔
219
                                                inProjectGroupId:
1✔
220
                                                ((repository at: #project) at: #key)
1✔
221
                                                since: DateAndTime now - 10 days
1✔
222
                                                until: DateAndTime now) ].
1✔
223

1✔
224

1✔
225
        "look if user is author of min one commit"
1✔
226
        userRepositories := repositoriesCommits select: [ :repository |
1✔
227
                                    | repos |
1✔
228
                                    repos := repository value
1✔
229
                                                     ifEmpty: [ false ]
1✔
230
                                                     ifNotEmpty: [
1✔
231
                                                             repository value
1✔
232
                                                                     detect: [ :commit |
1✔
233
                                                                     ((commit at: #author) at: #name)
1✔
234
                                                                     = aGLHUser username ]
1✔
235
                                                                     ifFound: [ true ]
1✔
236
                                                                     ifNone: [ false ] ] ].
1✔
237

1✔
238

1✔
239
        "Transform user repositories in GLHProject"
1✔
240
        userProjects := userRepositories collect: [ :repoCommits |
1✔
241
                                | repo project |
1✔
242
                                repo := repoCommits key.
1✔
243
                                project := repo at: #project.
1✔
244

1✔
245
                                (self glhModel allWithType: GLHProject)
1✔
246
                                        detect: [ :glhProject |
1✔
247
                                        glhProject id = (project at: #key) ]
1✔
248
                                        ifFound: [ :glhProject | glhProject ]
1✔
249
                                        ifNone: [
1✔
250
                                                | glhProject |
1✔
251
                                                glhProject := self parseRepoIntoGLHProject: repo.
1✔
252
                                                glhModel add: glhProject.
1✔
253
                                                glhProject ] ].
1✔
254

1✔
255
        aGLHUser contributedProjects: userProjects.
1✔
256

1✔
257
        ^ userProjects
1✔
258
]
1✔
259

260
{ #category : 'import - commits' }
261
BitBucketModelImporter >> importCreatorOfCommit: aGLHCommit [
1✔
262

1✔
263
        | creator |
1✔
264
        (self glhModel allWithType: GLHUser)
1✔
265
                detect: [ :user | user username = aGLHCommit author_name ]
1✔
266
                ifFound: [ :user |
1✔
267
                        aGLHCommit commitCreator: user.
1✔
268
                        ^ user ].
1✔
269

1✔
270
        creator := self importUserByUsername: aGLHCommit author_name.
1✔
271
        aGLHCommit commitCreator: creator.
1✔
272
        ^ creator
1✔
273
]
1✔
274

275
{ #category : 'import - commits' }
276
BitBucketModelImporter >> importDiffOfCommit: aCommit [
1✔
277

1✔
278
        | result diffsResult |
1✔
279
        aCommit diffs ifNotEmpty: [
1✔
280
                'Diff already importer: ' , aCommit short_id printString recordInfo.
1✔
281
                ^ aCommit diffs ].
1✔
282
        ('Import diff of commit: ' , aCommit short_id printString) recordInfo.
1✔
283
        result := self repoApi
1✔
284
                          diffsOfCommit: aCommit id
1✔
285
                          inRepoProjectId: aCommit repository project id
1✔
286
                          inProjectGroupId: aCommit repository project group id.
1✔
287

1✔
288
        diffsResult := self convertBitBucketDiffToGitDiff: result.
1✔
289

1✔
290

1✔
291
        diffsResult := aCommit diffs
1✔
292
                               addAll: diffsResult
1✔
293
                               unless: self blockForDiffEquality.
1✔
294

1✔
295
        "changes are added into the model during the import"
1✔
296
        diffsResult do: [ :diff | self importDiffRangesForDiff: diff ].
1✔
297

1✔
298
        ^ diffsResult
1✔
299
]
1✔
300

301
{ #category : 'import - merge-requests' }
302
BitBucketModelImporter >> importMergeRequestCommits: mergeRequest [
1✔
303

1✔
304
        | commits |
1✔
305
        commits := self repoApi
1✔
306
                           commitsOfPullRequest: mergeRequest id
1✔
307
                           ofRepoProjectId: mergeRequest project id
1✔
308
                           inProjectGroupId: mergeRequest project group id.
1✔
309

1✔
310
        commits := commits collect: [ :commit |
1✔
311
                           self parseCommitIntoGLHCommit: commit ofProject: mergeRequest project ].
1✔
312

1✔
313
        mergeRequest commits: commits.
1✔
314

1✔
315
        ^ commits
1✔
316
]
1✔
317

318
{ #category : 'import - merge-requests' }
319
BitBucketModelImporter >> importMergeRequests: aGLHProject since: fromDate until: toDate [
1✔
320

1✔
321
        | pullRequests |
1✔
322
        pullRequests := self repoApi
1✔
323
                                pullRequestsOfRepoProjectId: aGLHProject id
1✔
324
                                inProjectGroupId: aGLHProject group id
1✔
325
                                since: fromDate
1✔
326
                                until: toDate.
1✔
327

1✔
328
        pullRequests := pullRequests collect: [ :pullRequest |
1✔
329
                                self parsePullRequestIntoGLPHEMergeRequest:
1✔
330
                                        pullRequest ].
1✔
331

1✔
332
        pullRequests := self glhModel addAll: pullRequests unless: self blockOnIdEquality.
1✔
333

1✔
334
        ^ pullRequests
1✔
335
]
1✔
336

337
{ #category : 'import - merge-requests' }
338
BitBucketModelImporter >> importMergeResquestAuthor: mergeRequest [
×
339
        mergeRequest author ifNotNil: [ ^mergeRequest ]
×
340
]
×
341

342
{ #category : 'import - merge-requests' }
343
BitBucketModelImporter >> importMergeResquestMerger: mergeRequest [
1✔
344

1✔
345
        | activities mergeActivity mergeUser |
1✔
346
        mergeRequest merge_user ifNotNil: [ ^ mergeRequest merge_user ].
1✔
347
        mergeRequest state = 'merged' ifFalse: [ ^ nil ].
1✔
348

1✔
349
        activities := self repoApi
1✔
350
                              activitiesOfPullRequest: mergeRequest id
1✔
351
                              inRepoProjectId: mergeRequest project id
1✔
352
                              ofProjectGroupId: mergeRequest project group id.
1✔
353

1✔
354
        mergeActivity := activities detect: [ :activity |
1✔
355
                                 (activity at: #action) = 'MERGED' ].
1✔
356

1✔
357
        mergeUser := mergeActivity at: #user.
1✔
358

1✔
359
        mergeUser := (glhModel allWithType: GLHUser)
1✔
360
                             detect: [ :user | user id = (mergeUser at: #id) ]
1✔
361
                             ifFound: [ :user | user ]
1✔
362
                             ifNone: [
1✔
363
                                     | glhUser |
1✔
364
                                     glhUser := self parseUserIntoGLHUser: mergeUser.
1✔
365
                                     glhModel add: glhUser.
1✔
366
                                     glhUser ].
1✔
367

1✔
368
        mergeRequest merge_user: mergeUser.
1✔
369
        ^ mergeUser
1✔
370
]
1✔
371

372
{ #category : 'import - users' }
373
BitBucketModelImporter >> importUserByUsername: username [
1✔
374

1✔
375
         
1✔
376

1✔
377
        ^ self userCatalogue collectUsernames at: username ifAbsent: [
1✔
378
                |users glhUser user|
1✔
379
                
1✔
380
                users := self repoApi usersByUsername: username.
1✔
381
                users ifEmpty: [ ^ nil ].
1✔
382
                user := users first.
1✔
383

1✔
384
                glhUser := self parseUserIntoGLHUser: user.
1✔
385
                self glhModel add: glhUser unless: self blockOnIdEquality.
1✔
386
                self userCatalogue addUser: glhUser withName: username. 
1✔
387
                glhUser
1✔
388
                 ].
1✔
389
        
1✔
390
        
1✔
391
]
1✔
392

393
{ #category : 'parsing' }
394
BitBucketModelImporter >> parseCommitIntoGLHCommit: commitDictionary ofProject: aGLHProject [
1✔
395

1✔
396
        | author committer parentIds commitDiffs contribution |
1✔
397
        author := commitDictionary at: #author.
1✔
398
        committer := commitDictionary at: #committer.
1✔
399

1✔
400
        parentIds := (commitDictionary at: #parents) collect: [ :parent |
1✔
401
                             parent at: #id ].
1✔
402

1✔
403
        commitDiffs := self repoApi
1✔
404
                               diffsOfCommit: (commitDictionary at: #id)
1✔
405
                               inRepoProjectId: aGLHProject id
1✔
406
                               inProjectGroupId: aGLHProject group id.
1✔
407

1✔
408
        contribution := self getContributionFromDiffs:
1✔
409
                                (commitDiffs at: #diffs).
1✔
410

1✔
411
        ^ GLHCommit new
1✔
412
                  id: (commitDictionary at: #id);
1✔
413
                  message: (commitDictionary at: #message);
1✔
414
                  author_email: (author at: #emailAddress);
1✔
415
                  author_name: (author at: #name);
1✔
416
                  authored_date: (DateAndTime fromUnixTime:
1✔
417
                                           (commitDictionary at: #authorTimestamp) / 1000);
1✔
418
                  created_at: (DateAndTime fromUnixTime:
1✔
419
                                           (commitDictionary at: #authorTimestamp) / 1000);
1✔
420
                  committed_date: (DateAndTime fromUnixTime:
1✔
421
                                           (commitDictionary at: #committerTimestamp) / 1000);
1✔
422
                  committer_email: (committer at: #emailAddress);
1✔
423
                  committer_name: (committer at: #name);
1✔
424
                  parent_ids: parentIds;
1✔
425
                  additions: (contribution at: #additions);
1✔
426
                  deletions: (contribution at: #deletions)
1✔
427
]
1✔
428

429
{ #category : 'parsing' }
430
BitBucketModelImporter >> parseProjectIntoGLHGroup: projectRepository [
1✔
431

1✔
432
        ^GLHGroup new
1✔
433
                                                     name: (projectRepository at: #name);
1✔
434
                                                     id: (projectRepository at: #key);
1✔
435
                                                     description: (projectRepository at: #description).
1✔
436
]
1✔
437

438
{ #category : 'parsing' }
439
BitBucketModelImporter >> parsePullRequestIntoGLPHEMergeRequest: pullRequestDictionary [
1✔
440

1✔
441
        | repository project toRef fromRef glpheMergeRequest author state reviewers |
1✔
442
        toRef := pullRequestDictionary at: #toRef.
1✔
443
        fromRef := pullRequestDictionary at: #fromRef.
1✔
444
        
1✔
445
        reviewers := pullRequestDictionary at: #reviewers.
1✔
446
        reviewers := reviewers collect: [ :reviewer | 
1✔
447
                |reviewerUser|
1✔
448
                reviewerUser := reviewer at: #user.
1✔
449
                (self glhModel allWithType: GLHUser) detect: [ :user | user id = (reviewerUser at: #id) ]         ifFound: [ :user | user ] ifNone: [ 
1✔
450
                        |glhUser|
1✔
451
                        glhUser := self parseUserIntoGLHUser: reviewerUser.
1✔
452
                        glhModel  add: glhUser.
1✔
453
                        glhUser.                
1✔
454
                ]
1✔
455
                
1✔
456
        ].
1✔
457

1✔
458
        repository := toRef at: #repository.
1✔
459
        project := (self glhModel allWithType: GLHProject)
1✔
460
                           detect: [ :glhProject |
1✔
461
                           glhProject id = (repository at: #id) ]
1✔
462
                           ifFound: [ :glhProject | glhProject ]
1✔
463
                           ifNone: [
1✔
464
                                   project := self parseRepoIntoGLHProject: repository.
1✔
465
                                   self glhModel add: project.
1✔
466
                                   project ].
1✔
467

1✔
468

1✔
469
        author := pullRequestDictionary at: #author.
1✔
470
        author := (self glhModel allWithType: GLHUser)
1✔
471
                          detect: [ :user | user id = ((author at: #user) at: #id) ]
1✔
472
                          ifFound: [ :user | user ]
1✔
473
                          ifNone: [
1✔
474
                          self importUserByUsername:
1✔
475
                                  ((author at: #user) at: #displayName) ].
1✔
476

1✔
477

1✔
478
        glpheMergeRequest := GLHMergeRequest new
1✔
479
                                     name: (pullRequestDictionary at: #title);
1✔
480
                                     title: (pullRequestDictionary at: #title);
1✔
481
                                     id: (pullRequestDictionary at: #id);
1✔
482
                                     project: project;
1✔
483
                                     project_id: project id;
1✔
484
                                     target_branch: (toRef at: #id);
1✔
485
                                     target_project_id:
1✔
486
                                             ((toRef at: #repository) at: #id);
1✔
487
                                     source_branch: (fromRef at: #id);
1✔
488
                                     target_project_id:
1✔
489
                                             ((fromRef at: #repository) at: #id);
1✔
490
                                     updated_at: (DateAndTime fromUnixTime:
1✔
491
                                                              (pullRequestDictionary at: #updatedDate)
1✔
492
                                                              / 1000);
1✔
493
                                     created_at: (DateAndTime fromUnixTime:
1✔
494
                                                              (pullRequestDictionary at: #createdDate)
1✔
495
                                                              / 1000);
1✔
496
                                     author: author.
1✔
497

1✔
498
        "STATE"
1✔
499
        state := pullRequestDictionary at: #state.
1✔
500
        state = 'OPEN' ifTrue: [ glpheMergeRequest state: 'opened' ].
1✔
501
        state = 'MERGED' ifTrue: [
1✔
502
                glpheMergeRequest state: 'merged'.
1✔
503
                glpheMergeRequest merged_at: (DateAndTime fromUnixTime:
1✔
504
                                 (pullRequestDictionary at: #closedDate) / 1000) ].
1✔
505

1✔
506
        state = 'DECLINED' ifTrue: [
1✔
507
                glpheMergeRequest state: 'closed'.
1✔
508
                glpheMergeRequest closed_at: (DateAndTime fromUnixTime:
1✔
509
                                 (pullRequestDictionary at: #closedDate) / 1000) ].
1✔
510

1✔
511
        ^ glpheMergeRequest
1✔
512
]
1✔
513

514
{ #category : 'parsing' }
515
BitBucketModelImporter >> parseRepoIntoGLHProject: repositoryDictionary [
1✔
516

1✔
517
        | project group glhProject |
1✔
518
        project := repositoryDictionary at: #project.
1✔
519

1✔
520
        group := (self glhModel allWithType: GLHGroup)
1✔
521
                         detect: [ :glhGroup | glhGroup id = (project at: #key) ]
1✔
522
                         ifFound: [ :glhGroup | glhGroup ]
1✔
523
                         ifNone: [
1✔
524
                                 | newGroup |
1✔
525
                                 newGroup := self parseProjectIntoGLHGroup: project.
1✔
526
                                 glhModel add: newGroup.
1✔
527
                                 newGroup ].
1✔
528

1✔
529

1✔
530
        glhProject := GLHProject new
1✔
531
                              name: (repositoryDictionary at: #name);
1✔
532
                              id: (repositoryDictionary at: #slug);
1✔
533
                                                  repository: GLHRepository new;
1✔
534
                              group: group.
1✔
535

1✔
536
        group addProject: glhProject.
1✔
537

1✔
538
        ^ glhProject
1✔
539
]
1✔
540

541
{ #category : 'parsing' }
542
BitBucketModelImporter >> parseUserIntoGLHUser: userDictionnary [
1✔
543

1✔
544
        ^ GLHUser new name: (userDictionnary at: #displayName);
1✔
545
                public_email: (userDictionnary at: #emailAddress);
1✔
546
                id: (userDictionnary at: #id);
1✔
547
                username: (userDictionnary at: #name).
1✔
548
]
1✔
549

550
{ #category : 'accessing' }
551
BitBucketModelImporter >> withInitialCommits [
×
552

×
553
        ^ withInitialCommits
×
554
]
×
555

556
{ #category : 'accessing' }
557
BitBucketModelImporter >> withInitialCommits: anObject [
×
558

×
559
        withInitialCommits := anObject
×
560
]
×
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

© 2025 Coveralls, Inc