YouTrack InCloud 2017.4 Help

Import from FogBugz

Follow the instructions on this page to import cases from FogBugz using a dedicated module from the YouTrack Python Client Library. This procedure requires the following steps:

  1. Set up your local environment.
  2. Customize the mapping between the fields in your FogBugz database and the issue attributes in YouTrack.
  3. Import your issues.

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:

ProjectsIf the project that is referenced in the import source does not already exist, a new project is created.
  • The project name and ID are assigned based on the values from the FogBugz database.
  • The user who executes the import script is set as the project lead.
UsersSeveral 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.
  • The login is also used as the full name for the imported user account.
  • YouTrack does not support whitespace characters in logins. Whitespace characters in the fb_user.login are replaced with underscores.
  • All new user accounts are assigned randomly-generated passwords. To log in to YouTrack, imported users must click the Reset password link on the login page and create a new password.

References to users in the imported data are mapped to existing accounts in YouTrack. If a match is not found, a new user account is created.

Imported users are allocated a license according to your subscription plan. For users that exceed your per-user license limit, the imported users are flagged as banned.

For more information, see Ban User Accounts.

Custom FieldsIf the import data contains a field that does not exist in YouTrack, the custom field is created and added to the target project.
  • The field name and type are set according to the definitions in your mapping file.
  • The properties for the custom field are set as follows: autoAttached=true, isPrivate=false, defaultVisibility=false.
Field ValuesIf 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. For example:


Set Up Your Environment

Import to YouTrack is supported by the YouTrack Python Client Library. This library is basically a wrapper for the YouTrack REST API. You won't actually need to do any programming in Python, but you do need to install Python and download the client library.

To set up your environment:

  1. 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.
  2. Download the latest version of the YouTrack Python Client Library from GitHub.
  3. Extract the contents of the ZIP archive to a folder in your local directory. You can extract the files to whichever folder you prefer.

Customize the Mapping Definitions

The next step is to map the fields in your FogBugz database to issue attributes in YouTrack. The client library contains a sample file that you can customize to match your import data. The file is saved as in the python/fbugz subfolder of the client library. This file contains mappings for all of the fields that are required for successful import and definitions for most custom field types.

To use the default mapping definitions, skip this procedure and import your data.

To customize the mapping definitions:

  1. Either open the file or open a new file in a text editor and paste the content of the default mapping file.
  2. Check the fbugz.CF_Names dictionary and verify that all of the fields in your FogBugz database are mapped to the desired attributes in YouTrack.
  3. 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:
    fbugz.CATEGORY = { 'Feature' : 'Feature', 'Bug' : 'Bug', 'Inquiry' : 'Feature', 'Schedule Item' : 'Task', 'FB Category' : 'YT Type' }
  4. For the fbugz.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:
    fbugz.PROJECTS_TO_IMPORT = [u'Project1_name', u'Project2_name', ..., u'ProjectN_name']
  5. If you created a new file, perform the following steps:
    • Save your mapping file with the extension .py and add it to the <unzipped library directory>/python/fbugz directory.
    • Open the file in the python subfolder of the client library.
    • Locate the reference to the defaultFBugz module and set the value to the name of your mapping file (without the .py extension). Use the following example as a guide:
      from fbugz.fbSOAPClient import FBClient from youtrack.connection import Connection from youtrack import Group, User, Issue, Comment, Link from fbugz import <mapping file name> import fbugz from youtrack import YouTrackException from youtrack.importHelper import *
    • Save and close the file.
    If you modified the file instead, save and close the file.

Import Your Data

The last step is to run the command that imports your data from FogBugz.

To import your data:

  1. Open the command-line interface that is supported by your operating system.
  2. If necessary, change the current directory to the installation directory for Python. For example (Windows):
    cd C:\Python27
  3. Enter the following command:
    python target_url target_login target_password source_url source_login source_password max_issue_id
    Replace the command-line parameters with values as described here:
    Parameter Description
    target_urlThe base URL of the target YouTrack server. For YouTrack InCloud instances, your base URL includes the trailing /youtrack. For example:
    target_loginThe login for a YouTrack administrator account.
    target_pass The password for the YouTrack administrator account.
    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
  4. 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.
Last modified: 4 January 2018