Skip to content

Commit

Permalink
PortAddonPullRequest: use previous branch as base
Browse files Browse the repository at this point in the history
Fixes #19
  • Loading branch information
sebalix committed May 24, 2023
1 parent a719ced commit 35846b0
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit 35846b0

Please sign in to comment.