<commit_before>#!/usr/bin/env bash

RELEASE_PATH="python/etl/config/release.txt"

set -eu

if [[ $# -gt 0 ]]; then
    cat <<EOF

Usage: `basename $0`

This will update current version information in '$RELEASE_PATH'.

EOF
    exit 0
fi

if ! type -a git >/dev/null 2>&1 ; then
    echo "Executable 'git' not found" >&2
    exit 1
fi

RELEASE_FILE="/tmp/upload_env_release_${USER-nobody}$$.txt"
> "$RELEASE_FILE"
trap "rm \"$RELEASE_FILE\"" EXIT

echo "toplevel=`git rev-parse --show-toplevel`" >> "$RELEASE_FILE"
GIT_COMMIT_HASH=$(git rev-parse HEAD)
if GIT_LATEST_TAG=$(git describe --exact-match --tags HEAD 2>/dev/null); then
    echo "commit=$GIT_COMMIT_HASH ($GIT_LATEST_TAG)" >> "$RELEASE_FILE"
elif GIT_BRANCH=$(git symbolic-ref --short --quiet HEAD); then
    echo "commit=$GIT_COMMIT_HASH ($GIT_BRANCH)" >> "$RELEASE_FILE"
else
    echo "commit=$GIT_COMMIT_HASH" >> "$RELEASE_FILE"
fi
# TODO This should be the date of the latest commit to have a stable build.
echo "date=`date '+%Y-%m-%d %H:%M:%S%z'`" >> "$RELEASE_FILE"
<commit_msg>Use date of latest commit<commit_after>#!/usr/bin/env bash

RELEASE_PATH="python/etl/config/release.txt"

set -eu

if [[ $# -gt 0 ]]; then
    cat <<EOF

Usage: `basename $0`

This will update current version information in '$RELEASE_PATH'.

EOF
    exit 0
fi

if ! type -a git >/dev/null 2>&1 ; then
    echo "Executable 'git' not found" >&2
    exit 1
fi

# We add the latest commit hash to the release file which is misleading if we're pulling in modified files.
if git status --porcelain 2>/dev/null | egrep '^ M|^M' >/dev/null; then
    echo "Warning: Not all of your changes have been committed!" >&2
fi

RELEASE_FILE="/tmp/upload_env_release_${USER-nobody}$$.txt"
> "$RELEASE_FILE"
trap "rm \"$RELEASE_FILE\"" EXIT

echo "toplevel=`git rev-parse --show-toplevel`" >> "$RELEASE_FILE"

GIT_COMMIT_HASH=$(git rev-parse HEAD)
if GIT_LATEST_TAG=$(git describe --exact-match --tags HEAD 2>/dev/null); then
    echo "commit=$GIT_COMMIT_HASH ($GIT_LATEST_TAG)" >> "$RELEASE_FILE"
elif GIT_BRANCH=$(git symbolic-ref --short --quiet HEAD); then
    echo "commit=$GIT_COMMIT_HASH ($GIT_BRANCH)" >> "$RELEASE_FILE"
else
    echo "commit=$GIT_COMMIT_HASH" >> "$RELEASE_FILE"
fi

echo "date=`git log -1 --format='%ai' HEAD`" >> "$RELEASE_FILE"

{'fraction_non_alphanumeric': 0.15745614035087718, 'fraction_numerical': 0.008333333333333333, 'mean_word_length': 4.280092592592593, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 36, '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': '5733994', 'n_tokens_mistral': 895, 'n_tokens_neox': 839, 'n_words': 239}