mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
1d676720f3
Summary: Fix common issues running tests on Windows: - Deletion problem: On Windows files being mmapped cannot be directly deleted. In-process hg + object leak can prevent `rm -rf`. Change related code to not delete things, or actually release things like the blackbox. - Path quoting: Use double quote for paths. Also accept different forms of `$TESTTMP`. - EOL changes: Use `dos2unix` or change related script to not output `\r`. - `getpass.getuser()` imports `pwd` which does not exist: Fix by avoiding `getpass`. `test-update-unknown-files.t` probably requires further investigation. It tries `hg add B` where B is untracked and b is marked as removed (`? B` `R b`). It seems there are multiple layers (matcher, pendingchanges) that casefold normalize B to b, causing the case collision test to use `b` instead of `B` and report no collision. It was worked around by disabling in-process-hg. But related logic might require further thinking (for example, it does not seem that the pattern matcher should do a "pat in dirstate" check). Differential Revision: D38853387 fbshipit-source-id: 40c83bedc04fd6ee2c6ff67edc4d767d191ffc6b
109 lines
1.9 KiB
Bash
109 lines
1.9 KiB
Bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2.
|
|
|
|
CACHEDIR="$TESTTMP/hgcache"
|
|
export DUMMYSSH_STABLE_ORDER=1
|
|
cat >> $HGRCPATH <<EOF
|
|
[remotefilelog]
|
|
cachepath=$CACHEDIR
|
|
debug=True
|
|
historypackv1=True
|
|
[extensions]
|
|
remotefilelog=
|
|
rebase=
|
|
[ui]
|
|
ssh=$(dummysshcmd)
|
|
[server]
|
|
preferuncompressed=True
|
|
[experimental]
|
|
changegroup3=True
|
|
[rebase]
|
|
singletransaction=True
|
|
EOF
|
|
|
|
_cachecount=0
|
|
|
|
newcachedir() {
|
|
_cachecount=$((_cachecount+1))
|
|
CACHEDIR="$TESTTMP/hgcache$_cachecount"
|
|
setconfig remotefilelog.cachepath="$CACHEDIR"
|
|
}
|
|
|
|
hgcloneshallow() {
|
|
local name
|
|
local dest
|
|
orig=$1
|
|
shift
|
|
dest=$1
|
|
shift
|
|
hg clone --shallow --config remotefilelog.reponame=master $orig $dest $@
|
|
cat >> $dest/.hg/hgrc <<EOF
|
|
[remotefilelog]
|
|
reponame=master
|
|
[phases]
|
|
publish=False
|
|
EOF
|
|
}
|
|
|
|
hgcloneshallowlfs() {
|
|
local name
|
|
local dest
|
|
local lfsdir
|
|
orig=$1
|
|
shift
|
|
dest=$1
|
|
shift
|
|
lfsdir=$1
|
|
shift
|
|
hg clone --shallow --config "extensions.lfs=" --config "lfs.url=$lfsdir" --config remotefilelog.reponame=master $orig $dest $@
|
|
cat >> $dest/.hg/hgrc <<EOF
|
|
[extensions]
|
|
lfs=
|
|
[lfs]
|
|
url=$lfsdir
|
|
[remotefilelog]
|
|
reponame=master
|
|
[phases]
|
|
publish=False
|
|
EOF
|
|
}
|
|
|
|
hginit() {
|
|
local name
|
|
name=$1
|
|
shift
|
|
hg init $name $@ --config remotefilelog.reponame=master
|
|
}
|
|
|
|
clearcache() {
|
|
rm -rf $CACHEDIR/*
|
|
}
|
|
|
|
mkcommit() {
|
|
echo "$1" > "$1"
|
|
hg add "$1"
|
|
hg ci -m "$1"
|
|
}
|
|
|
|
ls_l() {
|
|
$PYTHON $TESTDIR/ls-l.py "$@"
|
|
}
|
|
|
|
findfilessorted() {
|
|
find "$1" -type f | sort
|
|
}
|
|
|
|
getmysqldb() {
|
|
source "$TESTDIR/hgsql/library.sh"
|
|
}
|
|
|
|
createpushrebaserecordingdb() {
|
|
mysql -h $DBHOST -P $DBPORT -u $DBUSER $DBPASSOPT -e "CREATE DATABASE IF NOT EXISTS $DBNAME;" 2>/dev/null
|
|
mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT <<EOF
|
|
DROP TABLE IF EXISTS pushrebaserecording;
|
|
$(cat $TESTDIR/pushrebase_replay_schema.sql)
|
|
EOF
|
|
}
|