catfile: Convert to use localrepo structure
This commit series converts the catfile interface to use the localrepo structure. There were quite some interdependencies, so I had to convert other callers first to not end up with a weird state where we need to pass around both the localrepo and its protobuf.