Let git cl presubmit work with no network
Bug: 1309977
Change-Id: Ifca6e60c1fb2ff76f6a8dee9129d4d661ba196a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3606733
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
diff --git a/presubmit_support.py b/presubmit_support.py
index 7e4d7b2..3e963ec 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -665,12 +665,15 @@
self.owners_client = None
if self.gerrit:
- self.owners_client = owners_client.GetCodeOwnersClient(
- root=change.RepositoryRoot(),
- upstream=change.UpstreamBranch(),
- host=self.gerrit.host,
- project=self.gerrit.project,
- branch=self.gerrit.branch)
+ try:
+ self.owners_client = owners_client.GetCodeOwnersClient(
+ root=change.RepositoryRoot(),
+ upstream=change.UpstreamBranch(),
+ host=self.gerrit.host,
+ project=self.gerrit.project,
+ branch=self.gerrit.branch)
+ except Exception as e:
+ print('Failed to set owners_client - %s' % str(e))
self.owners_db = owners_db.Database(
change.RepositoryRoot(), fopen=open, os_path=self.os_path)
self.owners_finder = owners_finder.OwnersFinder