Only initialize remote artifact cache connections if needed
This fixes a regression from the canonical-pull-urls branch that was just merged. The OSTreeCache.__init__() function was connecting to the cache, which is bad because execution would randomly freeze for several seconds when the connection was slow.
We now only initialize remote connections where needed; this was
already introduced in 5c2ef6d0 but
had regressed. I renamed the keyword arg from fetch_remote_refs
to use_remote_cache because it needs to be set for any interaction
with the remote cache, doesn't matter if they are fetches or pushes.
The initialization stage is moved later, so that we print a message telling the user what we are up to before trying the network access.
Edited by Sam Thursfield