[git-cl] Handle non-HTTPS repositories gracefully in EnsureAuthenticated

There are some Google-internal repos that use a custom scheme. Having
any remotes pointing to these URLs breaks git cl archive.

Change-Id: Ibd686c5cd11e090f0821ff2b412540138252dfce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1614946
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 8c58f14..f7f84d8 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2010,6 +2010,11 @@
     if not isinstance(cookie_auth, gerrit_util.CookiesAuthenticator):
       return
 
+    if urlparse.urlparse(self.GetRemoteUrl()).scheme != 'https':
+      print('WARNING: Ignoring branch %s with non-https remote %s' %
+            (self._changelist.branch, self.GetRemoteUrl()))
+      return
+
     # Lazy-loader to identify Gerrit and Git hosts.
     self.GetCodereviewServer()
     git_host = self._GetGitHost()
@@ -2530,7 +2535,7 @@
       ])
       traces_to_delete = traces[:-MAX_TRACES]
       for trace in traces_to_delete:
-          os.remove(trace)
+        os.remove(trace)
     except OSError:
       print('WARNING: Failed to remove old git traces from\n'
             '  %s'