Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions oca_port/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class App(Output):
clear_cache: bool = False
github_token: str = None
cli: bool = False # Not documented, should not be used outside of the CLI
skip_similar_commits: bool = True

_available_outputs = ("json",)

Expand Down
17 changes: 17 additions & 0 deletions oca_port/port_addon_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,23 @@ def get_commits_diff(self):
pr_commit_paths = {
path for path in pr_commit.paths if not path_to_skip(path)
}
if (
self.app.skip_similar_commits
and len(pr_commit.summary) > 20
and (
pr_commit.summary,
pr_commit.author_email,
)
in [
(c.summary, c.author_email)
for c in self.to_branch_path_commits
]
):
print(
f"SKIPPING '{pr_commit.summary}' because a similar commit "
f"(summary, author_email) was found. {pr_commit_paths} {pr_commit_sha}"
)
continue
pr.paths.update(pr_commit_paths)
# Check that this PR commit does not change the current
# addon we are interested in, in such case also check
Expand Down
4 changes: 3 additions & 1 deletion oca_port/tests/test_branches_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def test_with_satellite_changes(self):
]
upstream_repo.git.am("-3", "--keep", *patches)
# Check if unported change is detected as satellite
app = self._create_app(self.source1, self.target1, fetch=True)
app = self._create_app(
self.source1, self.target1, fetch=True, skip_similar_commits=False
)
diff = BranchesDiff(app)
self.assertFalse(diff.commits_diff["addon"])
self.assertTrue(diff.commits_diff["satellite"])
Expand Down