Module: tools Branch: master Commit: acecdb925f7b2d22d62f1fd626c6cc97408a729e URL: https://gitlab.winehq.org/winehq/tools/-/commit/acecdb925f7b2d22d62f1fd626c6...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Jul 22 11:57:12 2022 +0200
gitlab: Support configuring the path of the maintainers file.
---
gitlab/gitlab-to-mail/assign.py | 4 +++- gitlab/gitlab-to-mail/example.cfg | 3 +++ gitlab/gitlab-to-mail/util.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gitlab/gitlab-to-mail/assign.py b/gitlab/gitlab-to-mail/assign.py index 6b35f577..a4d8709d 100755 --- a/gitlab/gitlab-to-mail/assign.py +++ b/gitlab/gitlab-to-mail/assign.py @@ -44,7 +44,9 @@ def append_user(user_map, line, id_array, name_array, verbose=False): print("Cannot find GitLab account for [{}]".format(name), file=sys.stderr)
def get_maintainers_map(verbose=False): - url = urljoin(settings.GITLAB_URL, f"{settings.GITLAB_PROJECT_NAME}/-/raw/master/MAINTAINERS") + if settings.MAINTAINERS is None: + return [] + url = urljoin(settings.GITLAB_URL, f"{settings.GITLAB_PROJECT_NAME}/-/raw/master/{settings.MAINTAINERS}") r = requests.get(url, headers={"PRIVATE-TOKEN": settings.GITLAB_TOKEN}) r = requests.get(url) r.raise_for_status() diff --git a/gitlab/gitlab-to-mail/example.cfg b/gitlab/gitlab-to-mail/example.cfg index a4e4f238..49ee8c7d 100644 --- a/gitlab/gitlab-to-mail/example.cfg +++ b/gitlab/gitlab-to-mail/example.cfg @@ -41,3 +41,6 @@ MAXIMUM_PATCHES = 50 # Configure runner.py behavior. A minimum delay of 30 seconds is enforced. RUNNER_COMMAND = ./gitlabtomail.py RUNNER_INTERVAL = 300 + +# Name of maintainers file for reviewers assignments +MAINTAINERS = "MAINTAINERS" diff --git a/gitlab/gitlab-to-mail/util.py b/gitlab/gitlab-to-mail/util.py index 231e8e21..b83b10b2 100644 --- a/gitlab/gitlab-to-mail/util.py +++ b/gitlab/gitlab-to-mail/util.py @@ -30,7 +30,7 @@ class Settings: sys.exit(1)
for s in ['DATABASE', 'GITLAB_TOKEN', 'GITLAB_URL', 'GITLAB_PROJECT_NAME', - 'BRIDGE_FROM_EMAIL', 'BRIDGE_TO_EMAIL', 'BRIDGE_TAG', + 'BRIDGE_FROM_EMAIL', 'BRIDGE_TO_EMAIL', 'BRIDGE_TAG', 'MAINTAINERS', 'SMTP_DOMAIN', 'SMTP_USER', 'SMTP_PASSWORD', 'RUNNER_COMMAND']: if s in self.cp['settings']: self.__dict__[s] = self.cp['settings'][s].strip('"')