Module: tools Branch: master Commit: 4c4d3b7870d1124af36d6e2c9767012930551fd5 URL: https://source.winehq.org/git/tools.git/?a=commit;h=4c4d3b7870d1124af36d6e2c...
Author: Alexandre Julliard julliard@winehq.org Date: Mon May 23 10:47:31 2022 +0200
gitlab-to-mail: Ignore MR if it doesn't contain any patch.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
gitlab/gitlab-to-mail/gitlabtomail.py | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/gitlab/gitlab-to-mail/gitlabtomail.py b/gitlab/gitlab-to-mail/gitlabtomail.py index bd56033..d426cc9 100755 --- a/gitlab/gitlab-to-mail/gitlabtomail.py +++ b/gitlab/gitlab-to-mail/gitlabtomail.py @@ -581,6 +581,12 @@ def process_mr(mr, update_db): # last sha1 matches a known version and then we use that. updated_at = parse_gitlab_datetime(mr['updated_at']) patches = split_mbox_into_messages(fetch_mr_patches(iid)) + if not patches: + log(f"Warning: MR {iid} doesn't contain any patch") + if update_db: + db.set_last_mr_updated_at(updated_at) + return + sha1s = [get_patch_sha1(patch) for patch in patches] versions = fetch_mr_versions(iid) version = get_mr_version(versions, sha1s[-1])