You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by to...@apache.org on 2022/07/24 02:22:47 UTC

[lucene-jira-archive] branch main updated: preserve Jira 'Labels' (#68)

This is an automated email from the ASF dual-hosted git repository.

tomoko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene-jira-archive.git


The following commit(s) were added to refs/heads/main by this push:
     new 579ff5ca preserve Jira 'Labels' (#68)
579ff5ca is described below

commit 579ff5caec1d4b0afab03fe8383a31f64969af10
Author: Tomoko Uchida <to...@gmail.com>
AuthorDate: Sun Jul 24 11:22:43 2022 +0900

    preserve Jira 'Labels' (#68)
---
 migration/src/jira2github_import.py | 5 ++++-
 migration/src/jira_util.py          | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/migration/src/jira2github_import.py b/migration/src/jira2github_import.py
index be07d4b9..e7c4080b 100644
--- a/migration/src/jira2github_import.py
+++ b/migration/src/jira2github_import.py
@@ -55,7 +55,8 @@ def convert_issue(num: int, dump_dir: Path, output_dir: Path, account_map: dict[
         attachments = extract_attachments(o)
         linked_issues = extract_issue_links(o)
         subtasks = extract_subtasks(o)
-        pull_requests =extract_pull_requests(o)
+        pull_requests = extract_pull_requests(o)
+        jira_labels = extract_labels(o)
 
         reporter_gh = account_map.get(reporter_name)
         reporter = f"{reporter_dispname} (@{reporter_gh})" if reporter_gh else f"{reporter_dispname}"
@@ -189,6 +190,8 @@ def convert_issue(num: int, dump_dir: Path, output_dir: Path, account_map: dict[
                     labels.append(l)
             else:
                 logger.error(f"Unknown Component: {c}")
+        for label in jira_labels:
+            labels.append(f"legacy-jira-label:{label}")
 
         data = {
             "issue": {
diff --git a/migration/src/jira_util.py b/migration/src/jira_util.py
index 49bfdf7f..d939f3d9 100644
--- a/migration/src/jira_util.py
+++ b/migration/src/jira_util.py
@@ -84,6 +84,10 @@ def extract_components(o: dict) -> list[str]:
     return [x.get("name", "") for x in o.get("fields").get("components", [])]
 
 
+def extract_labels(o: dict) -> list[str]:
+    return o.get("fields").get("labels", [])
+
+
 def extract_attachments(o: dict) -> list[tuple[str, int]]:
     attachments = o.get("fields").get("attachment")
     if not attachments: