view tests/notcapable @ 40249:c9e8c93e241c

tests: accept slightly different zip file in Python 3 I added some `unzip -t` here and I *think* the only change is from Python 3 having more data in the zip file headers or something. Sigh. Differential Revision: https://phab.mercurial-scm.org/D5075
author Augie Fackler <augie@google.com>
date Sat, 13 Oct 2018 07:55:34 -0400
parents dedab036215d
children 28a4fb793ba1
line wrap: on
line source

# 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