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>
This commit is contained in:
Aaron Gable
2017-04-26 16:28:08 -07:00
committed by Commit Bot
parent 6fee2673e9
commit b584c4f0d1
4 changed files with 119 additions and 88 deletions

View File

@@ -127,6 +127,17 @@ def add_footer(message, key, value, after_keys=None, before_keys=None):
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]