tests/notcapable
author Siddharth Agarwal <sid0@fb.com>
Wed, 16 Jul 2014 14:53:03 -0700
changeset 21895 5809d62e7106
parent 17192 1ac628cd7113
child 33806 dedab036215d
permissions -rw-r--r--
context: extend efficient manifest filtering to when all paths are files On a repository with over 250,000 files and 700,000 commits, this improves cases like hg status --rev <rev> -- <file> # rev is not . from 2.1 seconds to 1.4 seconds. There is further scope for improvement here: for a single file or a small set of files, it is probably more efficient to use filelog linkrevs when possible. However there will always be cases where that will fail (multiple commits pointing to the same file revision, removed files...), so this is independently useful.

# 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, peer, localrepo
def extsetup():
    extensions.wrapfunction(peer.peerrepository, '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