From 1516dd1095cb68305d3c6e5df87d7e694882450f Mon Sep 17 00:00:00 2001 From: GitButler Date: Fri, 29 Mar 2024 17:04:16 +0100 Subject: [PATCH 1/2] Add support for opening a BitBucket branch remotely --- gitbutler-ui/src/lib/vbranches/types.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gitbutler-ui/src/lib/vbranches/types.ts b/gitbutler-ui/src/lib/vbranches/types.ts index abe30cfcb..77ec00a8b 100644 --- a/gitbutler-ui/src/lib/vbranches/types.ts +++ b/gitbutler-ui/src/lib/vbranches/types.ts @@ -288,11 +288,11 @@ export class BaseBranch { } commitUrl(commitId: string): string | undefined { - // if repoBaseUrl is bitbucket, then the commit url is different - if (this.repoBaseUrl.includes('bitbucket.org')) { + // Different Git providers use different paths for the commit url: + if (this.isBitBucket) { return `${this.repoBaseUrl}/commits/${commitId}`; } - if (this.repoBaseUrl.includes('gitlab.com')) { + if (this.isGitlab) { return `${this.repoBaseUrl}/-/commit/${commitId}`; } return `${this.repoBaseUrl}/commit/${commitId}`; @@ -306,6 +306,18 @@ export class BaseBranch { if (!upstreamBranchName) return undefined; const baseBranchName = this.branchName.split('/')[1]; const branchName = upstreamBranchName.split('/').slice(3).join('/'); + if (this.isBitBucket) { + return `${this.repoBaseUrl.trim()}/branch/${branchName}?dest=${baseBranchName}`; + } + // The following branch path is good for at least Gitlab and Github: return `${this.repoBaseUrl.trim()}/compare/${baseBranchName}...${branchName}`; } + + private get isBitBucket(): boolean { + return this.repoBaseUrl.includes('bitbucket.org'); + } + + private get isGitlab(): boolean { + return this.repoBaseUrl.includes('gitlab.com'); + } } From 80efa6c6ac5d8aa453b6cfcccb72506f6617de7d Mon Sep 17 00:00:00 2001 From: GitButler Date: Fri, 29 Mar 2024 17:10:48 +0100 Subject: [PATCH 2/2] Freaking whitespaces --- gitbutler-ui/src/lib/vbranches/types.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gitbutler-ui/src/lib/vbranches/types.ts b/gitbutler-ui/src/lib/vbranches/types.ts index 77ec00a8b..b8edaf537 100644 --- a/gitbutler-ui/src/lib/vbranches/types.ts +++ b/gitbutler-ui/src/lib/vbranches/types.ts @@ -288,7 +288,7 @@ export class BaseBranch { } commitUrl(commitId: string): string | undefined { - // Different Git providers use different paths for the commit url: + // Different Git providers use different paths for the commit url: if (this.isBitBucket) { return `${this.repoBaseUrl}/commits/${commitId}`; } @@ -306,18 +306,18 @@ export class BaseBranch { if (!upstreamBranchName) return undefined; const baseBranchName = this.branchName.split('/')[1]; const branchName = upstreamBranchName.split('/').slice(3).join('/'); - if (this.isBitBucket) { - return `${this.repoBaseUrl.trim()}/branch/${branchName}?dest=${baseBranchName}`; + if (this.isBitBucket) { + return `${this.repoBaseUrl.trim()}/branch/${branchName}?dest=${baseBranchName}`; } - // The following branch path is good for at least Gitlab and Github: + // The following branch path is good for at least Gitlab and Github: return `${this.repoBaseUrl.trim()}/compare/${baseBranchName}...${branchName}`; } - private get isBitBucket(): boolean { - return this.repoBaseUrl.includes('bitbucket.org'); - } + private get isBitBucket(): boolean { + return this.repoBaseUrl.includes('bitbucket.org'); + } - private get isGitlab(): boolean { - return this.repoBaseUrl.includes('gitlab.com'); - } + private get isGitlab(): boolean { + return this.repoBaseUrl.includes('gitlab.com'); + } }