in bot/code_review_bot/workflow.py [0:0]
def find_previous_issues(self, issues, base_rev_changeset=None):
"""
Look for known issues in the backend matching the given list of issues
If a base revision ID is provided, compare to issues detected on this revision
Otherwise, compare to issues detected on last ingested revision
"""
assert (
self.backend_api.enabled
), "Backend storage is disabled, comparing issues is not possible"
current_date = datetime.now().strftime("%Y-%m-%d")
# Group issues by path, so we only list know issues for the affected files
issues_groups = groupby(
sorted(issues, key=lambda i: i.path),
lambda i: i.path,
)
logger.info(
"Checking for existing issues in the backend",
base_revision_changeset=base_rev_changeset,
)
for path, group_issues in issues_groups:
known_issues = self.backend_api.list_repo_issues(
"mozilla-central",
date=current_date,
revision_changeset=base_rev_changeset,
path=path,
)
hashes = [issue["hash"] for issue in known_issues]
for issue in group_issues:
issue.new_issue = bool(issue.hash and issue.hash not in hashes)