#!/bin/sh # This file holds logic that is used in many tests.# It can be called in a test like this:# $ . "$TESTDIR/testutil" # Activate extensionsecho "[extensions]" >> $HGRCPATHecho "hggit=$(echo $(dirname $TESTDIR))/hggit" >> $HGRCPATHecho 'mq=' >> $HGRCPATH # Defaults for testing against hg < 4.3echo '[defaults]' >> $HGRCPATHecho 'backout = -d "0 0"' >> $HGRCPATHecho 'commit = -d "0 0"' >> $HGRCPATHecho 'shelve = --date "0 0"\n' >> $HGRCPATHecho 'tag = -d "0 0"\n' >> $HGRCPATH # Enable git subrepository for hg >= 4.4.1echo '[subrepos]' >> $HGRCPATHecho 'git:allowed = yes' >> $HGRCPATH # Standard checks for external dependencies# We use the git command-line client and dulwich in pretty much all the tests.# Thus, to avoid repetitively declaring that requirement in almost every test,# we just call the checks in all tests that include this library.python -c 'import dulwich' || { echo "skipped: missing feature: dulwich" && exit 80}"$TESTDIR/hghave" git || exit 80 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAMEGIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAILGIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATEGIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAMEGIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAILGIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE # Functions to commit and tag in Mercurial and Git in a predictable mannercount=10 fn_git_commit() { GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" git commit "$@" >/dev/null || echo "git commit error" count=`expr $count + 1`} fn_hg_commit() { HGDATE="2007-01-01 00:00:$count +0000" hg commit -d "$HGDATE" "$@" >/dev/null || echo "hg commit error" count=`expr $count + 1`} fn_hg_commitextra() { HGDATE="2007-01-01 00:00:$count +0000" hg --config extensions.commitextra=$TESTDIR/commitextra.py commitextra \ -d "$HGDATE" "$@" >/dev/null || echo "hg commit error" count=`expr $count + 1`} fn_git_tag() { GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" git tag "$@" >/dev/null || echo "git tag error" count=`expr $count + 1`} fn_hg_tag() { HGDATE="2007-01-01 00:00:$count +0000" hg tag -d "$HGDATE" "$@" >/dev/null || echo "hg tag error" count=`expr $count + 1`}
#!/bin/sh
# This file holds logic that is used in many tests.
# It can be called in a test like this:
# $ . "$TESTDIR/testutil"
# Activate extensions
echo "[extensions]" >> $HGRCPATH
echo "hggit=$(echo $(dirname $TESTDIR))/hggit" >> $HGRCPATH
echo 'mq=' >> $HGRCPATH
# Defaults for testing against hg < 4.3
echo '[defaults]' >> $HGRCPATH
echo 'backout = -d "0 0"' >> $HGRCPATH
echo 'commit = -d "0 0"' >> $HGRCPATH
echo 'shelve = --date "0 0"\n' >> $HGRCPATH
echo 'tag = -d "0 0"\n' >> $HGRCPATH
# Enable git subrepository for hg >= 4.4.1
echo '[subrepos]' >> $HGRCPATH
echo 'git:allowed = yes' >> $HGRCPATH
# Standard checks for external dependencies
# We use the git command-line client and dulwich in pretty much all the tests.
# Thus, to avoid repetitively declaring that requirement in almost every test,
# we just call the checks in all tests that include this library.
python -c 'import dulwich' || {
echo "skipped: missing feature: dulwich" && exit 80
}
"$TESTDIR/hghave" git || exit 80
GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
# Functions to commit and tag in Mercurial and Git in a predictable manner
count=10
fn_git_commit() {
GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
git commit "$@" >/dev/null || echo "git commit error"
count=`expr $count + 1`
}
fn_hg_commit() {
HGDATE="2007-01-01 00:00:$count +0000"
hg commit -d "$HGDATE" "$@" >/dev/null || echo "hg commit error"
count=`expr $count + 1`
}
fn_hg_commitextra() {
HGDATE="2007-01-01 00:00:$count +0000"
hg --config extensions.commitextra=$TESTDIR/commitextra.py commitextra \
-d "$HGDATE" "$@" >/dev/null || echo "hg commit error"
count=`expr $count + 1`
}
fn_git_tag() {
GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
git tag "$@" >/dev/null || echo "git tag error"
count=`expr $count + 1`
}
fn_hg_tag() {
HGDATE="2007-01-01 00:00:$count +0000"
hg tag -d "$HGDATE" "$@" >/dev/null || echo "hg tag error"
count=`expr $count + 1`
}