sapling/tests/copytrace.sh
Ryan McElroy ed15cdfb7f copytrace: skip tests if getdb.sh is not present
Test Plan: run-tests.py test-copytrace.t test-copytrace-bundle2.t test-filldb.t

Reviewers: #sourcecontrol, ttung

Reviewed By: ttung

Differential Revision: https://phabricator.fb.com/D2903427

Tasks: 9944051

Signature: t1:2903427:1454630393:5fda38cf9c6c981304cdc249e4f15cfd78f88497
2016-02-05 03:23:19 -08:00

36 lines
845 B
Bash

test -f "$TESTDIR/getdb.sh" || exit 80
DBHOSTPORT=$($TESTDIR/getdb.sh)
DBHOST=`echo $DBHOSTPORT | cut -d : -f 1`
DBPORT=`echo $DBHOSTPORT | cut -d : -f 2`
DBNAME=`echo $DBHOSTPORT | cut -d : -f 3`
DBUSER=`echo $DBHOSTPORT | cut -d : -f 4`
DBPASS=`echo $DBHOSTPORT | cut -d : -f 5-`
mysql -h $DBHOST -P $DBPORT -u $DBUSER -p"$DBPASS" -e "
CREATE DATABASE IF NOT EXISTS $DBNAME;" 2>/dev/null
mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER -p"$DBPASS" -e '
DROP TABLE IF EXISTS Moves;' 2>/dev/null
function initserver() {
cat >> $1/.hg/hgrc <<EOF
[copytrace]
remote = True
xdbhost = $DBHOST
xdb = $DBNAME
xdbuser = $DBUSER
xdbpassword = $DBPASS
xdbport = $DBPORT
enablebundle2 = True
EOF
}
function initclient() {
cat >> $1/.hg/hgrc <<EOF
[copytrace]
remote = False
enablebundle2 = True
enablefilldb = True
enablecopytracing = True
EOF
}