<commit_before>import { window, workspace, InputBoxOptions } from "vscode";
import { Gerrit } from "./gerrit";
import { Ref } from "./ref";
import { Logger } from "./logger";
import * as utils from "./utils";
import * as path from "path";

// TODO: Define a reject reason interface
export class GerritController {
    private logger: Logger;

    constructor(private gerrit: Gerrit) {
        this.logger = Logger.logger;
    }

    public stageAll() {
        this.gerrit.stage(".");
    }

    // TODO: reset files
    public stageCurrentFile() {
        let path: string = window.activeTextEditor.document.fileName;
        this.gerrit.stage(path);
    }

    // TODO: extend show quick pick with custom type and show message if no dirty files
    public stageFile() {
        window.showQuickPick(new Promise((resolve, reject) => {
            this.gerrit.getDirtyFiles().then(value => {
                resolve(value);
            }, reason => {
                reject(reason);
            });
        }), { placeHolder: "File to stage" }).then(value => {
            let filePath = path.join(workspace.rootPath, value);
            this.gerrit.stage(filePath).then(value => {
            }, reason => {
            });
        }, reason => {
        });
    }

    public commit() {
        let options: InputBoxOptions = {
            placeHolder: "Commit Message",
            prompt: "The commit description"
        };

        window.showInputBox(options).then(message => {
            this.gerrit.commit(message, [""], false);
        }, reason => {
        });
    }

    public commitAmend() {<commit_msg>Show message on no dirty files<commit_after>import { window, workspace, InputBoxOptions } from "vscode";
import { Gerrit } from "./gerrit";
import { Ref } from "./ref";
import { Logger } from "./logger";
import * as utils from "./utils";
import * as path from "path";

// TODO: Define a reject reason interface
export class GerritController {
    private logger: Logger;

    constructor(private gerrit: Gerrit) {
        this.logger = Logger.logger;
    }

    public stageAll() {
        this.gerrit.stage(".");
    }

    // TODO: reset files
    public stageCurrentFile() {
        let path: string = window.activeTextEditor.document.fileName;
        this.gerrit.stage(path);
    }

    // TODO: extend show quick pick with custom type
    public stageFile() {
        window.showQuickPick(new Promise((resolve, reject) => {
            this.gerrit.getDirtyFiles().then(value => {
                if (value.length === 0) {
                    reject({
                        noDirtyFiles: true,
                        displayInfo: true,
                        msg: "No files to stage"
                    });
                }
                resolve(value);
            }, reason => {
                reject(reason);
            });
        }), { placeHolder: "File to stage" }).then(value => {
            let filePath = path.join(workspace.rootPath, value);
            this.gerrit.stage(filePath).then(value => {
            }, reason => {
            });
        }, reason => {
            if (reason.noDirtyFiles && reason.displayInfo) {
                window.showInformationMessage(reason.msg);
            }
        });
    }

    public commit() {
        let options: InputBoxOptions = {
            placeHolder: "Commit Message",
            prompt: "The commit description"
        };

        window.showInputBox(options).then(message => {
            this.gerrit.commit(message, [""], false);
        }, reason => {
        });
    }

    public commitAmend() {
{'fraction_non_alphanumeric': 0.12961421038023868, 'fraction_numerical': 0.0002775464890369137, 'mean_word_length': 1.8377952755905511, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2066544', 'n_tokens_mistral': 985, 'n_tokens_neox': 941, 'n_words': 239}