2023-02-22 09:18:53 +01:00
|
|
|
import * as git from '../../util/git';
|
2023-11-11 13:18:00 +01:00
|
|
|
import type { CommitFilesConfig, LongCommitSha } from '../../util/git/types';
|
2023-02-22 09:18:53 +01:00
|
|
|
import type { PlatformScm } from './types';
|
|
|
|
|
|
|
|
export class DefaultGitScm implements PlatformScm {
|
|
|
|
branchExists(branchName: string): Promise<boolean> {
|
|
|
|
return Promise.resolve(git.branchExists(branchName));
|
|
|
|
}
|
|
|
|
|
2023-11-11 13:18:00 +01:00
|
|
|
commitAndPush(
|
|
|
|
commitConfig: CommitFilesConfig,
|
|
|
|
): Promise<LongCommitSha | null> {
|
2023-02-22 09:18:53 +01:00
|
|
|
return git.commitFiles(commitConfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
deleteBranch(branchName: string): Promise<void> {
|
|
|
|
return git.deleteBranch(branchName);
|
|
|
|
}
|
|
|
|
|
2023-11-11 13:18:00 +01:00
|
|
|
getBranchCommit(branchName: string): Promise<LongCommitSha | null> {
|
2023-02-22 09:18:53 +01:00
|
|
|
return Promise.resolve(git.getBranchCommit(branchName));
|
|
|
|
}
|
|
|
|
|
|
|
|
isBranchBehindBase(branchName: string, baseBranch: string): Promise<boolean> {
|
|
|
|
return git.isBranchBehindBase(branchName, baseBranch);
|
|
|
|
}
|
|
|
|
|
|
|
|
isBranchConflicted(baseBranch: string, branch: string): Promise<boolean> {
|
|
|
|
return git.isBranchConflicted(baseBranch, branch);
|
|
|
|
}
|
|
|
|
|
2024-04-23 20:59:47 +10:00
|
|
|
isBranchModified(branchName: string, baseBranch: string): Promise<boolean> {
|
|
|
|
return git.isBranchModified(branchName, baseBranch);
|
2023-02-22 09:18:53 +01:00
|
|
|
}
|
2023-05-07 06:12:15 +02:00
|
|
|
|
|
|
|
getFileList(): Promise<string[]> {
|
|
|
|
return git.getFileList();
|
|
|
|
}
|
|
|
|
|
2023-11-11 13:18:00 +01:00
|
|
|
checkoutBranch(branchName: string): Promise<LongCommitSha> {
|
2023-05-07 06:12:15 +02:00
|
|
|
return git.checkoutBranch(branchName);
|
|
|
|
}
|
2023-08-07 17:39:43 +02:00
|
|
|
|
|
|
|
mergeAndPush(branchName: string): Promise<void> {
|
|
|
|
return git.mergeBranch(branchName);
|
|
|
|
}
|
|
|
|
|
|
|
|
mergeToLocal(branchName: string): Promise<void> {
|
|
|
|
return git.mergeToLocal(branchName);
|
|
|
|
}
|
2023-02-22 09:18:53 +01:00
|
|
|
}
|