ci_run_n_monitor: warn user if they forgot to push the branch
Only perform this check if they set `--rev HEAD` (or don't specify it); let's assume if they select another commit, they know what they're doing. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26969>
This commit is contained in:

committed by
Marge Bot

parent
6d8461f545
commit
044c51b6bf
@@ -407,6 +407,28 @@ if __name__ == "__main__":
|
||||
REV = mesa_project.mergerequests.get(args.mr).sha
|
||||
else:
|
||||
REV = check_output(['git', 'rev-parse', REV]).decode('ascii').strip()
|
||||
|
||||
if args.rev == 'HEAD':
|
||||
branch_name = check_output([
|
||||
'git', 'symbolic-ref', '-q', 'HEAD',
|
||||
]).decode('ascii').strip()
|
||||
|
||||
tracked_remote = check_output([
|
||||
'git', 'for-each-ref', '--format=%(upstream)',
|
||||
branch_name,
|
||||
]).decode('ascii').strip()
|
||||
|
||||
remote_rev = check_output([
|
||||
'git', 'rev-parse', tracked_remote,
|
||||
]).decode('ascii').strip()
|
||||
|
||||
if REV != remote_rev:
|
||||
print(
|
||||
f"Local HEAD commit {REV[:10]} is different than "
|
||||
f"tracked remote HEAD commit {remote_rev[:10]}"
|
||||
)
|
||||
print("Did you forget to `git push` ?")
|
||||
|
||||
projects.append(get_gitlab_project(gl, args.project))
|
||||
(pipe, cur_project) = wait_for_pipeline(projects, REV)
|
||||
|
||||
|
Reference in New Issue
Block a user