Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PortAddonPullRequest: use previous branch as base #25

Merged
merged 1 commit into from
May 24, 2023
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
7 changes: 5 additions & 2 deletions oca_port/port_addon_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"Added translation using Weblate",
]

PR_BRANCH_NAME = "oca-port-pr-{pr_number}-from-{from_branch}-to-{to_branch}"
PR_BRANCH_NAME = "oca-port-from-{from_branch}-to-{to_branch}-pr-{pr_number}"

FOLDERS_TO_SKIP = [
"setup",
Expand Down Expand Up @@ -203,9 +203,9 @@ def _port_pull_request_commits(
# Create a local branch based on upstream
if self.create_branch:
branch_name = PR_BRANCH_NAME.format(
pr_number=pr.number,
from_branch=self.from_branch.name,
to_branch=self.to_branch.name,
pr_number=pr.number,
)
if branch_name in self.repo.heads:
# If the local branch already exists, ask the user if he wants
Expand All @@ -228,6 +228,9 @@ def _port_pull_request_commits(
):
base_ref = previous_pr_branch
based_on_previous = True
# Set the new branch name the same than the previous one
# but with the PR number as suffix.
branch_name = f"{previous_pr_branch.name}-{pr.number}"
print(
f"\tCreate branch {bc.BOLD}{branch_name}{bc.END} from {base_ref.ref()}..."
)
Expand Down