repopick: Check fetch result based on the actual commit
Checking for FETCH_HEAD is not reliable when fetching in parallel. Change-Id: I0c07f7c4bffb80e5d12b13f301ba684b95112272
This commit is contained in:
committed by
Bruno Martins
parent
8a3a02e0b5
commit
ce64349c54
@@ -641,28 +641,27 @@ def do_git_fetch_pull(args, item):
|
|||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
print(cmd)
|
print(cmd)
|
||||||
result = subprocess.call(cmd, cwd=project_path)
|
result = subprocess.call(cmd, cwd=project_path)
|
||||||
FETCH_HEAD = "{0}/.git/FETCH_HEAD".format(project_path)
|
# Check if it worked
|
||||||
if result != 0 and os.stat(FETCH_HEAD).st_size != 0:
|
if result == 0 or commit_exists(project_path, item["revision"]):
|
||||||
print("ERROR: git command failed")
|
return
|
||||||
sys.exit(result)
|
print("ERROR: git command failed")
|
||||||
# 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.
|
|
||||||
if args.verbose:
|
|
||||||
if args.gerrit == DEFAULT_GERRIT:
|
|
||||||
print(
|
|
||||||
"Fetching from GitHub didn't work, trying to fetch the change from Gerrit"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
print("Fetching from {0}".format(args.gerrit))
|
|
||||||
|
|
||||||
cmd[-2] = item["fetch"][method]["url"]
|
# If not using the default gerrit or github failed, fetch from gerrit.
|
||||||
if not args.quiet:
|
if args.verbose:
|
||||||
print(cmd)
|
if args.gerrit == DEFAULT_GERRIT:
|
||||||
result = subprocess.call(cmd, cwd=project_path)
|
print(
|
||||||
if result != 0:
|
"Fetching from GitHub didn't work, trying to fetch the change from Gerrit"
|
||||||
print("ERROR: git command failed")
|
)
|
||||||
sys.exit(result)
|
else:
|
||||||
|
print("Fetching from {0}".format(args.gerrit))
|
||||||
|
|
||||||
|
cmd[-2] = item["fetch"][method]["url"]
|
||||||
|
if not args.quiet:
|
||||||
|
print(cmd)
|
||||||
|
result = subprocess.call(cmd, cwd=project_path)
|
||||||
|
if result != 0 and not commit_exists(project_path, item["revision"]):
|
||||||
|
print("ERROR: git command failed")
|
||||||
|
sys.exit(result)
|
||||||
|
|
||||||
|
|
||||||
def apply_change(args, item):
|
def apply_change(args, item):
|
||||||
|
Reference in New Issue
Block a user