mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-25 02:26:14 +03:00
Add support for opening a BitBucket branch remotely
This commit is contained in:
parent
fe36d83b8e
commit
1516dd1095
@ -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');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user