mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-25 10:33:21 +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 {
|
commitUrl(commitId: string): string | undefined {
|
||||||
// if repoBaseUrl is bitbucket, then the commit url is different
|
// Different Git providers use different paths for the commit url:
|
||||||
if (this.repoBaseUrl.includes('bitbucket.org')) {
|
if (this.isBitBucket) {
|
||||||
return `${this.repoBaseUrl}/commits/${commitId}`;
|
return `${this.repoBaseUrl}/commits/${commitId}`;
|
||||||
}
|
}
|
||||||
if (this.repoBaseUrl.includes('gitlab.com')) {
|
if (this.isGitlab) {
|
||||||
return `${this.repoBaseUrl}/-/commit/${commitId}`;
|
return `${this.repoBaseUrl}/-/commit/${commitId}`;
|
||||||
}
|
}
|
||||||
return `${this.repoBaseUrl}/commit/${commitId}`;
|
return `${this.repoBaseUrl}/commit/${commitId}`;
|
||||||
@ -306,6 +306,18 @@ export class BaseBranch {
|
|||||||
if (!upstreamBranchName) return undefined;
|
if (!upstreamBranchName) return undefined;
|
||||||
const baseBranchName = this.branchName.split('/')[1];
|
const baseBranchName = this.branchName.split('/')[1];
|
||||||
const branchName = upstreamBranchName.split('/').slice(3).join('/');
|
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}`;
|
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