summaryrefslogtreecommitdiffstats
path: root/tools/repopick.py
diff options
context:
space:
mode:
authorChirayu Desai <chirayudesai1@gmail.com>2015-01-23 23:53:48 +0530
committerAdnan Begovic <adnan@cyngn.com>2015-10-06 18:15:27 -0700
commitdc077549ec19516662fa6ab68b7aada113ba04ee (patch)
tree97f562a22c2bcb67a08386cb293834616cff746b /tools/repopick.py
parentf533c2c871ab0715464cdc1986bf0f35757c27ec (diff)
downloadbuild-dc077549ec19516662fa6ab68b7aada113ba04ee.zip
build-dc077549ec19516662fa6ab68b7aada113ba04ee.tar.gz
build-dc077549ec19516662fa6ab68b7aada113ba04ee.tar.bz2
repopick: Allow the github fetch to fail
* This is optional and done to save gerrit server bandwidth, however it may fail in cases where the 'github' remote is a mirror which doesn't sync the changes. * Let it try fetching from gerrit if fetching from github fails. Change-Id: I6d183ff83572d817d78633280d8b20e3efdaf8f0
Diffstat (limited to 'tools/repopick.py')
-rwxr-xr-xtools/repopick.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/repopick.py b/tools/repopick.py
index b965b4c..679fae4 100755
--- a/tools/repopick.py
+++ b/tools/repopick.py
@@ -108,10 +108,10 @@ def which(program):
return None
# Simple wrapper for os.system() that:
-# - exits on error
+# - exits on error if !can_fail
# - prints out the command if --verbose
# - suppresses all output if --quiet
-def execute_cmd(cmd):
+def execute_cmd(cmd, can_fail=False):
if args.verbose:
print('Executing: %s' % cmd)
if args.quiet:
@@ -120,7 +120,8 @@ def execute_cmd(cmd):
if os.system(cmd):
if not args.verbose:
print('\nCommand that failed:\n%s' % cmd)
- sys.exit(1)
+ if not can_fail:
+ sys.exit(1)
# Verifies whether pathA is a subdirectory (or the same) as pathB
def is_pathA_subdir_of_pathB(pathA, pathB):
@@ -392,7 +393,7 @@ for changeps in args.change_number:
cmd = 'cd %s && git pull --no-edit github %s' % (project_path, fetch_ref)
else:
cmd = 'cd %s && git fetch github %s' % (project_path, fetch_ref)
- execute_cmd(cmd)
+ execute_cmd(cmd, True)
# Check if it worked
FETCH_HEAD = '%s/.git/FETCH_HEAD' % project_path
if os.stat(FETCH_HEAD).st_size == 0: