in bugbot/rules/not_landed.py [0:0]
def check_phab(self, attachment, reviewers_phid):
"""Check if the patch in Phabricator has been r+"""
if attachment["is_obsolete"] == 1:
return None
phab_url = base64.b64decode(attachment["data"]).decode("utf-8")
# extract the revision
rev = PHAB_URL_PAT.search(phab_url).group(1)
try:
data = self.phab.load_revision(
rev_id=int(rev), queryKey="all", attachments={"reviewers": 1}
)
except PhabricatorRevisionNotFoundException:
return None
# this is a timestamp
last_modified = data["fields"]["dateModified"]
last_modified = lmdutils.get_date_from_timestamp(last_modified)
if (self.date - last_modified).days <= self.nweeks * 7:
# Do not do anything if recent changes in the bug
return False
reviewers = data["attachments"]["reviewers"]["reviewers"]
if not reviewers:
return False
for reviewer in reviewers:
if reviewer["status"] != "accepted":
return False
reviewers_phid.add(reviewer["reviewerPHID"])
value = data["fields"]["status"].get("value", "")
if value == "changes-planned":
# even if the patch is r+ and not published, some changes may be required
# so with the value 'changes-planned', the dev can say it's still a wip
return False
if value != "published":
return True
return False