<commit_before>alias qu="_quilt"
alias quilt="_quilt"

_quilt_new() {
    # Usage:
    #   $ new changes.diff
    #   quilt new changes.diff
    #
    #   $ new changes
    #   quilt new changes.diff
    #
    #   $ new my changes
    #   quilt new my-changes.diff

    file_name="${@}"
    file_name="$(echo "${file_name}" | slugify)"

    if [[ "${file_name}" != *".diff" ]]; then
        file_name="${file_name}.diff"
    fi

    set -x
    quilt new "${file_name}"
    set +x
}

_quilt_set_alias() {
    existing_alias_to_override="${1}"
    new_alias_value="${2}"

    if type "${existing_alias_to_override}" &> /dev/null; then
        unalias "${existing_alias_to_override}"
    fi

    alias "${existing_alias_to_override}"="${new_alias_value}"
}

_quilt_override_aliases() {
    _quilt_set_alias "n"   "_quilt_new"
    _quilt_set_alias "new" "_quilt_new"

    _quilt_set_alias "po"  "quilt pop"
    _quilt_set_alias "pop" "quilt pop"

    _quilt_set_alias "pu"   "quilt push"
    _quilt_set_alias "push" "quilt push"

    _quilt_set_alias "q" "quilt"

    _quilt_set_alias "r"       "quilt refresh"
    _quilt_set_alias "re"      "quilt refresh"
    _quilt_set_alias "ref"     "quilt refresh"
    _quilt_set_alias "refresh" "quilt refresh"

    _quilt_set_alias "se"     "quilt series"
    _quilt_set_alias "ser"    "quilt series"
    _quilt_set_alias "series" "quilt series"

    _quilt_set_alias "t"   "quilt top"
    _quilt_set_alias "to"  "quilt top"
    _quilt_set_alias "top" "quilt top"
}

_quilt_activate_quilt_mode() {
    export _QUILT_MODE_ON="yes"
    export _OLD_QUILT_PS1="${PS1}"
    export PS1="(quilt) ${PS1}"

    bash
    _quilt_deactivate_quilt_mode
}

_quilt_deactivate_quilt_mode() {
    if [ -n "${_OLD_QUILT_PS1}" ]; then
        export PS1="${_OLD_QUILT_PS1}"
        unset _OLD_QUILT_PS1
        unset _QUILT_MODE_ON
    fi
}

_quilt() {
    if [ -z "${_QUILT_MODE_ON}" ]; then
        _quilt_activate_quilt_mode
    else
        \quilt "${@}"
    fi
}

if [ -n "${_QUILT_MODE_ON}" ]; then
    _quilt_override_aliases
fi
<commit_msg>Add additional aliases for quilt mode<commit_after>alias qu="_quilt"
alias quilt="_quilt"

_quilt_new() {
    # Usage:
    #   $ new changes.diff
    #   quilt new changes.diff
    #
    #   $ new changes
    #   quilt new changes.diff
    #
    #   $ new my changes
    #   quilt new my-changes.diff

    file_name="${@}"
    file_name="$(echo "${file_name}" | slugify)"

    if [[ "${file_name}" != *".diff" ]]; then
        file_name="${file_name}.diff"
    fi

    set -x
    quilt new "${file_name}"
    set +x
}

_quilt_set_alias() {
    existing_alias_to_override="${1}"
    new_alias_value="${2}"

    if type "${existing_alias_to_override}" &> /dev/null; then
        unalias "${existing_alias_to_override}"
    fi

    alias "${existing_alias_to_override}"="${new_alias_value}"
}

_quilt_override_aliases() {
    _quilt_set_alias "n"   "_quilt_new"
    _quilt_set_alias "new" "_quilt_new"

    _quilt_set_alias "pua"     "quilt push -a"
    _quilt_set_alias "pusha"   "quilt push -a"
    _quilt_set_alias "pushall" "quilt push -a"

    _quilt_set_alias "po"  "quilt pop"
    _quilt_set_alias "pop" "quilt pop"

    _quilt_set_alias "poa"    "quilt pop -a"
    _quilt_set_alias "popa"   "quilt pop -a"
    _quilt_set_alias "popall" "quilt pop -a"

    _quilt_set_alias "pu"   "quilt push"
    _quilt_set_alias "push" "quilt push"

    _quilt_set_alias "q" "quilt"

    _quilt_set_alias "r"       "quilt refresh"
    _quilt_set_alias "re"      "quilt refresh"
    _quilt_set_alias "ref"     "quilt refresh"
    _quilt_set_alias "refresh" "quilt refresh"

    _quilt_set_alias "se"     "quilt series"
    _quilt_set_alias "ser"    "quilt series"
    _quilt_set_alias "series" "quilt series"

    _quilt_set_alias "t"   "quilt top"
    _quilt_set_alias "to"  "quilt top"
    _quilt_set_alias "top" "quilt top"
}

_quilt_activate_quilt_mode() {
    export _QUILT_MODE_ON="yes"
    export _OLD_QUILT_PS1="${PS1}"
    export PS1="(quilt) ${PS1}"

    bash
    _quilt_deactivate_quilt_mode
}

_quilt_deactivate_quilt_mode() {
    if [ -n "${_OLD_QUILT_PS1}" ]; then
        export PS1="${_OLD_QUILT_PS1}"
        unset _OLD_QUILT_PS1
        unset _QUILT_MODE_ON
    fi
}

_quilt() {
    if [ -z "${_QUILT_MODE_ON}" ]; then
        _quilt_activate_quilt_mode
    else
        \quilt "${@}"
    fi
}

if [ -n "${_QUILT_MODE_ON}" ]; then
    _quilt_override_aliases
fi

{'fraction_non_alphanumeric': 0.12533814247069433, 'fraction_numerical': 0.004508566275924256, 'mean_word_length': 2.979372197309417, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2049491', 'n_tokens_mistral': 1804, 'n_tokens_neox': 1770, 'n_words': 345}