Skip to content

Commit

Permalink
Display PR info when the user chose to not open one automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
sebalix committed Sep 16, 2024
1 parent fa56873 commit 6db0963
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions oca_port/port_addon_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import hashlib
import shutil
import tempfile
import urllib.parse
from collections import defaultdict

import click
Expand Down Expand Up @@ -46,6 +47,11 @@
"static/description/index.html",
]

NEW_PR_URL = (
"https://github.com/{from_org}/{repo_name}/compare/"
"{to_branch}...{to_org}:{pr_branch}?expand=1&title={title}"
)

# Fake PR for commits w/o any PR (used as fallback)
FAKE_PR = g.PullRequest(*[""] * 6)

Expand Down Expand Up @@ -537,6 +543,20 @@ def _create_pull_request(self, pr_branch, pr_data, processed_prs):
f"\t{bc.BOLD}{bc.OKCYAN}PR created =>" f"{bc.ENDC} {pr_url}{bc.END}"
)
return pr_url
# Invite the user to open the PR on its own
pr_title_encoded = urllib.parse.quote(pr_data["title"])
new_pr_url = NEW_PR_URL.format(
from_org=self.app.upstream_org,
repo_name=self.app.repo_name,
to_branch=self.app.to_branch.name,
to_org=self.app.destination.org,
pr_branch=pr_branch.name,
title=pr_title_encoded,
)
self._print(
"\nℹ️ You can still open the PR yourself there:\n" f"\t{new_pr_url}\n"
)
self._print_tips(pr_data)


class BranchesDiff(Output):
Expand Down

0 comments on commit 6db0963

Please sign in to comment.