Import from Mantis
General Procedure
You can import issues from the Mantis bug tracker into YouTrack.
To import issues from the Mantis bug tracker:
- Download the latest version of YouTrack's Python Client Library and unzip it.
- Install Python or Jython.
- Install Python library mySQLdb.
- If needed, create a new mapping file to set the correspondence between source fields in Mantis and YouTrack issue's attributes.
This mapping file should be created in the
<library install directory>\python\mantis
directory. By default, thedefaultMantis.py
file is used. For more details about structure of the library, please refer to the Python Client Library page. - Import issues from a file to YouTrack running the following command:
Enter values for the following command-line parameters:
python mantis2youtrack.py target_url, target_login, target_pass, mantis_db_name, mantis_db_host, mantis_db_port, mantis_db_login, mantis_db_pass, mantis_project mantis_project mantis_project
Importing Sub-projects
If any Mantis project to be imported has one or several sub-projects, all of them are imported as a single project in YouTrack.
If you want to distinguish issues of different sub-projects, you should specify the CREATE_CF_FOR_SUBPROJECT
parameter in your mapping file.
If this variable is enabled, then for all issues in the target YouTrack project a new custom field "Subproject" will be created. As a value of this custom field,
the name of a subproject will be set. For issues from the main project, the Subproject custom field will be set as Undefined.
Importing Users
Please note that YouTrack does not support importing usernames with spaces. For such usernames the space sign will be replace with the underscore ("_") sign.
Encoding
By default, all data in Mantis is stored in cp866
encoding. If you have configured another encoding, then to import your data to YouTrack correctly, you need to change the encoding parameter in your mapping file.
Notes on Mapping
All mappings except Custom Fields, could be edited, if needed.
Mapping Resolution and Status
Both Statuses and Resolutions are imported in YouTrack as issue state:
Mapping Priority, Status, and Link Types
Mantis PRIORITY | YouTrack Priority |
---|---|
10 (none) | "0" (Minor) |
20 (low) | "0" (Minor) |
30 (normal) | "1" (Normal) |
40 (high) | "2" (Major) |
50 (urgent) | "3" (Critical) |
60 (immediate) | "4" (Show-stoper) |
Mantis STATUS | YouTrack State |
---|---|
40 (confirmed) | "Verified" |
Mantis LINK_TYPES | YouTrack's Link type |
---|---|
0 (duplicate of) | "Duplicate" |
1 (related to) | "Relates" |
2 (parent of) | "Depend" |
Mapping Reproducibility and Severity
Both REPRODUCIBILITY and SEVERITY attributes are imported to YouTrack as new custom fields of enum[*]
type with the same names.
Mantis REPRODUCIBILITY | Reproducibility in YouTrack |
---|---|
10 | "Always" |
30 | "Sometimes" |
50 | "Random" |
70 | "Have not tried" |
90 | "Unable to reproduce" |
100 | "N/A" |
Mantis SEVERITY | Severity value in YouTrack |
---|---|
10 | "Feature" |
20 | "Trivial" |
30 | "Text" |
40 | "Tweak" |
50 | "Minor" |
60 | "Major" |
70 | "Crash" |
80 | "Block" |
Mapping Custom Field Types
Defining Additional Mapping for Issue Fields and Issue Field Types
You can specify additional mapping between YouTrack issue fields and Mantis issue fields.
To define additional mapping, use FIELD_NAMES
dictionary.
In default provided defaultMantis.py
mapping file, the following dictionary is defined:
mantis.FIELD_NAMES = {
u"severity" : [u"Severity", u"Type"],
u"handler" : [u"Assignee"],
u"status" : [u"State"],
u"resolution" : [u"State"],
u"category" : [u"Subsystem"],
u"version" : [u"Affected versions"],
u"fixed_in_version" : [u"Fix versions"], # DO NOT remove Fix versions form this list, if needed you can add one more field
# but DO NOT delete Fix versions
u"build" : [u"Fixed in build"],
u"os_build" : [u"OS version"],
u"subproject" : [u"Subproject"],
u"os" : [u"OS"],
u"due_date" : [u"Due date"],
u"target_version" : [u"Target version"] # it's better to import this fields with version type
}
Also, you can change target field types (field types in YouTrack) using FIELD_TYPES
dictionary.
In the default mapping file, the following dictionary is defined:
mantis.FIELD_TYPES = {
u"Priority" : "enum[1]",
u"Type" : "enum[1]",
u"State" : "state[1]",
u"Fix versions" : "version[*]",
u"Affected versions" : "version[*]",
u"Assignee" : "user[1]",
u"Fixed in build" : "build[1]",
u"Subsystem" : "ownedField[1]",
u"Subproject" : "ownedField[1]",
u"Severity" : "enum[1]",
u"Platform" : "string",
u"OS" : "string",
u"OS version" : "string",
u"Reproducibility" : "enum[1]",
u"Due date" : "date",
u"Target version" : "version[1]"
}
The default custom fields type mapping is used in the import rules in mantis2youtrack.py
.
Please update the import rules in your script when changing the mapping.