diff --git a/src/BitBucketHealth-Model-Importer-Tests/BitBucketApiMock.class.st b/src/BitBucketHealth-Model-Importer-Tests/BitBucketApiMock.class.st index f82e188..b8b0573 100644 --- a/src/BitBucketHealth-Model-Importer-Tests/BitBucketApiMock.class.st +++ b/src/BitBucketHealth-Model-Importer-Tests/BitBucketApiMock.class.st @@ -1,23 +1,22 @@ Class { - #name : 'BitBucketApiMock', - #superclass : 'Object', + #name : #BitBucketApiMock, + #superclass : #Object, #instVars : [ 'userMock', 'commits', 'diffs', 'mergeRequests' ], - #category : 'BitBucketHealth-Model-Importer-Tests', - #package : 'BitBucketHealth-Model-Importer-Tests' + #category : #'BitBucketHealth-Model-Importer-Tests' } -{ #category : 'api - pull-requests' } +{ #category : #'api - pull-requests' } BitBucketApiMock >> activitiesOfPullRequest: pullRequestId inRepoProjectId: repoSlug ofProjectGroupId: projectKey [ ^self pullRequestActivities ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> commit2 [ | commits2 | @@ -49,13 +48,13 @@ BitBucketApiMock >> commit2 [ ^ commits2 := (NeoJSONReader on: commits2 readStream) next ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> commits [ ^ commits ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> commits1 [ | commits1 | @@ -87,19 +86,19 @@ BitBucketApiMock >> commits1 [ ^ commits1 := (NeoJSONReader on: commits1 readStream) next ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> commits: anObject [ commits := anObject ] -{ #category : 'api - pull-requests' } +{ #category : #'api - pull-requests' } BitBucketApiMock >> commitsOfPullRequest: mergeRequestId ofRepoProjectId: repoSlug inProjectGroupId: projectKey [ ^commits ] -{ #category : 'api - projects' } +{ #category : #'api - projects' } BitBucketApiMock >> commitsOfRepoProjectId: repositorySlug inProjectGroupId: projectKey since: since until: until [ ^ self commits select: [ :commit | @@ -111,7 +110,7 @@ BitBucketApiMock >> commitsOfRepoProjectId: repositorySlug inProjectGroupId: pro commitDate >= since asDate and: commitDate <= until asDate ] ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> declinedMergeRequest [ | pullRequest | @@ -307,13 +306,13 @@ BitBucketApiMock >> declinedMergeRequest [ ^ pullRequest := (NeoJSONReader on: pullRequest readStream) next ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> diffs [ ^ diffs ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> diffs1 [ | diffs1 | @@ -410,18 +409,49 @@ BitBucketApiMock >> diffs1 [ ^ diffs1 := (NeoJSONReader on: diffs1 readStream) next ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> diffs: anObject [ diffs := anObject ] -{ #category : 'api - commits' } +{ #category : #accessing } +BitBucketApiMock >> diffsNohunks [ + + | diffs1 | + diffs1 := '{ + "fromHash": null, + "toHash": "123", + "contextLines": 10, + "whitespace": "SHOW", + "diffs": [ + { + "source": null, + "destination": { + "components": [ + "api", + "api.xlsx" + ], + "parent": "api", + "name": "api.xlsx", + "extension": "xlsx", + "toString": "api/api.xlsx" + }, + "binary": true + } + ], + "truncated": false +}'. + + ^ diffs1 := (NeoJSONReader on: diffs1 readStream) next +] + +{ #category : #'api - commits' } BitBucketApiMock >> diffsOfCommit: commitID inRepoProjectId: repositorySlug inProjectGroupId: projectKey [ ^diffs ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> diffsWithoutAdded [ | diffsWithoutAdded | @@ -519,7 +549,7 @@ BitBucketApiMock >> diffsWithoutAdded [ diffsWithoutAdded readStream) next ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> diffsWithoutHunks [ | diffsWithoutHunks | @@ -559,7 +589,7 @@ BitBucketApiMock >> diffsWithoutHunks [ diffsWithoutHunks readStream) next ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> diffsWithoutRemoved [ | diffsWithoutRemoved | @@ -645,7 +675,7 @@ BitBucketApiMock >> diffsWithoutRemoved [ diffsWithoutRemoved readStream) next ] -{ #category : 'initialization' } +{ #category : #initialization } BitBucketApiMock >> initialize [ commits := self commits1. @@ -654,19 +684,19 @@ BitBucketApiMock >> initialize [ mergeRequests := { self openedMergeRequest } ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> mergeRequests [ ^ mergeRequests ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> mergeRequests: anObject [ mergeRequests := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> mergedMergeRequest [ | pullRequest | @@ -862,7 +892,7 @@ BitBucketApiMock >> mergedMergeRequest [ ^ pullRequest := (NeoJSONReader on: pullRequest readStream) next ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> openedMergeRequest [ | pullRequest | @@ -1057,7 +1087,7 @@ BitBucketApiMock >> openedMergeRequest [ ^pullRequest := (NeoJSONReader on: pullRequest readStream) next. ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> projects [ | projects | @@ -1081,7 +1111,7 @@ BitBucketApiMock >> projects [ ^ projects ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> pullRequestActivities [ | pullRequestActivities | @@ -1112,13 +1142,13 @@ BitBucketApiMock >> pullRequestActivities [ pullRequestActivities readStream) next ] -{ #category : 'api - pull-requests' } +{ #category : #'api - pull-requests' } BitBucketApiMock >> pullRequestsOfRepoProjectId: repoSlug inProjectGroupId: projectKey since: since until: until [ ^ mergeRequests ] -{ #category : 'api - projects' } +{ #category : #'api - projects' } BitBucketApiMock >> repositoryProjectsOfProjectGroupId: projectKey [ | repos | @@ -1158,7 +1188,7 @@ repos := (NeoJSONReader on: repos readStream) next. ^repos ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> user1 [ | user1 | @@ -1190,7 +1220,7 @@ BitBucketApiMock >> user1 [ ^ user1 := (NeoJSONReader on: user1 readStream) next ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> user: accountId [ | user | @@ -1205,19 +1235,19 @@ BitBucketApiMock >> user: accountId [ ^ user ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> userMock [ ^ userMock ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApiMock >> userMock: anObject [ userMock := anObject ] -{ #category : 'api - user' } +{ #category : #'api - user' } BitBucketApiMock >> usersByUsername: username [ userMock ifNil: [ ^Array new ] ifNotNil: [ ^{ userMock }] diff --git a/src/BitBucketHealth-Model-Importer-Tests/BitBucketModelImporterTest.class.st b/src/BitBucketHealth-Model-Importer-Tests/BitBucketModelImporterTest.class.st index b5914a2..6e4a5c0 100644 --- a/src/BitBucketHealth-Model-Importer-Tests/BitBucketModelImporterTest.class.st +++ b/src/BitBucketHealth-Model-Importer-Tests/BitBucketModelImporterTest.class.st @@ -2,13 +2,12 @@ A BitBucketModelImporterTest is a test class for testing the behavior of BitBucketModelImporter " Class { - #name : 'BitBucketModelImporterTest', - #superclass : 'TestCase', - #category : 'BitBucketHealth-Model-Importer-Tests', - #package : 'BitBucketHealth-Model-Importer-Tests' + #name : #BitBucketModelImporterTest, + #superclass : #TestCase, + #category : #'BitBucketHealth-Model-Importer-Tests' } -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testCompleteImportProject [ "Given" @@ -34,7 +33,64 @@ BitBucketModelImporterTest >> testCompleteImportProject [ equals: 1 ] -{ #category : 'tests' } +{ #category : #tests } +BitBucketModelImporterTest >> testConvertBitBucketDiffToGitDiff [ + + "Given" + | bitBucketApi glhModel bitBucketImporter diffs glhDiffs | + bitBucketApi := BitBucketApiMock new. + + glhModel := GLHModel new name: 'test'. + + bitBucketImporter := BitBucketModelImporter new + bitBucketApi: bitBucketApi; + glhModel: glhModel. + + diffs := bitBucketApi diffs. + + "When" + glhDiffs := bitBucketImporter convertBitBucketDiffToGitDiff: diffs. + + "Then" + self assert: glhDiffs size equals: 1. + diffs := glhDiffs first. + self assert: diffs diffString equals: '--- a/build.gradle ++++ b/build.gradle +@@ -1,14 +1,14 @@ + line +-line4 ++line5 + +' +] + +{ #category : #tests } +BitBucketModelImporterTest >> testConvertBitBucketDiffToGitDiffNoHunks [ + + "Given" + | bitBucketApi glhModel bitBucketImporter diffs glhDiffs | + bitBucketApi := BitBucketApiMock new. + + glhModel := GLHModel new name: 'test'. + + bitBucketImporter := BitBucketModelImporter new + bitBucketApi: bitBucketApi; + glhModel: glhModel. + + diffs := bitBucketApi diffsNohunks. + + "When" + glhDiffs := bitBucketImporter convertBitBucketDiffToGitDiff: diffs. + + "Then" + self assert: glhDiffs size equals: 1. + diffs := glhDiffs first. + self assert: diffs diffString equals: '--- a/ ++++ b/api/api.xlsx +' +] + +{ #category : #tests } BitBucketModelImporterTest >> testGetContributionFromDiffs [ "Given" @@ -57,7 +113,7 @@ BitBucketModelImporterTest >> testGetContributionFromDiffs [ self assert: (contribution at: #deletions) equals: 1 ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testGetContributionFromDiffsWithoutAdded [ "Given" @@ -82,7 +138,7 @@ BitBucketModelImporterTest >> testGetContributionFromDiffsWithoutAdded [ self assert: (contribution at: #deletions) equals: 1 ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testGetContributionFromDiffsWithoutHunks [ "Given" @@ -107,7 +163,7 @@ BitBucketModelImporterTest >> testGetContributionFromDiffsWithoutHunks [ self assert: (contribution at: #deletions) equals: 0 ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testGetContributionFromDiffsWithoutRemoved [ "Given" @@ -132,7 +188,7 @@ BitBucketModelImporterTest >> testGetContributionFromDiffsWithoutRemoved [ self assert: (contribution at: #deletions) equals: 0 ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportAndLoadLatestsCommitsOfProject [ | bitBucketApi glphModel bitBucketImporter project commits group repo firstCommit commit1 currentDate timestamp commit2 timestamp2 | @@ -180,7 +236,7 @@ BitBucketModelImporterTest >> testImportAndLoadLatestsCommitsOfProject [ self assert: firstCommit additions equals: 1 ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportCommitsOfProjectSinceUntil [ | bitBucketApi glphModel bitBucketImporter project commits group repo firstCommit | @@ -215,7 +271,7 @@ BitBucketModelImporterTest >> testImportCommitsOfProjectSinceUntil [ self assert: firstCommit additions equals: 1 ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportContributedProjectsOfUser [ | bitBucketApi glphModel bitBucketImporter user projects commits yesterdayAsTimestamp | @@ -253,7 +309,7 @@ BitBucketModelImporterTest >> testImportContributedProjectsOfUser [ hasSameElements: projects ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportCreatorOfCommit [ | bitBucketApi glphModel bitBucketImporter creator commit | @@ -281,7 +337,7 @@ BitBucketModelImporterTest >> testImportCreatorOfCommit [ self assert: commit commitCreator equals: creator ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportCreatorOfCommitIfAlreadyExist [ | bitBucketApi glphModel bitBucketImporter creator commit | @@ -310,7 +366,7 @@ BitBucketModelImporterTest >> testImportCreatorOfCommitIfAlreadyExist [ self assert: commit commitCreator equals: creator ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportMergeRequestCommits [ | bitBucketApi glphModel bitBucketImporter mergeRequest commits | @@ -337,7 +393,7 @@ BitBucketModelImporterTest >> testImportMergeRequestCommits [ self assert: mergeRequest commits first additions equals: 1 ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportMergeRequestsSinceUntil [ | bitBucketApi glphModel bitBucketImporter group repo project mergeRequests mergeRequest | @@ -375,7 +431,7 @@ BitBucketModelImporterTest >> testImportMergeRequestsSinceUntil [ self assert: mergeRequest closed_at equals: nil. ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportMergeRequestsSinceUntilClosedMR [ | bitBucketApi glphModel bitBucketImporter group repo project mergeRequests mergeRequest | @@ -416,7 +472,7 @@ BitBucketModelImporterTest >> testImportMergeRequestsSinceUntilClosedMR [ self deny: mergeRequest merged_at equals: nil. ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportMergeRequestsSinceUntilDeclinedMR [ | bitBucketApi glphModel bitBucketImporter group repo project mergeRequests mergeRequest | @@ -457,7 +513,7 @@ BitBucketModelImporterTest >> testImportMergeRequestsSinceUntilDeclinedMR [ self assert: mergeRequest merged_at equals: nil ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportMergeResquestMerger [ | bitBucketApi glphModel bitBucketImporter mergeRequest mergeUser | @@ -484,7 +540,7 @@ BitBucketModelImporterTest >> testImportMergeResquestMerger [ self assert: mergeRequest merge_user equals: mergeUser ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportUserByUsername [ "Given" @@ -507,7 +563,7 @@ BitBucketModelImporterTest >> testImportUserByUsername [ hasSameElements: {user}. ] -{ #category : 'tests' } +{ #category : #tests } BitBucketModelImporterTest >> testImportUserByUsernameWithoutUsers [ "Given" diff --git a/src/BitBucketHealth-Model-Importer-Tests/package.st b/src/BitBucketHealth-Model-Importer-Tests/package.st index 9f22ec0..b1f504f 100644 --- a/src/BitBucketHealth-Model-Importer-Tests/package.st +++ b/src/BitBucketHealth-Model-Importer-Tests/package.st @@ -1 +1 @@ -Package { #name : 'BitBucketHealth-Model-Importer-Tests' } +Package { #name : #'BitBucketHealth-Model-Importer-Tests' } diff --git a/src/BitBucketHealth-Model-Importer/BitBucketApi.class.st b/src/BitBucketHealth-Model-Importer/BitBucketApi.class.st index b0be748..edece83 100644 --- a/src/BitBucketHealth-Model-Importer/BitBucketApi.class.st +++ b/src/BitBucketHealth-Model-Importer/BitBucketApi.class.st @@ -1,6 +1,6 @@ Class { - #name : 'BitBucketApi', - #superclass : 'Object', + #name : #BitBucketApi, + #superclass : #Object, #instVars : [ 'endpoint', 'basePath', @@ -9,11 +9,10 @@ Class { 'apiToken', 'username' ], - #category : 'BitBucketHealth-Model-Importer', - #package : 'BitBucketHealth-Model-Importer' + #category : 'BitBucketHealth-Model-Importer' } -{ #category : 'api - pull-requests' } +{ #category : #'api - pull-requests' } BitBucketApi >> activitiesOfPullRequest: pullRequestId inRepoProjectId: repositorySlug ofProjectGroupId: projectKey [ ^ self allValuesOfPath: @@ -22,7 +21,7 @@ BitBucketApi >> activitiesOfPullRequest: pullRequestId inRepoProjectId: reposito , '/activities' ] -{ #category : 'private - building' } +{ #category : #'private - building' } BitBucketApi >> allValuesOfPath: path [ | results values | @@ -43,61 +42,61 @@ BitBucketApi >> allValuesOfPath: path [ ^ values ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> apiToken [ ^ apiToken ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> apiToken: anObject [ apiToken := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> basePath [ ^ basePath ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> basePath: anObject [ basePath := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> bearerToken [ ^ bearerToken ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> bearerToken: anObject [ bearerToken := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> client [ ^ client ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> client: anObject [ client := anObject ] -{ #category : 'api - pull-requests' } +{ #category : #'api - pull-requests' } BitBucketApi >> commitsOfPullRequest: pullRequestId ofRepoProjectId: repoSlug inProjectGroupId: projectKey [ ^ self allValuesOfPath: self basePath, '/projects/', projectKey, '/repos/', repoSlug, '/pull-requests/', pullRequestId printString, '/commits'. ] -{ #category : 'api - commits' } +{ #category : #'api - commits' } BitBucketApi >> commitsOfRepoProjectId: repositorySlug inProjectGroupId: projectKey since: since until: until [ "/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits" @@ -134,7 +133,7 @@ BitBucketApi >> commitsOfRepoProjectId: repositorySlug inProjectGroupId: project commitDate <= until asDateAndTime ] ] -{ #category : 'api - commits' } +{ #category : #'api - commits' } BitBucketApi >> diffsOfCommit: commitID inRepoProjectId: repositorySlug inProjectGroupId: projectKey [ | results | @@ -149,19 +148,19 @@ BitBucketApi >> diffsOfCommit: commitID inRepoProjectId: repositorySlug inProjec ^ (NeoJSONReader on: results readStream) next ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> endpoint [ ^ endpoint ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> endpoint: anObject [ endpoint := anObject ] -{ #category : 'initialization' } +{ #category : #initialization } BitBucketApi >> initialize [ self client: (ZnClient new @@ -171,7 +170,7 @@ BitBucketApi >> initialize [ self basePath: 'rest/api/1.0' ] -{ #category : 'private - building' } +{ #category : #'private - building' } BitBucketApi >> prepareZnClient [ client := ZnClient new @@ -188,14 +187,14 @@ BitBucketApi >> prepareZnClient [ , (self username , ':' , self apiToken) utf8Encoded base64Encoded ]. ] -{ #category : 'api - projects' } +{ #category : #'api - projects' } BitBucketApi >> projects [ "/rest/api/1.0/projects" ^ self allValuesOfPath: self basePath , '/projects'. ] -{ #category : 'api - pull-requests' } +{ #category : #'api - pull-requests' } BitBucketApi >> pullRequestsOfRepoProjectId: repositorySlug inProjectGroupId: projectKey since: since until: until [ | pullRequests results lastCommitterTimestamp lastDate | @@ -231,12 +230,12 @@ BitBucketApi >> pullRequestsOfRepoProjectId: repositorySlug inProjectGroupId: pr commitDate >= since asDate and: commitDate <= until asDate ] ] -{ #category : 'api - projects' } +{ #category : #'api - projects' } BitBucketApi >> repositoryProjectsOfProjectGroupId: projectKey [ ^self allValuesOfPath: self basePath, '/projects/', projectKey, '/repos'. ] -{ #category : 'api - user' } +{ #category : #'api - user' } BitBucketApi >> user: accountId [ "https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-user-get" @@ -246,19 +245,19 @@ BitBucketApi >> user: accountId [ ^ self client get ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> username [ ^ username ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketApi >> username: anObject [ username := anObject ] -{ #category : 'api - user' } +{ #category : #'api - user' } BitBucketApi >> usersByUsername: usernameString [ | users | diff --git a/src/BitBucketHealth-Model-Importer/BitBucketModelImporter.class.st b/src/BitBucketHealth-Model-Importer/BitBucketModelImporter.class.st index ad6a242..bdd7233 100644 --- a/src/BitBucketHealth-Model-Importer/BitBucketModelImporter.class.st +++ b/src/BitBucketHealth-Model-Importer/BitBucketModelImporter.class.st @@ -1,14 +1,13 @@ Class { - #name : 'BitBucketModelImporter', - #superclass : 'GPModelImporter', + #name : #BitBucketModelImporter, + #superclass : #GPModelImporter, #instVars : [ 'withInitialCommits' ], - #category : 'BitBucketHealth-Model-Importer', - #package : 'BitBucketHealth-Model-Importer' + #category : #'BitBucketHealth-Model-Importer' } -{ #category : 'accessing' } +{ #category : #accessing } BitBucketModelImporter >> bitBucketApi [ self @@ -20,7 +19,7 @@ BitBucketModelImporter >> bitBucketApi [ ^ repoApi ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketModelImporter >> bitBucketApi: anObject [ self @@ -32,7 +31,7 @@ BitBucketModelImporter >> bitBucketApi: anObject [ repoApi := anObject ] -{ #category : 'import - projects' } +{ #category : #'import - projects' } BitBucketModelImporter >> completeImportProject: aGLHProject [ aGLHProject repository: GLHRepository new. @@ -41,7 +40,7 @@ BitBucketModelImporter >> completeImportProject: aGLHProject [ ^ aGLHProject ] -{ #category : 'commit' } +{ #category : #commit } BitBucketModelImporter >> completeImportedCommit: aCommit [ ('completing commit: ' , aCommit short_id printString) recordInfo. @@ -56,7 +55,7 @@ BitBucketModelImporter >> completeImportedCommit: aCommit [ ^ aCommit ] -{ #category : 'private - api' } +{ #category : #'private - api' } BitBucketModelImporter >> convertBitBucketDiffToGitDiff: response [ | fromHash toHash sourceLine sourceSpan destinationLine destinationSpan result filePathSource filePathDestination | @@ -66,7 +65,7 @@ BitBucketModelImporter >> convertBitBucketDiffToGitDiff: response [ "Iterate over each diff in 'diffs'" result := (response at: #diffs) collect: [ :diff | "Extract file path, hashes" - | gitDiff | + | gitDiff hunks| gitDiff := ''. filePathSource := (diff at: 'source') ifNil: '' @@ -85,7 +84,8 @@ BitBucketModelImporter >> convertBitBucketDiffToGitDiff: response [ , String cr. "Iterate over hunks" - (diff at: 'hunks') do: [ :hunk | + hunks := diff at: #hunks ifPresent: [ :value | value ] ifAbsent: [ { } ]. + hunks do: [ :hunk | sourceLine := hunk at: 'sourceLine'. sourceSpan := hunk at: 'sourceSpan'. destinationLine := hunk at: 'destinationLine'. @@ -118,7 +118,7 @@ BitBucketModelImporter >> convertBitBucketDiffToGitDiff: response [ ^ result ] -{ #category : 'private - api' } +{ #category : #'private - api' } BitBucketModelImporter >> getContributionFromDiffs: diffs [ | contribution | @@ -157,7 +157,7 @@ BitBucketModelImporter >> getContributionFromDiffs: diffs [ ^ contribution ] -{ #category : 'import - commits' } +{ #category : #'import - commits' } BitBucketModelImporter >> importAndLoadLatestsCommitsOfProject: aGLHProject [ | commits | @@ -174,7 +174,7 @@ BitBucketModelImporter >> importAndLoadLatestsCommitsOfProject: aGLHProject [ ^ commits ] -{ #category : 'import - commits' } +{ #category : #'import - commits' } BitBucketModelImporter >> importCommitsOfProject: aGLHProject since: since until: until [ | commits | @@ -199,7 +199,7 @@ BitBucketModelImporter >> importCommitsOfProject: aGLHProject since: since until unless: self blockOnIdEquality ] -{ #category : 'import - projects' } +{ #category : #'import - projects' } BitBucketModelImporter >> importContributedProjectsOfUser: aGLHUser [ | projects repositories repositoriesCommits userRepositories userProjects | @@ -257,7 +257,7 @@ BitBucketModelImporter >> importContributedProjectsOfUser: aGLHUser [ ^ userProjects ] -{ #category : 'import - commits' } +{ #category : #'import - commits' } BitBucketModelImporter >> importCreatorOfCommit: aGLHCommit [ | creator | @@ -272,7 +272,7 @@ BitBucketModelImporter >> importCreatorOfCommit: aGLHCommit [ ^ creator ] -{ #category : 'import - commits' } +{ #category : #'import - commits' } BitBucketModelImporter >> importDiffOfCommit: aCommit [ | result diffsResult | @@ -298,7 +298,7 @@ BitBucketModelImporter >> importDiffOfCommit: aCommit [ ^ diffsResult ] -{ #category : 'import - merge-requests' } +{ #category : #'import - merge-requests' } BitBucketModelImporter >> importMergeRequestCommits: mergeRequest [ | commits | @@ -315,7 +315,7 @@ BitBucketModelImporter >> importMergeRequestCommits: mergeRequest [ ^ commits ] -{ #category : 'import - merge-requests' } +{ #category : #'import - merge-requests' } BitBucketModelImporter >> importMergeRequests: aGLHProject since: fromDate until: toDate [ | pullRequests | @@ -334,12 +334,12 @@ BitBucketModelImporter >> importMergeRequests: aGLHProject since: fromDate until ^ pullRequests ] -{ #category : 'import - merge-requests' } +{ #category : #'import - merge-requests' } BitBucketModelImporter >> importMergeResquestAuthor: mergeRequest [ mergeRequest author ifNotNil: [ ^mergeRequest ] ] -{ #category : 'import - merge-requests' } +{ #category : #'import - merge-requests' } BitBucketModelImporter >> importMergeResquestMerger: mergeRequest [ | activities mergeActivity mergeUser | @@ -369,7 +369,7 @@ BitBucketModelImporter >> importMergeResquestMerger: mergeRequest [ ^ mergeUser ] -{ #category : 'import - users' } +{ #category : #'import - users' } BitBucketModelImporter >> importUserByUsername: username [ @@ -390,7 +390,7 @@ BitBucketModelImporter >> importUserByUsername: username [ ] -{ #category : 'parsing' } +{ #category : #parsing } BitBucketModelImporter >> parseCommitIntoGLHCommit: commitDictionary ofProject: aGLHProject [ | author committer parentIds commitDiffs contribution | @@ -426,7 +426,7 @@ BitBucketModelImporter >> parseCommitIntoGLHCommit: commitDictionary ofProject: deletions: (contribution at: #deletions) ] -{ #category : 'parsing' } +{ #category : #parsing } BitBucketModelImporter >> parseProjectIntoGLHGroup: projectRepository [ ^GLHGroup new @@ -435,7 +435,7 @@ BitBucketModelImporter >> parseProjectIntoGLHGroup: projectRepository [ description: (projectRepository at: #description). ] -{ #category : 'parsing' } +{ #category : #parsing } BitBucketModelImporter >> parsePullRequestIntoGLPHEMergeRequest: pullRequestDictionary [ | repository project toRef fromRef glpheMergeRequest author state reviewers | @@ -511,7 +511,7 @@ BitBucketModelImporter >> parsePullRequestIntoGLPHEMergeRequest: pullRequestDict ^ glpheMergeRequest ] -{ #category : 'parsing' } +{ #category : #parsing } BitBucketModelImporter >> parseRepoIntoGLHProject: repositoryDictionary [ | project group glhProject | @@ -538,7 +538,7 @@ BitBucketModelImporter >> parseRepoIntoGLHProject: repositoryDictionary [ ^ glhProject ] -{ #category : 'parsing' } +{ #category : #parsing } BitBucketModelImporter >> parseUserIntoGLHUser: userDictionnary [ ^ GLHUser new name: (userDictionnary at: #displayName); @@ -547,13 +547,13 @@ BitBucketModelImporter >> parseUserIntoGLHUser: userDictionnary [ username: (userDictionnary at: #name). ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketModelImporter >> withInitialCommits [ ^ withInitialCommits ] -{ #category : 'accessing' } +{ #category : #accessing } BitBucketModelImporter >> withInitialCommits: anObject [ withInitialCommits := anObject diff --git a/src/BitBucketHealth-Model-Importer/package.st b/src/BitBucketHealth-Model-Importer/package.st index 5727dd7..288298e 100644 --- a/src/BitBucketHealth-Model-Importer/package.st +++ b/src/BitBucketHealth-Model-Importer/package.st @@ -1 +1 @@ -Package { #name : 'BitBucketHealth-Model-Importer' } +Package { #name : #'BitBucketHealth-Model-Importer' }