spark-test commented on code in PR #59708:
URL: https://github.com/apache/spark/pull/59708#discussion_r4372824565


##########
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:
   Thanks, confirmed at 3b0e10e: `_unwrap_title` now strips every `Revert 
"..."`/`Reapply "..."` layer, so `leading_jira_ids('Revert "Revert 
"[SPARK-1234][SQL] Fix""')` returns `['SPARK-1234']` again. The `_unwrap_title` 
doctests cover the nested and mixed cases, and the `update_jira_for_revert` 
doctest checks that a nested id reaches the revert path. Agreed that deciding 
revert vs. re-land by wrapper nesting belongs in the follow-up you mentioned.
   
   <!-- SPARK_DEV_REVIEW_REPLY 
{"feedback_id":"inline:4352860356","thread_id":"inline:4352860356","verdict_sha256":"32592fcbb473dfabe9d1748a56ce87b90c93808408ef349359525c2b8783cef0"}
 -->



-- 
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]

Reply via email to