From 7d0e9e2672c140b18e42d9043d69125f7d68c37c Mon Sep 17 00:00:00 2001 From: sidpremkumar Date: Aug 07 2019 12:52:55 +0000 Subject: [PATCH 1/2] Adding QA contact field support --- diff --git a/README.rst b/README.rst index bd6f40b..19b4c11 100644 --- a/README.rst +++ b/README.rst @@ -58,6 +58,10 @@ To set up the mailer you need to set the following environmental variables: 2. DEFAULT_SERVER - Mail server to be used +Custom Fields +------------- +Sync2Jira supports custom fields. You can pass them in as a parameter in your project ``custom-fields: {...}``. + Development ----------- diff --git a/sync2jira/downstream.py b/sync2jira/downstream.py index 8264733..bb095e2 100644 --- a/sync2jira/downstream.py +++ b/sync2jira/downstream.py @@ -565,6 +565,17 @@ def _create_jira_issue(client, issue, config): log.info(" Creating issue.") downstream = client.create_issue(**kwargs) + # Add QA field if present + if issue.downstream.get('qa-contact', None): + # Fetch all fields + all_fields = jira.fields() + # Make a map from field name -> field id + name_map = {field['name']: field['id'] for field in all_fields} + # Try to get and update the custom field + custom_field = name_map.get('QA Contact', None) + if custom_field: + downstream.update({custom_field: issue.downstream.get('qa-contact')}) + remote_link = dict(url=issue.url, title=remote_link_title) _attach_link(client, downstream, remote_link) From 80f2530c359e1a1c7086eb011581afd4b03df784 Mon Sep 17 00:00:00 2001 From: sidpremkumar Date: Aug 07 2019 12:54:14 +0000 Subject: [PATCH 2/2] Fixing change status doc string --- diff --git a/sync2jira/downstream.py b/sync2jira/downstream.py index bb095e2..a3c5a7f 100644 --- a/sync2jira/downstream.py +++ b/sync2jira/downstream.py @@ -491,14 +491,13 @@ def assign_user(client, issue, downstream, remove_all=False): def _change_status(client, downstream, status, issue): """ - Change status of JIRA issue - Args: - client (jira.client.JIRA): JIRA client - downstream (jira.resources.Issue): JIRA issue object - status (str): Title of status to which issue should be move - issue (sync2jira.intermediary.Issue): Issue object - Returns: - Nothing + Change status of JIRA issue. + + + :param jira.client.JIRA client: JIRA client + :param jira.resources.Issue downstream: JIRA issue object + :param String status: Title of status to which issue should be move + :param sync2jira.intermediary.Issue issue: Issue object """ transitions = client.transitions(downstream) id = ''