Introduce concept of permanent failure

Currently, when a fetch command fails due to a transport exception it is
always retried (up to maxRetries times).

Whilst there are some cases in which this is the correct thing to do
(transient failures due to network, for example), some errors are
persistent by nature and retrying will lead to another failure.

This is the case, for example, when a fetch fails due to the refs
missing from the remote.

Introduce the concept of permanent failure for which no retries should
be attempted.

Permanent failures currently are:
- SSH exception due to an UnknownHostKey
- The ref being fetched does not exist on the remote

Bug: Issue 16743
Change-Id: I88bdb75e84ea99b1c600d282872304acd3a15466
8 files changed