diff options
author | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2019-04-08 10:09:11 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2019-04-08 08:25:54 +0000 |
commit | a6797d7ba8c410bfd19b00d8ae7b39a1cb9adc17 (patch) | |
tree | 9a247953308db488940c447feaf7de5a78fbe572 /scripts/jira | |
parent | 1cf944bc544d93224f14fc890971709740eaa8ce (diff) | |
download | qtqa-a6797d7ba8c410bfd19b00d8ae7b39a1cb9adc17.tar.gz |
Do not add comment about not closing issue when the issue is closed
Simplify the code that closes issues and make sure it updates the fields.
Before the bot would unconditionally add "A change related to this
issue was integrated. This issue was re-opened before, the bot will not
close this issue, please close it manually when applicable."
Change-Id: Ic8e3840a6341cccb0bef0136c6e03a01ce9e5ece
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'scripts/jira')
-rw-r--r-- | scripts/jira/jira-bug-closer/jiracloser/closer.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/jira/jira-bug-closer/jiracloser/closer.py b/scripts/jira/jira-bug-closer/jiracloser/closer.py index 31d3ae3..ad193a1 100644 --- a/scripts/jira/jira-bug-closer/jiracloser/closer.py +++ b/scripts/jira/jira-bug-closer/jiracloser/closer.py @@ -188,17 +188,18 @@ class JiraCloser: return False def _close_issue(self, issue: jira.Issue, fields: Dict[str, Any], ignore_reopened: bool) -> None: + if issue.fields.status.name == 'Closed': + issue.update(fields=fields) + return if not ignore_reopened and JiraCloser._is_reopened(issue): self.jira_client.add_comment(issue, 'A change related to this issue was integrated. This issue was re-opened before, the bot will not close this issue, please close it manually when applicable.') return if issue.fields.status.name == 'In Progress': fields.update({'resolution': {'name': 'Done'}}) self.jira_client.transition_issue(issue.key, transition='Fixed', fields=fields) - elif issue.fields.status.name == 'Closed': - issue.update(fields=fields) - else: - fields.update({'resolution': {'name': 'Done'}}) - self.jira_client.transition_issue(issue.key, transition='Close', fields=fields) + return + fields.update({'resolution': {'name': 'Done'}}) + self.jira_client.transition_issue(issue.key, transition='Close', fields=fields) def _update_issue(self, fix: FixedByTag, issue_key: str, fixes: bool, ignore_reopened: bool=False) -> None: try: |