Make CQ_INCLUDE_TRYBOTS support review-specific
This CL wholly revamps the way presubmit_support adds
CQ_INCLUDE_TRYBOTS lines in commit descriptions. In
particular, when the CL is being uploaded to Gerrit,
it uses our pre-existing support for manipulating git
footers to make the whole process much simpler.
R=tandrii@chromium.org
Bug: 710547
Change-Id: I5858282a44c590f131021fa3820f1cb3f70ef620
Reviewed-on: https://chromium-review.googlesource.com/487831
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/git_footers.py b/git_footers.py
index fd77c9d..8e9aaff 100755
--- a/git_footers.py
+++ b/git_footers.py
@@ -127,6 +127,17 @@
return '\n'.join(top_lines + footer_lines)
+def remove_footer(message, key):
+ """Returns a message with all instances of given footer removed."""
+ key = normalize_name(key)
+ top_lines, footer_lines, _ = split_footers(message)
+ if not footer_lines:
+ return message
+ new_footer_lines = [
+ l for l in footer_lines if normalize_name(parse_footer(l)[0]) != key]
+ return '\n'.join(top_lines + new_footer_lines)
+
+
def get_unique(footers, key):
key = normalize_name(key)
values = footers[key]