Commit 9d44f0d7 authored by Ben Boeckel's avatar Ben Boeckel

mantis_port: support labels for statuses

parent 361c3b97
......@@ -25,6 +25,7 @@ class MantisIssues(object):
self._priorities = {}
self._severities = {}
self._projects = {}
self._statuses = {}
@property
def max_id(self):
......@@ -42,13 +43,17 @@ class MantisIssues(object):
def add_project_mapping(self, project, labels):
self._projects[project] = set(labels)
def add_status_mapping(self, status, labels):
self._statuses[status] = set(labels)
def get_labels(self, issue):
clabels = self._categories.get(issue.get('Category'), set())
plabels = self._priorities.get(issue.get('Priority'), set())
slabels = self._severities.get(issue.get('Severity'), set())
jlabels = self._projects.get(issue.get('Project'), set())
dlabels = self._statuses.get(issue.get('Status'), set())
return clabels | plabels | slabels | jlabels
return clabels | plabels | slabels | jlabels | dlabels
def add_user_mapping(self, name, gitlab_user):
self._users[name] = gitlab_user
......@@ -216,11 +221,13 @@ if __name__ == '__main__':
# To have users map from Mantis to GitLab, add users mappings:
# mantis_issues.add_user_mapping(mantis_display_name, gitlab_username)
# To add labels based on the category, priority, severity, and project:
# To add labels based on the category, priority, severity, project, and
# status:
# mantis_issues.add_category_mapping(category, ['label1', 'label2'])
# mantis_issues.add_priority_mapping(priority, ['label1', 'label2'])
# mantis_issues.add_severity_mapping(severity, ['label1', 'label2'])
# mantis_issues.add_project_mapping(project, ['label1', 'label2'])
# mantis_issues.add_status_mapping(status, ['label1', 'label2'])
# To have status/resolution pairs cause issues to be closed, use:
# The 'closed' status will close regardless of the resolution:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment