sapling/tests/notcapable
Saurabh Singh 51aa41fa78 run-tests: fix the tests when run with '--shell bash' configuration
Summary:
`run-tests.py` has an option to specify the shell for running the
tests. However, when run with the `--shell bash` configuration, several tests
fail with the `testrepohg: command not found` error. I could not find the
specific cause for this but changing the alias to a function resolved this
error. Also, fixed another related error by using double quotes during variable
expansion.

Reviewed By: quark-zju

Differential Revision: D7563731

fbshipit-source-id: 58e1b5b996ccdc20b8375dcd5f4f8e071bd9cdc1
2018-04-13 21:51:50 -07:00

25 lines
812 B
Plaintext

# Disable the $CAP wire protocol capability.
if test -z "$CAP"
then
echo "CAP environment variable not set."
fi
cat > notcapable-"${CAP}".py << EOF
from mercurial import extensions, localrepo, repository
def extsetup():
extensions.wrapfunction(repository.peer, 'capable', wrapcapable)
extensions.wrapfunction(localrepo.localrepository, 'peer', wrappeer)
def wrapcapable(orig, self, name, *args, **kwargs):
if name in '$CAP'.split(' '):
return False
return orig(self, name, *args, **kwargs)
def wrappeer(orig, self):
# Since we're disabling some newer features, we need to make sure local
# repos add in the legacy features again.
return localrepo.locallegacypeer(self)
EOF
echo '[extensions]' >> $HGRCPATH
echo "notcapable-$CAP = `pwd`/notcapable-$CAP.py" >> $HGRCPATH