2023-02-22 08:18:53 +00:00
|
|
|
import * as git from '../../util/git';
|
|
|
|
import type { CommitFilesConfig, CommitSha } from '../../util/git/types';
|
|
|
|
import type { PlatformScm } from './types';
|
|
|
|
|
|
|
|
export class DefaultGitScm implements PlatformScm {
|
|
|
|
branchExists(branchName: string): Promise<boolean> {
|
|
|
|
return Promise.resolve(git.branchExists(branchName));
|
|
|
|
}
|
|
|
|
|
|
|
|
commitAndPush(commitConfig: CommitFilesConfig): Promise<CommitSha | null> {
|
|
|
|
return git.commitFiles(commitConfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
deleteBranch(branchName: string): Promise<void> {
|
|
|
|
return git.deleteBranch(branchName);
|
|
|
|
}
|
|
|
|
|
|
|
|
getBranchCommit(branchName: string): Promise<CommitSha | null> {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2023-04-14 06:20:34 +00:00
|
|
|
isBranchModified(branchName: string): Promise<boolean> {
|
|
|
|
return git.isBranchModified(branchName);
|
2023-02-22 08:18:53 +00:00
|
|
|
}
|
2023-05-07 04:12:15 +00:00
|
|
|
|
|
|
|
getFileList(): Promise<string[]> {
|
|
|
|
return git.getFileList();
|
|
|
|
}
|
|
|
|
|
|
|
|
checkoutBranch(branchName: string): Promise<CommitSha> {
|
|
|
|
return git.checkoutBranch(branchName);
|
|
|
|
}
|
2023-08-07 15:39:43 +00:00
|
|
|
|
|
|
|
mergeAndPush(branchName: string): Promise<void> {
|
|
|
|
return git.mergeBranch(branchName);
|
|
|
|
}
|
|
|
|
|
|
|
|
mergeToLocal(branchName: string): Promise<void> {
|
|
|
|
return git.mergeToLocal(branchName);
|
|
|
|
}
|
2023-02-22 08:18:53 +00:00
|
|
|
}
|