3 Import Mantis issues into GitLab.
8 npm install -g mantis2gitlab
20 -i, --input CSV file exported from Mantis (Example: issues.csv) [required]
21 -c, --config Configuration file (Example: config.json) [required]
22 -g, --gitlaburl GitLab URL hostname (Example: https://gitlab.com) [required]
23 -p, --project GitLab project name including namespace (Example: mycorp/myproj) [required]
24 -t, --token An admin user's private token (Example: a2r33oczFyQzq53t23Vj) [required]
25 -s, --sudo The username performing the import (Example: bob) [required]
26 -f, --from The first issue # to import (Example: 123)
31 In order to correctly map Mantis attributes you should create a JSON file and specify it with the **-c** switch.
35 This section maps Mantis `username` (Reporter, Assigned To, etc.) to a corresponding GitLab user name.
41 "gl_username": "GitLabUserName1"
44 "gl_username": "GitLabUserName2"
50 ### Mantis URL (optional)
52 This setting defines the URL to the old mantis installation. When specified, Mantis cases imported in GitLab
53 will contain a back-link to their corresponding Mantis issue.
57 "mantisUrl": "https://www.oldserver.com/mantis"
61 ### Category Labels (optional)
63 This section maps Mantis Categories to corresponding GitLab labels.
68 "Admin UI": "area:Admin",
69 "Voter UI": "area:Voter",
70 "Server": "area:Service"
75 ### Priority Labels (optional)
77 This section maps Mantis Priorities to corresponding GitLab labels.
78 Note that the numeric priorities are used when exporting from SQL.
84 "low": "priority:low",
85 "40": "priority:high",
86 "high": "priority:high",
87 "50": "priority:urgent",
88 "urgent": "priority:urgent",
89 "60": "priority:immediate",
90 "immediate": "priority:immediate"
95 ### Severity Labels (optional)
97 This section maps Mantis Severities to corresponding GitLab labels.
98 Note that the numeric severities are used when exporting from SQL.
103 "10": "severity:feature",
104 "feature": "severity:feature",
105 "20": "severity:trivial",
106 "trivial": "severity:trivial",
107 "30": "severity:text",
108 "text": "severity:text",
109 "40": "severity:tweak",
110 "tweak": "severity:tweak",
111 "50": "severity:minor",
112 "minor": "severity:minor",
113 "60": "severity:major",
114 "major": "severity:major",
115 "70": "severity:crash",
116 "crash": "severity:crash",
117 "80": "severity:block",
118 "block": "severity:block"
123 ### Closed Statuses (optional)
125 This section maps which Mantis Statuses indicate that the issue is closed.
126 Note that the numeric severities are used when exporting from SQL.
139 ## Exporting From Mantis
141 The input to this script is a CSV file with the following columns:
143 * `Id` - Will create a corresponding GitLab *Issue*
144 * `Summary` - Will create a corresponding GitLab *Title*
145 * `Category` - Will create a corresponding GitLab *Label* from `config.category_labels[Category]`
146 * `Priority` - Will create a corresponding GitLab *Label* from `config.priority_labels[Priority]`
147 * `Severity` - Will create a corresponding GitLab *Label* from `config.severity_labels[Severity]`
148 * `Created` - Will be included in the *Description* header
149 * `Updated` - Will be included in the *Description* header, if different from `Created`
150 * `Reporter` - Will be included in the *Description* header
151 * `Assigned To` - Will be included in the *Description* header
152 * `Description` - Will be included in the *Description*
153 * `Info` - Will be appended the *Description*
154 * `Notes` - Will be split on `"$$$$"` and appended the *Description*
156 ### Exporting from Mantis UI
158 You can export a summary of the Mantis issues from the _View Issues_ page by clicking on the _Export CSV_ button.
160 **Note:** This export will only include a subset of the issues and is not the recommended approach.
162 ### Exporting from database
164 The following SQL query pulls all the supported columns from the Mantis database. Make sure you specify the correct `PROJECT_NAME`:
169 project.name as Project,
170 bug.category as Category,
171 bug.summary as Summary,
172 bug.priority as Priority,
173 bug.severity as Severity,
174 bug.status as Status,
175 bug.date_submitted as Created,
176 bug.last_updated as Updated,
177 reporter.username as Reporter,
178 handler.username as "Assigned To",
179 bug_text.description as Description,
180 bug_text.additional_information as Info,
182 CONCAt('*', bugnote.date_submitted, ' - ', note_reporter.username, '*
184 ', bugnote_text.note)
189 mantis_bug_table as bug
190 JOIN mantis_project_table project ON bug.project_id = project.id
191 JOIN mantis_bug_text_table bug_text ON bug.bug_text_id = bug_text.id
192 JOIN mantis_user_table as reporter ON bug.reporter_id = reporter.id
193 LEFT OUTER JOIN mantis_user_table as handler ON bug.handler_id = handler.id
194 LEFT OUTER JOIN mantis_bugnote_table as bugnote ON bugnote.bug_id = bug.id
195 LEFT OUTER JOIN mantis_bugnote_text_table as bugnote_text ON bugnote.bugnote_text_id = bugnote_text.id
196 LEFT OUTER JOIN mantis_user_table as note_reporter ON bugnote.reporter_id = note_reporter.id
198 project.name = 'PROJECT_NAME'
204 - Make sure the input CSV file only includes issues for the project you want to import.
205 - In version 6.4.3, GitLab API does not support setting creation date of issues. So all imported issues will have a creation time of now.
206 - In version 6.4.3, GitLab API fails to import issues with very long titles.
207 - In version 6.4.3, GitLab does not allow issues to be deleted. So be careful when importing issues into an active project.
208 - Milestones are not currently supported.
217 + http://github.com/nonplus
219 ## Copyright and License
221 Based on https://github.com/soheilpro/youtrack2gitlab
223 Copyright 2015 Stepan Riha
225 Licensed under the The MIT License (the "License");
226 you may not use this work except in compliance with the License.
227 You may obtain a copy of the License in the LICENSE file, or at:
229 http://www.opensource.org/licenses/mit-license.php
231 Unless required by applicable law or agreed to in writing, software
232 distributed under the License is distributed on an "AS IS" BASIS,
233 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
234 See the License for the specific language governing permissions and
235 limitations under the License.