Skip to content
Snippets Groups Projects
Commit c5080e62 authored by Christian Gumpert's avatar Christian Gumpert Committed by Graeme Stewart
Browse files

limit the number of affected packages mentioned in MR discussion

For repository-wide changes, many packages are affected. If the list
of affected packages becomes very long, the automatic comment from
the atlasbot does not really help, but only makes following the
discussion on the Gitlab web interface more difficult. Therefore,
the list of affected packages is only printed for at most 20 packages.

Closes ATLINFR-1488
parent c844da50
No related merge requests found
......@@ -11,11 +11,16 @@ def comment_affected_packages(packages):
return: comment text
"""
if len(packages) > 0:
comment = "This merge request affects %d package%s: \n- " % (len(packages),'' if len(packages) == 1 else 's')
n_packages = len(packages)
if n_packages == 0:
comment = "This merge request affects no known packages. Consult an expert!"
elif n_packages == 1:
comment = "This merge request affects 1 package: \n- " + packages.pop()
elif n_packages <= 20:
comment = "This merge request affects %d packages: \n- " % n_packages
comment += " \n- ".join(sorted(packages))
else:
comment = "This merge request affects no known packages. Consult an expert!"
comment = "This merge request affects %d packages. Since this is a long list, I will not print it here." % n_packages
return comment
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment