bisect-kit: fix git fetch retry in python3

python3 changed the scope of exception variable and bare-raise no longer
works.

BUG=None
TEST=./setup_cros_bisect.py sync

Change-Id: I5e894c9d68adfb64bbf648f9cb358e116df332bf
diff --git a/bisect_kit/git_util.py b/bisect_kit/git_util.py
index 413dedd..b783145 100644
--- a/bisect_kit/git_util.py
+++ b/bisect_kit/git_util.py
@@ -151,12 +151,9 @@
     git_repo: path of git repo.
     args: parameters pass to 'git fetch'
   """
-  for tries in range(5):
-    if tries > 0:
-      delay = min(60, 10 * 2**tries)
-      logger.warning('git fetch failed, will retry %s seconds later', delay)
-      time.sleep(delay)
-
+  tries = 0
+  while True:
+    tries += 1
     stderr_lines = []
     try:
       util.check_call(
@@ -165,19 +162,19 @@
           *args,
           cwd=git_repo,
           stderr_callback=stderr_lines.append)
-      break
+      return
     except subprocess.CalledProcessError:
+      if tries >= 5:
+        logger.error('git fetch failed too much times')
+        raise
       stderr = ''.join(stderr_lines)
       # only retry 5xx internal server error
-      if 'The requested URL returned error: 5' not in stderr:
-        raise
-  else:
-    # Reached retry limit but haven't succeeded.
-    # In other words, there must be exceptions raised inside above loop.
-    logger.error('git fetch failed too much times')
-    # It's okay to raise because we are in the same scope as above loop.
-    # pylint: disable=misplaced-bare-raise
-    raise
+      if 'The requested URL returned error: 5' in stderr:
+        delay = min(60, 10 * 2**tries)
+        logger.warning('git fetch failed, will retry %s seconds later', delay)
+        time.sleep(delay)
+        continue
+      raise
 
 
 def is_containing_commit(git_repo, rev):