Skip to content

Commit 94ccf86

Browse files
pwendellrxin
authored andcommitted
Merge pull request apache#569 from pwendell/merge-fixes.
Fixes bug where merges won't close associated pull request. Previously we added "Closes #XX" in the title. Github will sometimes linbreak the title in a way that causes this to not work. This patch instead adds the line in the body. This also makes the commit format more concise for merge commits. We might consider just dropping those in the future. Author: Patrick Wendell <[email protected]> Closes apache#569 and squashes the following commits: 732eba1 [Patrick Wendell] Fixes bug where merges won't close associated pull request.
1 parent b69f8b2 commit 94ccf86

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

dev/merge_spark_pr.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,20 @@ def merge_pr(pr_num, target_ref):
9393
'--pretty=format:%an <%ae>']).split("\n")
9494
distinct_authors = sorted(set(commit_authors), key=lambda x: commit_authors.count(x), reverse=True)
9595
primary_author = distinct_authors[0]
96-
commits = run_cmd(['git', 'log', 'HEAD..%s' % pr_branch_name]).split("\n\n")
96+
commits = run_cmd(['git', 'log', 'HEAD..%s' % pr_branch_name,
97+
'--pretty=format:%h [%an] %s']).split("\n\n")
9798

98-
merge_message = "Merge pull request #%s from %s. Closes #%s.\n\n%s\n\n%s" % (
99-
pr_num, pr_repo_desc, pr_num, title, body)
99+
merge_message = "Merge pull request #%s from %s.\n\n%s\n\n%s" % (
100+
pr_num, pr_repo_desc, title, body)
100101
merge_message_parts = merge_message.split("\n\n")
101102
merge_message_flags = []
102103

103104
for p in merge_message_parts:
104105
merge_message_flags = merge_message_flags + ["-m", p]
105106
authors = "\n".join(["Author: %s" % a for a in distinct_authors])
106107
merge_message_flags = merge_message_flags + ["-m", authors]
107-
merge_message_flags = merge_message_flags + ["-m", "== Merge branch commits =="]
108+
merge_message_flags = merge_message_flags + [
109+
"-m", "Closes #%s and squashes the following commits:" % pr_num]
108110
for c in commits:
109111
merge_message_flags = merge_message_flags + ["-m", c]
110112

0 commit comments

Comments
 (0)