| Before you begin: If you try to re-import same project several times, then you must delete previously imported data before the next attempt. |
Importing Issues from Mantis to YouTrack
General Procedure
Current implementation of the Python Client Library and scripts is compatible with YouTrack 3.x and 4.x REST API and Python 2.6. If you use YouTrack 2.x, please refer to YouTrack Release Downloads Archive for the YouTrack 2.x compatible versions of the library and scripts.
To import issues from Mantis bug tracker:
- Download the latest version of YouTrack's Python Client Library and unzip it.
- Install Python.
- 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, the defaultMantis.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:
The following command line parameters should be provided:
Parameter Description target_url URL of the YouTrack server to which data should be imported. target_login User name to log in to the target YouTrack server. Note that the user should have administrator permissions. target_pass Password to log in to the target YouTrack server. mantis_db Name of the source Mantis database. mantis_host URL of the source Mantis database. mantis_port Port to access the source Mantis database. If not configured specifically, the port number for Mantis database is 3306, by default. mantis_login Username to log in to the source Mantis database. mantis_pass Password to log in to the source Mantis database. mantis_project Name(s) of the source projects to be imported from Mantis.
Important notes
About 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.
About user accounts
Please note that YouTrack does not support importing usernames with spaces. For such usernames the space sign will be replace with the underscore ("_") sign.
About encodings
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.
Mapping Notes
All mappings except Custom Fields, could be edited, if needed.
Mapping Mantis's RESOLUTION and STATUS
Both Statuses and Resolutions are imported in YouTrack as issue state:
|
|
Mapping Mantis's PRIORITY, STATUS, and LINK TYPES
|
|
Mapping Custom Field Types in Mantis with YouTrack
| Mantis's CF_TYPE (numeric) | Mantis's CF_TYPE | YouTrack's CF Type |
|---|---|---|
| 0 | String | "string" |
| 1 | Numeric | "integer" |
| 2 | Float | "string" |
| 3 | Enumeration | "enum[1]" |
| 4 | "string" | |
| 5 | Checkbox | "enum[1]" |
| 6 | List | "enum[1]" |
| 7 | Multiselection list | "enum[*]" |
| 8 | Date | "date" |
| 9 | Radio | "enum[1]" |
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:
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:
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.