<commit_before>#!/bin/sh

set -e # Fail on error

# Change to root repo dir
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

# Read destination dir (repo)
DEST=$1
if [ "$DEST" = "" ]; then
  echo "No destination specified. Need /path/to/client-beta"
  exit 1
fi

TAG=$2
if [ "$TAG" = "" ]; then
  echo "No tag specified"
  exit 1
fi

# Check dest exists
if [ ! -d "$DEST" ]; then
  echo "$DEST doesn't exist"
  exit 2
fi

# These are the only dirs we want to make available
dirs=(go protocol)

# Archive the current client repo
echo "Building git archive for $TAG"
cd $DIR/../..
git archive --format tar $TAG > $DIR/client.tar
cd $DIR

cp export.md $DEST/README.md

cd $DEST
rm -rf src
mkdir -p client
tar xpf $DIR/client.tar -C client ${dirs[@]}

rm $DIR/client.tar

echo "Now you should add, commit, tag and push the changes."
echo "

    cd $DEST
    git add .
    git commit -m \"Importing $TAG\"<commit_msg>Fix bug where export to client-beta wasn't clearing directory properly<commit_after>#!/bin/sh

set -e # Fail on error

# Change to root repo dir
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

# Read destination dir (repo)
DEST=$1
if [ "$DEST" = "" ]; then
  echo "No destination specified. Need /path/to/client-beta"
  exit 1
fi

TAG=$2
if [ "$TAG" = "" ]; then
  echo "No tag specified"
  exit 1
fi

# Check dest exists
if [ ! -d "$DEST" ]; then
  echo "$DEST doesn't exist"
  exit 2
fi

# These are the only dirs we want to make available
dirs=(go protocol)

# Archive the current client repo
echo "Building git archive for $TAG"
cd $DIR/../..
git archive --format tar $TAG > $DIR/client.tar
cd $DIR

cp export.md $DEST/README.md

cd $DEST
rm -rf client
mkdir -p client
tar xpf $DIR/client.tar -C client ${dirs[@]}

rm $DIR/client.tar

echo "Now you should add, commit, tag and push the changes."
echo "

    cd $DEST
    git add .
    git commit -m \"Importing $TAG\"
{'fraction_non_alphanumeric': 0.14029535864978904, 'fraction_numerical': 0.006329113924050633, 'mean_word_length': 3.132897603485839, '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': '6929242', 'n_tokens_mistral': 692, 'n_tokens_neox': 670, 'n_words': 270}