YouTrack Standalone 2017.2 Help

Import from Mantis

General Procedure

You can import issues from the Mantis bug tracker into YouTrack.

To import issues from the Mantis bug tracker:

  1. Download the latest version of YouTrack's Python Client Library and unzip it.

  2. Install Python or Jython.

  3. Install Python library mySQLdb.

  4. 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.

  5. Import issues from a file to YouTrack running the following command:
    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
    Enter values for the following command-line parameters:

    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.

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:

Mantis RESOLUTION

YouTrack State

10 (open)

"Open"

20 (fixed)

"Fixed"

30 (reopened)

"Reopened"

40 (unable to reproduce)

"Can't Reproduce"

50 (not fixable)

"Won't fix"

60 (duplicate)

"Duplicate"

70 (no change required)

"Obsolete"

80 (suspended)

"Incomplete"

90 (won't fix)

"Won't fix"

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

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

Email

"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:

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.

Last modified: 7 March 2019