Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions dev/merge_arrow_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,10 @@ def extract_co_authors(commit):
commit_title = f'{self.title} (#{self.number})'
commit_message_chunks = []
if self.body is not None:
# Remove comments (i.e. <-- comment -->) from the pull request description.
body = re.sub(r"<!--(.|\s)*-->", "", self.body)
# Remove comments (i.e. <-- comment -->) from the PR description.
body = re.sub(r"<!--.*?-->", "", self.body, flags=re.DOTALL)
# avoid github user name references by inserting a space after @
body = re.sub(r"@(\w+)", "@ \\1", self.body)
body = re.sub(r"@(\w+)", "@ \\1", body)
commit_message_chunks.append(body)

committer_name = run_cmd("git config --get user.name").strip()
Expand All @@ -596,9 +596,16 @@ def extract_co_authors(commit):

commit_message = "\n\n".join(commit_message_chunks)

# Normalize line ends and collapse extraneous newlines. We allow two
# consecutive newlines for paragraph breaks but not more.
commit_message = "\n".join(commit_message.splitlines())
commit_message = re.sub("\n{2,}", "\n\n", commit_message)

if DEBUG:
print("*** Commit title ***")
print(commit_title)
print()
print("*** Commit message ***")
print(commit_message)

if DEBUG:
Expand Down