tests/notcapable
author Gregory Szorc <gregory.szorc@gmail.com>
Thu, 10 Aug 2017 20:58:28 -0700
changeset 33806 dedab036215d
parent 17192 1ac628cd7113
child 41068 28a4fb793ba1
permissions -rw-r--r--
wireproto: use new peer interface The wirepeer class provides concrete implementations of peer interface methods for calling wire protocol commands. It makes sense for this class to inherit from the peer abstract base class. So we change that. Since httppeer and sshpeer have already been converted to the new interface, peerrepository is no longer adding any value. So it has been removed. httppeer and sshpeer have been updated to reflect the loss of peerrepository and the inheritance of the abstract base class in wirepeer. The code changes in wirepeer are reordering of methods to group by interface. Some Python code in tests was updated to reflect changed APIs. .. api:: peer.peerrepository has been removed. Use repository.peer abstract base class to represent a peer repository. Differential Revision: https://phab.mercurial-scm.org/D338

# 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