private parseRow()

in src/dal/git/GitStatusRowsParser.ts [49:85]


    private parseRow(workspaceRootPath: string, statusRow: string): CvsResource {
        let isFromIndex = this.settings.shouldCollectGitChangesFromIndex();
        const {relativePath, indexStatus, workingTreeStatus, prevRelativePath} =
            GitCommandArgumentsParser.parseStatusRow(statusRow);
        isFromIndex = isFromIndex || (!isFromIndex && workingTreeStatus === undefined);
        switch (isFromIndex ? indexStatus : workingTreeStatus) {
            case "M": {
                const fileAbsPath: string = path.join(workspaceRootPath, relativePath);
                return new ModifiedCvsResource(fileAbsPath, relativePath, this.getFileServerPath(relativePath));
            }
            case "A": {
                const fileAbsPath: string = path.join(workspaceRootPath, relativePath);
                return new AddedCvsResource(fileAbsPath, relativePath, this.getFileServerPath(relativePath));
            }
            case "D": {
                const fileAbsPath: string = path.join(workspaceRootPath, relativePath);
                return new DeletedCvsResource(fileAbsPath, relativePath, this.getFileServerPath(relativePath));
            }
            case "R": {
                const fileAbsPath: string = path.join(workspaceRootPath, relativePath);
                const prevFileAbsPath: string = path.join(workspaceRootPath, prevRelativePath);
                return new ReplacedCvsResource(fileAbsPath,
                    relativePath,
                    this.getFileServerPath(relativePath),
                    prevFileAbsPath,
                    this.getFileServerPath(prevRelativePath));
            }
            case "C": {
                const fileAbsPath: string = path.join(workspaceRootPath, relativePath);
                return new AddedCvsResource(fileAbsPath, relativePath, this.getFileServerPath(relativePath));
            }
            default: {
                throw new Error(`Resource status for status row ${statusRow} is ` +
                    `'${indexStatus}' and not recognised`);
            }
        }
    }