diff options
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/branches.ts')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/branches.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/helpers/branches.ts b/server/sonar-web/src/main/js/helpers/branches.ts index 6b4507eddcd..86dc7e10671 100644 --- a/server/sonar-web/src/main/js/helpers/branches.ts +++ b/server/sonar-web/src/main/js/helpers/branches.ts @@ -168,3 +168,21 @@ export function getBranchLikeQuery(branchLike?: BranchLike): BranchParameters { return {}; } } + +// Create branch object from branch name or pull request key +export function fillBranchLike( + branch?: string, + pullRequest?: string +): ShortLivingBranch | PullRequest | undefined { + if (branch) { + return { + isMain: false, + mergeBranch: '', + name: branch, + type: BranchType.SHORT + } as ShortLivingBranch; + } else if (pullRequest) { + return { base: '', branch: '', key: pullRequest, title: '' } as PullRequest; + } + return undefined; +} |