プロジェクト

全般

プロフィール

Vote #77405

完了

Allow forward reference to parent when importing issues

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Importers_15
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
15
version_id:
119
issue_org_id:
22701
author_id:
14446
assigned_to_id:
1
comments:
7
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

When importing issues via CSV with parent relations, the parent issues need to be positioned before child issues. Otherwise the relation will be ignored.

To work around this limitation, the issue import could be extended to use multiple passes:

one to import basic issue properties

one to import relations to other issues

This way it becomes easier to create the CSV files for imports, since order is no longer important.

This change would also be a prerequisite to import general issue relations. Since those cannot be more complex that parent relations and cannot necessarily be linearized properly.

Attached you find a patch series based on trunk r15361.

While implemented the changes, I tried to keep the @Import@ free from issue related information. Other existing @Import@ sub classes - within plugins e.g. - should need as little updates as possible.

h3. 0001 Extend test data for issue import

This change adds two rows to the existing issue import fixture file. These rows contain a parent and a child issue, while the parent is placed after the child. This would not import properly given the current implementation.

The patch also updates the existing tests, where the number of imported issues is asserted.

h3. 0002 Add test for issue relations to following rows

This patch extends the existing parent issue import test to also verify that the newly introduced parent child relation is properly imported. This test fails with the current implementation.

h3. 0003 Multi-pass CSV import

This patch defines a @required_passes@ method within @Import@ which returns @1@ by default and may be overwritten in sub classes. The @IssueImport@ does so and returns @1@ if no @parent_id@ mapping was set, otherwise it returns @2@.

The @run@ method is split into @run@ and @run_pass@. The first one is recursive and called once for each pass. It also handles the @max_*@ options. The second is only responsible for reading the rows, creating or updating the ImportItems and passing everything to @build_object@.

Since @build_object@ may now be called multiple times (once for each pass), the argument list was extended to provide more context. If somebody created a custom import in a plugin, this would need to be changed by the plugin's author.

In the @IssueImport@, @build_object@ is now split into @build_issue@ and @build_relations@, the first is called in the first pass, the second in pass 2.

The patch also contains a migration, which adds a @completed_passes@ field to @ImportItem@. This is needed to properly (re-)store progress for multi-step imports, like the ones via the web UI.

Finally the patch adds some test to make sure, that the general behavior of multi-step imports did not change with the introduction of multi-pass imports.

Disclaimer: I know, this is a rather large change to fix a minor nuisance. But as mentioned earlier, I think, this change is a necessary prerequisite to support importing "Related Issues" properly, which I would like to contribute next, if this patch is accepted.


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Feature added in r16241 using a callback mechanism instead of the more complex multi-pass solution proposed in the patch.
It can be extend easily to support issue relations in the future as well.
--------------------------------------------------------------------------------
Interesting approach. Thanks for taking care of this issue.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,28198,Support issue relations when importing issues
duplicates,Closed,25799,Issue Import - Dynamic Parent pasks

Admin Redmine さんが3年以上前に更新

  • カテゴリImporters_15 にセット
  • 対象バージョン3.4.0_119 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0