This is an old revision of the document!
Table of Contents
Import Export for a list of bugs
- Author: Gianluca Sforna (giallu)
- Status:
Draft| Work in Progress |Implemented - Associated Issue: http://www.mantisbt.org/bugs/view.php?id=4220
Introduction
A complete solution for copying a list of issues between two different Mantis instances is something asked from quite some time:
http://www.mantisbt.org/bugs/view.php?id=4220
For a greater flexibility, the use of an XML format looks like the best option (XML export was also asked in http://www.mantisbt.org/bugs/view.php?id=4024).
Implementation Notes
We assume a Mantis instance (A) as the source, and another instance (B) as the destination. A possible workflow could be:
- Select a set of issues in A using filters
- Activate the Export command
- An XML file is produced and downloaded
- Log in instance B as administrator
- Import the XML file and watch instance B populated with new bugs
The first implementation will support all the issue fields (including extended info) and custom fields.
Given the extensible nature of the XML format, this feature can be enhanced later to support notes, attachments and all other informations related to the issue.
Design choices and issues
The main hurdle for this feature is to define the behavior when any piece of information is an internal reference to instance A.
This includes:
Project IDs
Issue
the selected issues could be from more than one project in instance A and there is no guarantee the same project(s) will be in instance B
Proposed solution
import will happen on a single project in instance B, so warn the user on export if “All project” is selected
User IDs
Issue
user ids will not match between the instances
Proposed solution
On import page, ask what to do with users. Options are:
- squash all ids to a single one in instance B
- attempt to find a matching user by username, then fallback to squashing id
Bug and Notes internal links
Issue
Notes and bugs can contain references to other notes or bugs (by default they are made with the syntax #bugId and ~noteId)
Proposed solution
The references to bugs and notes that are imported in the same transaction can be rewrote to reflect the new id assigned in instance B.
On import page, allow choosing whether to try converting references and one of the following default actions:
- Replace internal links with links to original items in instance A
- Replace them with fake links, pretending the linked bug or note was deleted
Metadata
In order to support all the options above, some additional information will need to be included in the exported file.
- Full URL ($g_path) of instance A
- The bug link trigger ( $g_bug_link_tag )
- The note link trigger ( $g_bugnote_link_tag )
Action Items
Phase 1
- Prepare a basic DTD for the XML file (just bug data)
- Prepare a sample XML file
- Add “XML Export” link to view_all_bug_page.php
Phase 2
- Add bug notes to the DTD