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/26 09:46:11 UTC

[lucene-jira-archive] branch main updated: #79: include parent issue link (#80)

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

mikemccand 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 17cea127 #79: include parent issue link (#80)
17cea127 is described below

commit 17cea1274fbe089bade0b66a6ece79d68b7c7c1b
Author: Michael McCandless <mi...@apache.org>
AuthorDate: Tue Jul 26 05:46:07 2022 -0400

    #79: include parent issue link (#80)
    
    * #79: include parent issue link
    
    * just return parent issue key and generate the URL upstairs
---
 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..6e3807e7 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 = extract_parent_key(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}](https://issues.apache.org/jira/browse/{parent_issue_key})'
+
         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..3653347c 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_key(o: dict) -> str:
+    parent = o["fields"].get("parent")
+    if parent:
+        key = parent["key"]
+        if key:
+            return key
+    return None
+
+
 def extract_created(o: dict) -> str:
     return o.get("fields").get("created", "")