in bugbot/rules/bisection_without_regressed_by.py [0:0]
def set_autofix(self, bugs):
ni_template = self.get_needinfo_template()
docs = self.get_documentation()
for bug_id, bug in bugs.items():
comment_number = bug["comment_number"]
pushlog_source = bug["pushlog_source"]
if "regressor_bug_id" in bug:
autofix = {
"comment": {
"body": f"Setting `Regressed by` field after analyzing regression range found by {pushlog_source} in comment #{comment_number}."
},
"regressed_by": {"add": [bug["regressor_bug_id"]]},
}
elif "needinfo_targets" in bug:
nicknames = [":" + user["nickname"] for user in bug["needinfo_targets"]]
ni_comment = ni_template.render(
nicknames=utils.english_list(nicknames),
authors_count=len(nicknames),
is_assignee=not utils.is_no_assignee(bug["assigned_to"]),
is_open=bug["is_open"],
comment_number=comment_number,
pushlog_source=pushlog_source,
plural=utils.plural,
documentation=docs,
)
ni_flags = [
{
"name": "needinfo",
"requestee": user["mail"],
"status": "?",
"new": "true",
}
for user in bug["needinfo_targets"]
]
autofix = {
"flags": ni_flags,
"comment": {"body": ni_comment},
}
else:
raise Exception(
"The bug should either has a regressor or a needinfo target"
)
autofix.update(
{
"keywords": {"add": ["regression"]},
}
)
self.autofix_regressed_by[bug_id] = autofix