contrib: fail "find-backports" script if we have no "refs/notes/bugs" notes

"find-backports" script parses the commit messages to figure out which
patches to backport. We use "refs/notes/bugs" notes to extend the
meta data after the commit was merged. If you don't setup the
notes, the output is likely incomplete or wrong.

Yes, this is annoying. It requires you to setup the notes as described
in "CONTRIBUTING.md". Also because the "release.sh" script runs "find-backports",
so that means you cannot do releases without setting up the notes
(unless you manually disable running "find-backports"). But you really shouldn't
make a release based on incomplete information.
This commit is contained in:
Thomas Haller 2022-04-06 13:06:56 +02:00
parent 8f7e295cbf
commit e9340c792c
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -43,6 +43,15 @@ def _keys_to_dict(itr):
return d
@memoize
def git_ref_exists_plain(ref):
try:
subprocess.check_output(["git", "show-ref", "-q", "--verify", str(ref)])
except subprocess.CalledProcessError:
return False
return True
@memoize
def git_ref_exists(ref):
try:
@ -245,6 +254,11 @@ if __name__ == "__main__":
if not ref_head:
die('Ref "%s" does not exist' % (ref_head0))
if not git_ref_exists_plain("refs/notes/bugs"):
die(
"Notes refs/notes/bugs not found. Read CONTRIBUTING.md file for how to setup the notes"
)
ref_upstreams = []
if len(sys.argv) <= 2:
head_name = git_get_head_name(ref_head0)