diff --git a/merge_gitlab_ci.py b/merge_gitlab_ci.py index 35963bbbe0928f8fea643d838bcdb413456f33e9..04af77283d97415b6b0f8718c2ec71a485eb1f1f 100755 --- a/merge_gitlab_ci.py +++ b/merge_gitlab_ci.py @@ -139,9 +139,20 @@ def main(): if branch is None: branch = project.default_branch + print( + "Try to merge {}({}) into {} ({})".format( + args.submodule, args.revision, project.name, branch + ) + ) + mr = find_integration_merge_request( project, args.submodule, args.revision, branch ) + if mr is None: + sys.exit("ERROR: Failed to find the integration MR.") + # TODO if this ever happens, why ever, we could call + # deploy_gitlab_ci again to create a new integration + # commit or make sure the change is already integrated. print("Merge {}!{}: {}".format(project.name, mr.iid, mr.title)) # Wait until GitLab has checked merge status @@ -157,13 +168,24 @@ def main(): ) if not merged: - sys.exit( - "Integration MR could not be merged. You have two possibilities to fix " - "this:\n" - " 1. Checkout the MR and rebase it on the current master manually, or\n" - " 2. Delete the MR (Edit -> Delete in the MR UI)\n" - "In either case restart this job afterwards in order to get it merged." + print( + "Integration MR could not be merged." + "To fix this:\n" + " 1. Checkout the MR {}!{} and merge it manually.\n" + " 2. Manually merge the follow up MRs in the following project:".format( + project.name, mr.iid + ) ) + found = False + for p2 in args.projects + [args.project]: + if p2 == p: + found = True + continue + if not found: + continue + print(" {}".format(p2.name)) + sys.exit() + print("Successfully merged") exit()