From 4e28bd5a94e60a7074ba70af5713dc6ba7ebdcf6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 5 Apr 2022 09:05:17 +0200 Subject: [PATCH] find-backports: support "Ignore-Fixes:" tag to ignore "Fixes:" commit "Ignore-Backport:" is already in use. For the find-backports script it has the same meaning as a "cherry picked from" line, that means, we assume that the referenced patch was backported already and the fix applied. This is of course useful to make the script shut up about backports that we don't want to do. However, it requires us to tag the old branch with this, so that the script thinks that the patch is already there. Imaging we have a wrong commit on "next" branch with a Fixes line. We don't want to backport it, so we would have to tag the "old" branch with "Ignore-Backport:". That is cumbersome. Instead, now also support that if a commit contains a "Fixes:" line any an "Ignore-Fixes:" for the same fixed commit, then this let's the "Fixes:" line be ignored. --- contrib/scripts/find-backports | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/contrib/scripts/find-backports b/contrib/scripts/find-backports index e1c5aa4194..c9ec1c0d64 100755 --- a/contrib/scripts/find-backports +++ b/contrib/scripts/find-backports @@ -156,6 +156,18 @@ def git_ref_commit_body_get_fixes(ref): h = git_ref_exists(c) if h: result.append(h) + if result: + # The commit that contains a "Fixes:" line, can also contain an "Ignore-Fixes:" line + # to disable it. This only makes sense with refs/notes/bugs notes, to fix up a wrong + # annotation. + for mo in re.finditer(re_bin("\\bIgnore-[fF]ixes: *([0-9a-z]+)\\b"), body): + c = mo.group(1).decode("ascii") + h = git_ref_exists(c) + try: + result.remove(h) + except ValueError: + pass + return result