Skip to content

Commit 7276365

Browse files
committed
Fix tracking fixes mentioned by issue hash
I.e. if issue are mention in fixed PR as `#\d+` script should still look for the cherry pick in the branch Before that change pytorch/pytorch#123234 were missed in release/2.3 branch
1 parent 2a16ed3 commit 7276365

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

analytics/github_analyze.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ def __init__(self,
4545
def __contains__(self, item: Any) -> bool:
4646
return item in self.body or item in self.title
4747

48+
def is_issue_mentioned(self, issue_url: str) -> bool:
49+
if issue_url in self:
50+
return True
51+
if "/pull/" in issue_url:
52+
return False
53+
issue_hash = f"#{issue_url.split('issues/')[1]}"
54+
if "fixes" in self.title.lower() and issue_hash in self.title:
55+
return True
56+
return any("fixes" in line.lower() and issue_hash in line for line in self.body.split("\n"))
57+
4858

4959
def get_revert_revision(commit: GitCommit) -> Optional[str]:
5060
import re
@@ -371,18 +381,18 @@ def get_commits_dict(x, y):
371381
print(f"len(release_commits)={len(release_commits)}")
372382
print("URL;Title;Status")
373383
for issue in gh_get_milestone_issues('pytorch', 'pytorch', milestone_idx, IssueState.ALL):
374-
html_url, state = issue["html_url"], issue["state"]
384+
issue_url, state = issue["html_url"], issue["state"]
375385
# Skip closed states if they were landed before merge date
376386
if state == "closed":
377-
mentioned_after_cut = any(html_url in commit_message for commit_message in main_commits.values())
387+
mentioned_after_cut = any(commit.is_issue_mentioned(issue_url) for commit in main_commits.values())
378388
# If issue is not mentioned after cut, that it must be present in release branch
379389
if not mentioned_after_cut:
380390
continue
381-
mentioned_in_release = any(html_url in commit_message for commit_message in release_commits.values())
391+
mentioned_in_release = any(commit.is_issue_mentioned(issue_url) for commit in release_commits.values())
382392
# if Issue is mentioned is release branch, than it was picked already
383393
if mentioned_in_release:
384394
continue
385-
print(f'{html_url};{issue["title"]};{state}')
395+
print(f'{issue_url};{issue["title"]};{state}')
386396

387397
def commits_missing_in_release(repo: GitRepo, branch: str, orig_branch: str, minor_release: str, milestone_idx: int, cut_off_date : datetime, issue_num : int) -> None:
388398
def get_commits_dict(x, y):

0 commit comments

Comments
 (0)