import { CpProxy } from "../../bll/moduleproxies/cp-proxy" ; import { GitStatusCommand } from "./GitStatusCommand" ; import { GitStatusRowsParser } from "./GitStatusRowsParser" ; import { GetRepoBranchNameCommand } from "./GetRepoBranchNameCommand" ; import { GetRemoteNameCommand } from "./GetRemoteNameCommand" ; import { GetLocalBranchNameCommand } from "./GetLocalBranchNameCommand" ; import { GetRemoteBranchName } from "./GetRemoteBranchName" ; import { GetLastCompatibleMergeBaseRev } from "./GetLastCompatibleMergeBaseRev" ; import { GetFirstMonthRev } from "./GetFirstMonthRev" ; import { CvsResource } from "../../bll/entities/cvsresources/cvsresource" ; import { GetStagedFileContentLength } from "./GetStagedFileContentLength" ; import { GetStagedFileContentStream } from "./GetStagedFileContentStream" ; import { Settings } from "../../bll/entities/settings" ; export class GitCommandsFactory { private constructor ( private readonly cpProxy , private readonly settings , private readonly workspaceRootPath , private readonly gitPath ) { } public async getStatusCommand ( ) { const statusRowsParser = await GitStatusRowsParser . prepareInstance ( this . settings , this . getFirstMonthRevCommand ( ) , this . getLastCompatibleMergeBaseRevCommand ( ) ) ; return new GitStatusCommand ( this . workspaceRootPath , this . gitPath , this . cpProxy , statusRowsParser ) ; } public getRepoBranchNameCommand ( ) { const getRemoteNameCommand = this . getGetRemoteNameCommand ( ) ; return new GetRepoBranchNameCommand ( this . workspaceRootPath , this . gitPath , this . cpProxy , getRemoteNameCommand ) ; } private getGetRemoteNameCommand ( ) { const getLocalBranchNameCommand = this . getLocalBranchNameCommand ( ) ; return new GetRemoteNameCommand ( this . workspaceRootPath , this . gitPath , this . cpProxy , getLocalBranchNameCommand ) ; } private getLocalBranchNameCommand ( ) { return new GetLocalBranchNameCommand ( this . workspaceRootPath , this . gitPath , this . cpProxy ) ; } public getLastCompatibleMergeBaseRevCommand ( ) { const getRemoteBranchNameCommand = this . getRemoteBranchCommand ( ) ; return new GetLastCompatibleMergeBaseRev ( this . workspaceRootPath , this . gitPath , this . cpProxy , getRemoteBranchNameCommand ) ; } private getRemoteBranchCommand ( ) { return new GetRemoteBranchName ( this . workspaceRootPath , this . gitPath , this . cpProxy ) ; } public getFirstMonthRevCommand ( ) { return new GetFirstMonthRev ( this . workspaceRootPath , this . gitPath , this . cpProxy ) ; } public getStagedFileContentStreamCommand ( cvsResource ) { return new GetStagedFileContentStream ( this . workspaceRootPath , this . gitPath , this . cpProxy , cvsResource , this . getStagedFileContentLengthCommand ( cvsResource ) ) ; } private getStagedFileContentLengthCommand ( cvsResource ) { return new GetStagedFileContentLength ( this . workspaceRootPath , this . gitPath , cvsResource , this . cpProxy ) ; } public static getInstance ( cpProxy , settings , workspaceRootPath , gitPath ) { return new GitCommandsFactory ( cpProxy , settings , workspaceRootPath , gitPath ) ; } }