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

moosetechnology / GitProjectHealth / 11498155021

24 Oct 2024 11:15AM UTC coverage: 59.724% (+0.8%) from 58.906%
11498155021

push

github

web-flow
Merge pull request #96 from moosetechnology/develop

Develop

713 of 970 new or added lines in 22 files covered. (73.51%)

15 existing lines in 5 files now uncovered.

9449 of 15821 relevant lines covered (59.72%)

0.6 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
}
9

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

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

×
NEW
19
        ^ repoApi
×
UNCOV
20
]
×
21

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

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

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

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

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

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

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

1✔
55
        ^ aCommit
1✔
56
]
1✔
57

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

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

1✔
65

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

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

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

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

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

1✔
117
        ^ result
1✔
118
]
1✔
119

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

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

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

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

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

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

1✔
156
        ^ contribution
1✔
157
]
1✔
158

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

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

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

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

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

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

1✔
190
                         ].
1✔
191

1✔
192

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

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

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

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

1✔
213

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

1✔
223

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

1✔
237

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

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

1✔
254
        aGLHUser contributedProjects: userProjects.
1✔
255

1✔
256
        ^ userProjects
1✔
257
]
1✔
258

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

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

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

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

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

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

1✔
289

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

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

1✔
297
        ^ diffsResult
1✔
298
]
1✔
299

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

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

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

1✔
312
        mergeRequest commits: commits.
1✔
313

1✔
314
        ^ commits
1✔
315
]
1✔
316

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

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

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

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

1✔
333
        ^ pullRequests
1✔
334
]
1✔
335

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

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

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

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

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

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

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

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

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

1✔
374
         
1✔
375

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

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

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

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

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

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

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

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

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

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

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

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

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

1✔
467

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

1✔
476

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

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

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

1✔
510
        ^ glpheMergeRequest
1✔
511
]
1✔
512

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

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

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

1✔
528

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

1✔
535
        group addProject: glhProject.
1✔
536

1✔
537
        ^ glhProject
1✔
538
]
1✔
539

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

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

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

×
552
        ^ withInitialCommits
×
553
]
×
554

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

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