lts-release-mail: Handle commits with multiple Change-Id lines
Some commits (dependabot specifically) appear to have 2 Change-Id
lines in the commit description, and one which belongs to the TF
Gerrit is actually the last one. So, rework Change-Id parsing to
handle such cases.
Addresses https://linaro.atlassian.net/browse/TFC-692
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: Ia6bb60e2490ac72ac0aeead3bc8571d14f8a00da
diff --git a/lts/lts-release-mail.py b/lts/lts-release-mail.py
index 13ee2ff..e5268f7 100755
--- a/lts/lts-release-mail.py
+++ b/lts/lts-release-mail.py
@@ -89,10 +89,14 @@
urls = []
for s in subjects:
commit_id, _ = s.split(" ", 1)
+ change_id = None
for l in os.popen("git show %s" % commit_id):
+ # There can be multiple Change-Id lines in some commits, and
+ # we're interested in the last in that case.
if "Change-Id:" in l:
_, change_id = l.strip().split(None, 1)
- urls.append("https://review.trustedfirmware.org/q/" + change_id)
+ if change_id:
+ urls.append("https://review.trustedfirmware.org/q/" + change_id)
assert len(subjects) == len(urls)