import { CpProxy } from "../../bll/moduleproxies/cp-proxy" ; import { Logger } from "../../bll/utils/logger" ; export class GetFirstMonthRev { constructor ( private readonly workspaceRootPath , private readonly gitPath , private readonly cpProxy ) { } public async execute ( ) { const command = this . getCommand ( ) ; const result = await this . cpProxy . execAsync ( command ) ; if ( ! result || ! result . stdout ) { Logger . logWarning ( `GitSupportProvider#firstRevHash: first month revision wasn't determined.` ) ; return "" ; } const firstRevHash = result . stdout . split ( "\n" ) [ 0 ] ; Logger . logDebug ( `GitSupportProvider#firstRevHash: first month revision is ${ firstRevHash }` ) ; return firstRevHash ; } private getCommand ( ) { const date = new Date ( ) ; return `"${ this . gitPath }" -C "${ this . workspaceRootPath }" rev-list --reverse ` + `--since="${ date . getFullYear ( ) }.${ date . getMonth ( ) + 1 }.1" HEAD` ; } }