Import from FogBugz
Follow the instructions on this page to import cases from FogBugz with a Python import script. This procedure requires the following steps:
(Optional) Customize the mapping between the fields in your FogBugz database and the issue attributes in YouTrack.
Import Details
If the FogBugz database contains references to entities that do not already exist in YouTrack, they are created. The user account that you use to run the import should have permission to create projects, issues, users, and possibly more. We recommend that you use an account with a System Admin role to execute the import script.
New entities are created as follows:
Entity | Description |
---|---|
Projects | If the project that is referenced in the import source does not already exist, a new project is created.
|
Users | Several issue attributes like reporterName and Assignee store references to user accounts. The values in the import are checked against existing user accounts by login. For each new value that does not match the email for an existing user, a new user account is created.
|
Custom Fields | If the import data contains a field that does not exist in YouTrack, the custom field is created and added to the target project.
|
Field Values | If the source file contains new values for an existing field, they are added to the current set of values. |
For imported issues, YouTrack does not render HTML content from cases in FogBugz. Instead, the HTML content is displayed as source HTML code.
Set Up Your Environment
Import to YouTrack is supported by Python import scripts. These scripts are built on top of the YouTrack REST API. You won't actually need to do any programming in Python, but you do need to install Python and the package that contains the import scripts.
To set up your environment:
Download and install Python. The Python Client Library is compatible with Python 2.7+. Python 3 releases are not supported. You can choose whichever installation directory you prefer.
The latest versions of macOS, CentOS, Red Hat Enterprise Linux (RHEL), and Ubuntu come with Python 2.7 out of the box. If you're working with any of these operating systems, continue with the next step.- Install the package that contains the import scripts. Open the command-line interface that is supported by your operating system and enter the following command:
pip install youtrack-scripts
The import scripts are installed in your local environment.
The
youtrack
package that contains the Python client library for the YouTrack REST API is installed automatically as a dependency.
pip install --user youtrack-scripts
Customize the Mapping Definitions
The next step is to map the fields in your FogBugz database to issue attributes in YouTrack. You can use the fb2youtrack
script to generate a sample mapping file.
You only need to customize the mapping file if you have customized the issue attributes in FogBugz. To use the default mapping definitions, skip this procedure and import your data.
To generate a mapping file:
Open the command-line interface that is supported by your operating system.
If necessary, change the current directory to the installation directory for Python. For example (Windows):
cd C:\Python27
- Enter the following command:
fb2youtrack -g -m mapping.json
The
-g
option tells the script to generate the mapping file.The
-m
option overrides the default path and filename for the mapping file. If you don't pass this option, the file is generated in the current directory asmapping.json
. If you want to specify another location and/or filename, specify a value for the parameter with the full path of the target directory and/or desired name.If the command is executed successfully, a message with the location of the generated file is printed in the command-line interface.
To customize the mapping definitions:
Open the generated mapping file.
Check the
cf_names
dictionary and verify that all of the fields in your FogBugz database are mapped to the desired attributes in YouTrack.FogBugz lets users create new categories for issues. If you have defined any categories in your FogBugz instance, you need to add them to your mapping file. The following example maps FogBugz categories to values for the Type field:
category = { 'Feature' : 'Feature', 'Bug' : 'Bug', 'Inquiry' : 'Feature', 'Schedule Item' : 'Task', 'FB Category' : 'YT Type' }
For the
projects_to_import
, specify the names of the FogBugz projects that you want to import to YouTrack, separated by commas. Use the following example as a guide:projects_to_import = [u'Project1_name', u'Project2_name', ..., u'ProjectN_name']
Save your changes and close the mapping file.
Import Your Data
The last step is to run the command that imports your data from FogBugz.
To import your data:
Open the command-line interface that is supported by your operating system.
If necessary, change the current directory to the installation directory for Python. For example (Windows):
cd C:\Python27
- Enter the following command: Replace the command-line parameters with values as described here:
fb2youtrack -m mapping.json -t token -u login -p password target_url source_url source_login source_password max_issue_id
Parameter
Description
mapping.json
Use with the
-m
option to specify the full path and filename of your custom mapping file. If you don't pass this option, the default mapping file is used instead.token
When used with the
-t
option, a permanent token that is used to authenticate your administrator account in YouTrack. This is the preferred method of authentication. If you use this option, skip the-u
and-p
options. To learn how to generate a permanent token, see Create a Permanent Token.
Alternatively, you can use the-T
option and specify the full path and filename for a file that contains a permanent token.login
When used with the
-u
option, the login for a YouTrack administrator account. You must also specify a value for the-p
option.password
When used with the
-p
option, the password for the YouTrack administrator account.target_url
The base URL of the target YouTrack server. For YouTrack InCloud instances, your base URL includes the trailing
/youtrack
. For example:https://company.myjetbrains.com/youtrack
source_url
The URL of the FogBugz server.
source_login
The username to log in to the FogBugz server.
source_password
The password for the account used to log in to the FogBugz server.
max_issue_id
This parameter defines the maximum issue ID to import. In FogBugz, issues are sequentially numbered through all projects, that is, for example, issue-1 belongs to project-1, issue-2 to project-2, and issue-3 — to project-1. By defining the
max_issue_id
, you specify the range of issue IDs in FogBugz that belong to specific projects (specified in the mapping file) that are imported to YouTrack.The command executes the Python import script.
If successful, the following line is printed in the command-line interface for each issue:
Issue [ <issue ID> ] imported successfully
- Check the project or projects that you imported issues into and verify that the data is presented properly. If you are not satisfied with the results and want to re-import the data:
Delete all of the issues that were created during import. If you imported issues into a new project, simply delete the project.
Edit your mapping file.
Run the import script again.