mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
d5338b2208
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
25 lines
808 B
Plaintext
25 lines
808 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
|