Mark CLs as Verified-1 if they have errors.
We currently upload CLs that can be broken. This is potentially fine,
as it's a signal to the reviewer that an upgrade needs work. But we
should mark them as failing in some way to give the reviewer that
hint. This CL does that by setting Verified-1.
We currently only implement it for Rust crates. Rather than modifying
the existing mechanisms to detect various errors (which seems
difficult e.g., in the case of patches) we do checks for errors after
the fact. We currently check for .rej files (meaning failed patches)
and errors in Android.bp. These checks are both heuristics and so
could fail (in either way).
Test: Created aosp/1665704, aosp/1667706, aosp/1667707
Change-Id: I7e148d4d0cc5c1f2434cfdb98a969e7969a3893a
diff --git a/git_utils.py b/git_utils.py
index 541e860..1825c37 100644
--- a/git_utils.py
+++ b/git_utils.py
@@ -161,11 +161,13 @@
_run(['git', 'checkout', branch_name], cwd=proj_path)
-def push(proj_path: Path, remote_name: str) -> None:
+def push(proj_path: Path, remote_name: str, has_errors: bool) -> None:
"""Pushes change to remote."""
cmd = ['git', 'push', remote_name, 'HEAD:refs/for/master']
if revs := reviewers.find_reviewers(str(proj_path)):
cmd.extend(['-o', revs])
if tag := hashtags.find_hashtag(proj_path):
cmd.extend(['-o', 't=' + tag])
+ if has_errors:
+ cmd.extend(['-o', 'l=Verified-1'])
_run(cmd, cwd=proj_path)