tl;dr facebook used svn, then had 3 git repositories (server, ios, android) and now moves to a single mercurial repository.
They've made changes to mercurial to be able to do 'sparse checkouts' (only the files you need) and to only use a 'shallow history' (transparent on demand history fetching).
They've made changes to mercurial to be able to do 'sparse checkouts' (only the files you need) and to only use a 'shallow history' (transparent on demand history fetching).