You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2022/07/25 14:01:58 UTC

[lucene-jira-archive] 01/01: #79: include parent issue link

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

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

commit 874ecb17a4efe64f000a40552a533ef99a2a7e3b
Author: Mike McCandless <mi...@apache.org>
AuthorDate: Mon Jul 25 10:01:45 2022 -0400

    #79: include parent issue link
---
 migration/src/jira2github_import.py | 8 ++++++--
 migration/src/jira_util.py          | 9 +++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/migration/src/jira2github_import.py b/migration/src/jira2github_import.py
index eaea4201..e3d46132 100644
--- a/migration/src/jira2github_import.py
+++ b/migration/src/jira2github_import.py
@@ -60,7 +60,8 @@ def convert_issue(num: int, dump_dir: Path, output_dir: Path, account_map: dict[
         resolution = extract_resolution(o)
         priority = extract_priority(o)
         vote_count = extract_vote_count(o)
-            
+        parent_issue_key, parent_url = extract_parent(o)
+
         reporter_gh = account_map.get(reporter_name)
         reporter = f"{reporter_dispname} (@{reporter_gh})" if reporter_gh else f"{reporter_dispname}"
         assignee_gh = account_map.get(assignee_name)
@@ -101,7 +102,7 @@ def convert_issue(num: int, dump_dir: Path, output_dir: Path, account_map: dict[
         body += f"""
 
 ---
-### Legacy Jira details
+### Legacy Jira
 
 [{jira_id}]({jira_issue_url(jira_id)}) by {reporter} on {created_datetime.strftime('%b %d %Y')}"""
 
@@ -115,6 +116,9 @@ def convert_issue(num: int, dump_dir: Path, output_dir: Path, account_map: dict[
         elif created_datetime.date() != updated_datetime.date():
             body += f", updated {updated_datetime.strftime('%b %d %Y')}"
 
+        if parent_issue_key:
+            body += f'\nParent: [{parent_issue_key}]({parent_url})'
+
         if environment:
             body += f'\nEnvironment:\n```\n{environment}\n```\n'
 
diff --git a/migration/src/jira_util.py b/migration/src/jira_util.py
index 551f7773..a48accd6 100644
--- a/migration/src/jira_util.py
+++ b/migration/src/jira_util.py
@@ -83,6 +83,15 @@ def extract_assignee(o: dict) -> tuple[str, str]:
     return (name, disp_name)
 
 
+def extract_parent(o: dict) -> tuple[str, str]:
+    parent = o["fields"].get("parent")
+    if parent:
+        key = parent["key"]
+        if key:
+            return key, f'https://issues.apache.org/jira/browse/{key}'
+    return None, None
+
+
 def extract_created(o: dict) -> str:
     return o.get("fields").get("created", "")