mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
320fc31e4c
Summary: They help making tests easier to write. Reviewed By: phillco Differential Revision: D7121645 fbshipit-source-id: 9c7181d45c4e28155eb68f355cf1c4cfc077d191
50 lines
1.1 KiB
Bash
50 lines
1.1 KiB
Bash
# This file will be sourced by all .t tests. Put general purposed functions
|
|
# here.
|
|
|
|
_repocount=0
|
|
|
|
# Create a new repo
|
|
newrepo() {
|
|
reponame="$1"
|
|
if [ -z "$reponame" ]; then
|
|
_repocount=$((_repocount+1))
|
|
reponame=repo$_repocount
|
|
fi
|
|
mkdir "$TESTTMP/$reponame"
|
|
cd "$TESTTMP/$reponame"
|
|
hg init
|
|
}
|
|
|
|
# Enable extensions or features
|
|
enable() {
|
|
for name in "$@"; do
|
|
if [ "$name" = obsstore ]; then
|
|
cat >> $HGRCPATH << EOF
|
|
[experimental]
|
|
evolution = createmarkers, allowunstable
|
|
EOF
|
|
else
|
|
cat >> $HGRCPATH << EOF
|
|
[extensions]
|
|
$name=
|
|
EOF
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Like "hg debugdrawdag", but do not leave local tags in the repo and define
|
|
# nodes as environment variables.
|
|
# This is useful if the test wants to hide those commits because tags would
|
|
# make commits visible. The function will set environment variables so
|
|
# commits can still be referred as $TAGNAME.
|
|
drawdag() {
|
|
hg debugdrawdag "$@"
|
|
eval `hg tags -T '{tag}={node}\n'`
|
|
rm -f .hg/localtags
|
|
}
|
|
|
|
# Set config items like --config way, instead of using cat >> $HGRCPATH
|
|
setconfig() {
|
|
python "$RUNTESTDIR/setconfig.py" "$@"
|
|
}
|