From 1761701461d1df3019d9c2a056c6bd4b15223fb2 Mon Sep 17 00:00:00 2001 From: Mart Somermaa Date: Mon, 9 Jan 2023 22:30:24 +0200 Subject: [PATCH] refactor: allow single string and WithResolution values by converting them to a tuple --- exportimportconfig-sample.py | 1 + lib/export_import.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/exportimportconfig-sample.py b/exportimportconfig-sample.py index fa760e4..e0668ec 100644 --- a/exportimportconfig-sample.py +++ b/exportimportconfig-sample.py @@ -68,6 +68,7 @@ 'Done': 'Done', } +# Note that transition names are different from status names STATUS_TRANSITIONS = { 'Open': None, 'Reopened': None, diff --git a/lib/export_import.py b/lib/export_import.py index a7c0040..a285012 100644 --- a/lib/export_import.py +++ b/lib/export_import.py @@ -190,6 +190,10 @@ def _set_status(new_issue, old_issue, conf, target_jira): transitions = transition_map[status_name] if not transitions: return + # Allow single string and WithResolution values by converting them to a tuple + if isinstance(transitions, str) or isinstance(transitions, conf.WithResolution): + transitions = (transitions,) + for transition_name in transitions: if isinstance(transition_name, conf.WithResolution): resolution = conf.RESOLUTION_MAP[old_issue.fields.resolution.name]