repopick: Actually try to fetch from Gerrit if fetching from GitHub fails
* Exit on failure only if fetching didn't fail.
Change-Id: Iae75dfcff590ed72afd93f58772440e4f3b0ca27
diff --git a/tools/repopick.py b/tools/repopick.py
index ac8875a..1e70655 100755
--- a/tools/repopick.py
+++ b/tools/repopick.py
@@ -315,10 +315,10 @@
else:
print(cmd)
result = subprocess.call([' '.join(cmd)], cwd=project_path, shell=True)
- if result != 0:
+ FETCH_HEAD = '{0}/.git/FETCH_HEAD'.format(project_path)
+ if result != 0 and os.stat(FETCH_HEAD).st_size != 0:
print('ERROR: git command failed')
sys.exit(result)
- FETCH_HEAD = '{0}/.git/FETCH_HEAD'.format(project_path)
# Check if it worked
if args.gerrit != default_gerrit or os.stat(FETCH_HEAD).st_size == 0:
# If not using the default gerrit or github failed, fetch from gerrit.