1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-11-27 15:09:50 +01:00

Add commit messages as commented lines to the template in 'git-obs pr create'

This commit is contained in:
2025-10-13 13:24:00 +02:00
parent 0ce49e87e9
commit 67a711c577

View File

@@ -22,6 +22,9 @@ NEW_PULL_REQUEST_TEMPLATE = """
# Creating {source_owner}/{source_repo}#{source_branch} -> {target_owner}/{target_repo}#{target_branch} # Creating {source_owner}/{source_repo}#{source_branch} -> {target_owner}/{target_repo}#{target_branch}
# #
{git_status} {git_status}
#
# Commits:
{git_commits}
""".lstrip() """.lstrip()
@@ -137,6 +140,12 @@ class PullRequestCreateCommand(osc.commandline_git.GitObsCommand):
else: else:
git_status = "#" git_status = "#"
if use_local_git:
git_commits = git._run_git(["log", "--format=- %s", f"{target_branch_obj.commit}..{source_branch_obj.commit}"])
git_commits = "\n".join([f"# {i}" for i in git_commits.splitlines()])
else:
git_commits = "#"
message = gitea_api.edit_message(template=NEW_PULL_REQUEST_TEMPLATE.format(**locals())) message = gitea_api.edit_message(template=NEW_PULL_REQUEST_TEMPLATE.format(**locals()))
# remove comments # remove comments