Represents one dependency change entry. Fields: - pr_num: string PR number (e.g., '3605') - message: cleaned commit message text to be shown in CHANGES (noise removed) - author: Git author (e.g., 'solrbot')
| 33 | |
| 34 | |
| 35 | class ChangeEntry: |
| 36 | """ |
| 37 | Represents one dependency change entry. |
| 38 | Fields: |
| 39 | - pr_num: string PR number (e.g., '3605') |
| 40 | - message: cleaned commit message text to be shown in CHANGES (noise removed) |
| 41 | - author: Git author (e.g., 'solrbot') |
| 42 | """ |
| 43 | |
| 44 | def __init__(self, pr_num: str, message: str, author: str): |
| 45 | self.pr_num = pr_num |
| 46 | self.message = message |
| 47 | self.author = author |
| 48 | |
| 49 | def dep_key(self) -> str: |
| 50 | """ |
| 51 | Extract a dependency key from the message after 'Update ' and before ' to', '(' or end. |
| 52 | This is used for de-duplication and sorting. Case-insensitive. |
| 53 | """ |
| 54 | m = re.search(r"(?i)update\s+(.+?)(?:\s+to\b|\s*\(|$)", self.message) |
| 55 | if m: |
| 56 | return m.group(1).strip() |
| 57 | return self.message.strip() |
| 58 | |
| 59 | def __str__(self) -> str: |
| 60 | # Keep trailing newline to preserve existing blank-line formatting by update_changes |
| 61 | return f"* PR#{self.pr_num}: {self.message} ({self.author})\n" |
| 62 | |
| 63 | def to_yaml_dict(self) -> dict: |
| 64 | """ |
| 65 | Convert to a dictionary suitable for YAML serialization. |
| 66 | Extracts JIRA IDs from the title and adds them to links. |
| 67 | """ |
| 68 | # Extract JIRA IDs from the message |
| 69 | title, jira_links = extract_jira_issues_from_title(self.message) |
| 70 | |
| 71 | # Build links: JIRA issues first, then PR |
| 72 | links = jira_links.copy() # Start with JIRA links |
| 73 | links.append({ |
| 74 | 'name': f'PR#{self.pr_num}', |
| 75 | 'url': f'https://github.com/apache/solr/pull/{self.pr_num}' |
| 76 | }) |
| 77 | |
| 78 | return { |
| 79 | 'title': title, |
| 80 | 'type': 'dependency_update', |
| 81 | 'authors': [ |
| 82 | { |
| 83 | 'name': self.author |
| 84 | } |
| 85 | ], |
| 86 | 'links': links |
| 87 | } |
| 88 | |
| 89 | def yaml_filename(self) -> str: |
| 90 | """ |
| 91 | Generate a filesystem-safe filename for this entry. |
| 92 | Format: PR#####-slug.yaml |
no outgoing calls
no test coverage detected
searching dependent graphs…