tests/notcapable
author Augie Fackler <augie@google.com>
Thu, 01 Feb 2018 16:01:43 -0500
changeset 35878 6e7fae8f1c6c
parent 33806 dedab036215d
child 41068 28a4fb793ba1
permissions -rw-r--r--
contrib: fix dirstatenonnormalcheck to work in Python 3 This is a redo of D1963 that has the added benefit of not breaking Python 2. Oops. # skip-blame because this is bytes prefixes and a s/iteritems/items/ Differential Revision: https://phab.mercurial-scm.org/D1970

# 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