Skip to content

Commit

Permalink
Merge pull request #59 from camptocamp/fix-repo-priority
Browse files Browse the repository at this point in the history
[FIX] give the priority to the target repository
  • Loading branch information
sebalix authored Nov 20, 2024
2 parents 4321115 + 4651057 commit 1647887
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion oca_port/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ def _prepare_parameters(self):
self.repo_path = pathlib.Path(self.repo_path)
self.repo_name = (
self.repo_name
or self.source.repo
or self.target.repo
or self.source.repo
or self.repo_path.absolute().name
)
if not self.repo_path:
Expand Down
5 changes: 3 additions & 2 deletions oca_port/port_addon_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,10 +850,11 @@ def _get_original_pr(self, commit: g.Commit):
# Request GitHub to get them
if not any("github.com" in remote.url for remote in self.app.repo.remotes):
return
src_repo_name = self.app.source.repo or self.app.repo_name
try:
raw_data = self.app.github.get_original_pr(
self.app.upstream_org,
self.app.repo_name,
src_repo_name,
self.app.from_branch.name,
commit.hexsha,
)
Expand All @@ -866,7 +867,7 @@ def _get_original_pr(self, commit: g.Commit):
# NOTE: commits fetched from PR are already in the right order
pr_number = raw_data["number"]
pr_commits_data = self.app.github.request(
f"repos/{self.app.upstream_org}/{self.app.repo_name}"
f"repos/{self.app.upstream_org}/{src_repo_name}"
f"/pulls/{pr_number}/commits?per_page=100"
)
pr_commits = [pr["sha"] for pr in pr_commits_data]
Expand Down

0 comments on commit 1647887

Please sign in to comment.