sarutak commented on code in PR #59708:
URL: https://github.com/apache/spark/pull/59708#discussion_r4353465817
##########
dev/merge_spark_pr.py:
##########
@@ -2156,6 +2175,92 @@ def __str__(self) -> str:
return parts + (" " if parts else "") + self.text
+def _unwrap_title(title: str) -> str:
+ """Strip a ``Revert "..."`` / ``Reapply "..."`` wrapper from a PR title.
+
+ ``main()`` keeps Revert and Reapply PR titles verbatim, so the JIRA id,
+ leading markers, and components all live inside the quotes. Unwrapping
here
+ lets the id-extraction and skip-tag logic see them. A title without such a
+ wrapper is returned unchanged.
+
+ >>> _unwrap_title('Revert "[SPARK-1234][SQL] Fix"')
+ '[SPARK-1234][SQL] Fix'
+ >>> _unwrap_title('Reapply "[SPARK-1234][SQL] Fix"')
+ '[SPARK-1234][SQL] Fix'
+ >>> _unwrap_title('[SPARK-1234][SQL] Fix')
+ '[SPARK-1234][SQL] Fix'
+ """
+ for prefix in ('Revert "', 'Reapply "'):
+ if title.startswith(prefix) and title.endswith('"'):
Review Comment:
Good catch, thanks. Fixed in 4c1108615c1: `_unwrap_title` now strips
wrappers in a loop until none remains, so a revert-of-revert such as `Revert
"Revert "[SPARK-1234][SQL] Fix""` (and mixed `Revert`/`Reapply` nesting)
reduces to the innermost title and the inner id is found again. Added doctests
for the nested, mixed, and only-wrapper cases on
`_unwrap_title`/`leading_jira_ids`, plus nested skip-tag and nested-id
revert-path cases in the `update_jira_for_revert` doctest.
One scoping note: a nested wrapper can also flip the net direction (`Revert
"Revert "X""` is a re-land, but `main()` still classifies it as a revert via
`is_revert_pr`), so `update_jira_for_pr` would take the revert path rather than
resolving. That is a pre-existing bug in the `is_revert_pr`/`is_reapply_pr`
classification in `main()`, separate from id extraction and outside this PR's
scope. I'll file a follow-up JIRA to decide direction by wrapper parity. This
PR keeps its scope to extracting the correct JIRA id.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]