From fe057ee641c653dade8ea55a6111f8b5b21f1eb4 Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 29 Oct 2026 18:44:14 +0000 Subject: [PATCH 1/2] partial bitcoin-core/bitcoin-maintainer-tools#59: github-merge: Format pull_reference in one place Backport of upstream commit 6e05dc8e4b68efa093bae091abfef33bc6bb0f12, a prerequisite of bitcoin-core/bitcoin-maintainer-tools#92. The rest of #59 (push_mirrors config) is not needed for this and is omitted. Dash's print_merge_details() has no `message` argument, so only the pull reference parameter changes there. Co-Authored-By: Claude Opus 5.5 --- contrib/devtools/github-merge.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/contrib/devtools/github-merge.py b/contrib/devtools/github-merge.py index 5466237ccc82..228476e2b2b8 100755 --- a/contrib/devtools/github-merge.py +++ b/contrib/devtools/github-merge.py @@ -263,8 +263,8 @@ def make_acks_message(head_commit, acks): ack_str ='\n\nTop commit has no ACKs.\n' return ack_str -def print_merge_details(pull, title, branch, base_branch, head_branch, acks): - print('%s#%s%s %s %sinto %s%s' % (ATTR_RESET+ATTR_PR,pull,ATTR_RESET,title,ATTR_RESET+ATTR_PR,branch,ATTR_RESET)) +def print_merge_details(pull_reference, title, branch, base_branch, head_branch, acks): + print('{}{}{} {} {}into {}{}'.format(ATTR_RESET+ATTR_PR,pull_reference,ATTR_RESET,title,ATTR_RESET+ATTR_PR,branch,ATTR_RESET)) subprocess.check_call([GIT,'log','--graph','--topo-order','--pretty=format:'+COMMIT_FORMAT,base_branch+'..'+head_branch]) if acks is not None: if acks: @@ -335,6 +335,8 @@ def main(): # - 'master' branch = args.branch or opt_branch or info['base']['ref'] or 'master' + pull_reference = '#' + pull + # Initialize source branches head_branch = 'pull/'+pull+'/head' base_branch = 'pull/'+pull+'/base' @@ -351,7 +353,7 @@ def main(): subprocess.check_call([GIT,'fetch','-q',host_repo,'+refs/pull/'+pull+'/*:refs/heads/pull/'+pull+'/*', '+refs/heads/'+branch+':refs/heads/'+base_branch]) except subprocess.CalledProcessError: - print("ERROR: Cannot find pull request #%s or branch %s on %s." % (pull,branch,host_repo), file=stderr) + print("ERROR: Cannot find pull request {} or branch {} on {}.".format(pull_reference,branch,host_repo), file=stderr) sys.exit(3) # Ask the user if they want to rebase the branch @@ -409,12 +411,12 @@ def main(): head_commit = subprocess.check_output([GIT,'log','-1','--pretty=format:%H',head_branch]).decode('utf-8') assert len(head_commit) == 40 except subprocess.CalledProcessError: - print("ERROR: Cannot find head of pull request #%s on %s." % (pull,host_repo), file=stderr) + print("ERROR: Cannot find head of pull request {} on {}.".format(pull_reference,host_repo), file=stderr) sys.exit(3) try: subprocess.check_call([GIT,'log','-q','-1','refs/heads/'+merge_branch], stdout=devnull, stderr=stdout) except subprocess.CalledProcessError: - print("ERROR: Cannot find merge of pull request #%s on %s." % (pull,host_repo), file=stderr) + print("ERROR: Cannot find merge of pull request {} on {}.".format(pull_reference,host_repo), file=stderr) sys.exit(3) subprocess.check_call([GIT,'checkout','-q',base_branch]) subprocess.call([GIT,'branch','-q','-D',local_merge_branch], stderr=devnull) @@ -426,9 +428,9 @@ def main(): os.chdir(toplevel) # Create unsigned merge commit. if title: - firstline = 'Merge #%s: %s' % (pull,title) + firstline = 'Merge {}: {}'.format(pull_reference,title) else: - firstline = 'Merge #%s' % (pull,) + firstline = 'Merge {}'.format(pull_reference) message = firstline + '\n\n' message += subprocess.check_output([GIT,'log','--no-merges','--topo-order','--pretty=format:%H %s (%an)',base_branch+'..'+head_branch]).decode('utf-8') message += '\n\nPull request description:\n\n ' + body.replace('\n', '\n ') + '\n' @@ -456,7 +458,7 @@ def main(): print("ERROR: Unable to compute tree hash") sys.exit(4) - print_merge_details(pull, title, branch, base_branch, head_branch, None) + print_merge_details(pull_reference, title, branch, base_branch, head_branch, None) print() # Run test command if configured. @@ -506,7 +508,7 @@ def main(): sys.exit(4) # Sign the merge commit. - print_merge_details(pull, title, branch, base_branch, head_branch, acks) + print_merge_details(pull_reference, title, branch, base_branch, head_branch, acks) while True: reply = ask_prompt("Type 's' to sign off on the above merge, or 'x' to reject and exit.").lower() if reply == 's': From 0b33fee1fe007dad182f4f87203938f6b1e63c1e Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 29 Oct 2026 18:44:14 +0000 Subject: [PATCH 2/2] Merge bitcoin-core/bitcoin-maintainer-tools#92: github-merge: Always include repo_from in the merge commit message Backport of upstream commit 3811ce103cff9c0bcda9b26de04c4004d2c231ed. Merge commits now read "Merge /#N" instead of "Merge #N", so a merge made in dashpay/dash-internal (githubmerge.repository set to dashpay/dash-internal) comes out as "Merge dashpay/dash-internal#N" and can no longer be mistaken for public dashpay/dash#N once merged back. Upstream builds the reference from `repo_from`, added by bitcoin-core/bitcoin-maintainer-tools#57 (--repo-from for monotree fetches). Dash does not have #57, so the reference uses `repo`, which is what `repo_from` defaults to upstream. Co-Authored-By: Claude Opus 5.5 --- contrib/devtools/github-merge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/devtools/github-merge.py b/contrib/devtools/github-merge.py index 228476e2b2b8..70d91586ea02 100755 --- a/contrib/devtools/github-merge.py +++ b/contrib/devtools/github-merge.py @@ -335,7 +335,7 @@ def main(): # - 'master' branch = args.branch or opt_branch or info['base']['ref'] or 'master' - pull_reference = '#' + pull + pull_reference = repo + '#' + pull # Initialize source branches head_branch = 'pull/'+pull+'/head'