Skip to content

feat: skip similar commit (summary, author_email)#88

Open
rvalyi wants to merge 1 commit intoOCA:mainfrom
akretion:feature/skip-similar-commit-rb-on-main
Open

feat: skip similar commit (summary, author_email)#88
rvalyi wants to merge 1 commit intoOCA:mainfrom
akretion:feature/skip-similar-commit-rb-on-main

Conversation

@rvalyi
Copy link
Member

@rvalyi rvalyi commented Sep 9, 2025

often I noticed that oca-port is trying to port commits already present in the target branch. I'm not sure but it seems it's looking using sha1 so it fails on commits that are cherry-picked (disclaimer I'm not very sure it's the reason why). But I notice this very often.

So what I did is I look up the commit with a long enough summary and if the summary and author_email matches in the target branch, then I skip the commit and I print that I'm skipping it.
Yes there is a small chance a commit by the same author got the same summary without being the same, but in that case you'll likely notice merge conflicts later in the port process and the culprit commit will also be logged, so I feel this is safe enough.

This is a a feature I've been using for one year in OCA/l10n-brazil (the most active OCA repo after OpenUpgrade), but it can probably be made cleaner. Let me know if you want me to change something.

cc @sebalix @simahawk

@rvalyi rvalyi force-pushed the feature/skip-similar-commit-rb-on-main branch 2 times, most recently from 2420078 to f8f664b Compare September 9, 2025 14:38
@rvalyi rvalyi force-pushed the feature/skip-similar-commit-rb-on-main branch from f8f664b to 201d860 Compare September 9, 2025 14:41
@rvalyi rvalyi changed the title skip similar commit (summary, author_email) feat: skip similar commit (summary, author_email) Sep 9, 2025
@sebalix
Copy link
Collaborator

sebalix commented Sep 11, 2025

Hello @rvalyi ,
IMO the issue should be somewhere else, as oca-port doesn't rely on SHA to compare commits, but instead on different commit attributes, like the message (not the summary, which is contained in the message), author name + email, authored date etc... even the updated file paths in some cases (there is a strict or non-strict comparison depending on the use case), see the Commit class.
Normally commits migrated with git cherry-pick or git format-patch + git am (and without touching the commit message) are well detected as already existing.

If you could provide me an example in OCA/l10n-brazil that is listing false-positive commits, I could analyze deeper where the issue stands, maybe the existing criteria for that comparison is too strict for your use case?

@sebalix
Copy link
Collaborator

sebalix commented Sep 11, 2025

The other day I found the opposite bug: oca-port is not proposing some commits to be ported because it detected another similar one but in another module :) I will tackle that in release 0.20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants