Retry on transient failures in git.RunGit.

I've updated git.RunGit to retry on all transient failures, and updated
our list of transient failures with all of the errors we've seen so far.

I've also converted all users of git to use git.RunGit. Since we only
retry on transient failures, it is safe for everyone to use git.RunGit
with retries enabled. If, for some reason, the retries are a problem,
they can be disabled with retry=False.

BUG=chromium:285832, chromium:289932, chromium:294449
TEST=all unit tests
TEST=mario-paladin alex-paladin x86-mario-release --buildbot --debug
TEST=chromiumos-sdk pre-cq-group pre-cq-launcher

Change-Id: I5aa8b3fe0f6f9be2dbd6288f808f9d0c3d64746f
Reviewed-on: https://chromium-review.googlesource.com/170241
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/scripts/cros_mark_as_stable_unittest.py b/scripts/cros_mark_as_stable_unittest.py
index fae03dd..7251898 100755
--- a/scripts/cros_mark_as_stable_unittest.py
+++ b/scripts/cros_mark_as_stable_unittest.py
@@ -49,10 +49,9 @@
     cros_mark_as_stable._DoWeHaveLocalCommits(
         self._branch, 'refs/remotes/gerrit/master', '.').AndReturn(True)
     result = cros_build_lib.CommandResult(output=git_log)
-    cros_build_lib.RunCommandCaptureOutput(
-        ['git', 'log', '--format=format:%s%n%n%b',
-         'refs/remotes/gerrit/master..%s' % self._branch],
-        cwd='.').AndReturn(result)
+    cmd = ['log', '--format=format:%s%n%n%b',
+           'refs/remotes/gerrit/master..%s' % self._branch]
+    git.RunGit('.', cmd).AndReturn(result)
     git.CreatePushBranch('merge_branch', '.')
     git.RunGit('.', ['merge', '--squash', self._branch])
     git.RunGit('.', ['commit', '-m', fake_description])
@@ -124,8 +123,7 @@
                                            self._target_manifest_branch, '.')
     # Test if branch exists that is created
     result = cros_build_lib.CommandResult(output=self._branch_name + '\n')
-    cros_build_lib.RunCommandCaptureOutput(['git', 'branch'], print_cmd=False,
-                                           cwd='.').AndReturn(result)
+    git.RunGit('.', ['branch']).AndReturn(result)
     self.mox.ReplayAll()
     self.assertTrue(branch.Exists())
     self.mox.VerifyAll()