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.
This commit is contained in:
Thomas Haller 2022-04-05 09:05:17 +02:00
parent 4a35dbe6a7
commit 4e28bd5a94
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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