Skip to content

Commit

Permalink
ARROW-6262: [Developer] Show JIRA issue before merging
Browse files Browse the repository at this point in the history
It's useful to confirm whehter the associated JIRA issue is right or
not.

We couldn't find wrong associated JIRA issue after we merge
the pull request #5050 .

Closes #5097 from kou/dev-merge-show-jira-issue-before-merge and squashes the following commits:

6c9ad5b <Sutou Kouhei>  Show JIRA issue before merging

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Wes McKinney <[email protected]>
  • Loading branch information
kou authored and wesm committed Aug 16, 2019
1 parent 71b32b9 commit 884ed65
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions dev/merge_arrow_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,6 @@ def resolve(self, fix_versions, comment):
self.cmd.fail("JIRA issue %s already has status '%s'"
% (self.jira_id, cur_status))

console_output = format_resolved_issue_status(self.jira_id, cur_status,
fields.summary,
fields.assignee,
fields.components)
print(console_output)

resolve = [x for x in self.jira_con.transitions(self.jira_id)
if x['name'] == "Resolve Issue"][0]
self.jira_con.transition_issue(self.jira_id, resolve["id"],
Expand All @@ -201,27 +195,31 @@ def resolve(self, fix_versions, comment):

print("Successfully resolved %s!" % (self.jira_id))

self.issue = self.jira_con.issue(self.jira_id)
self.show()

def format_resolved_issue_status(jira_id, status, summary, assignee,
components):
if assignee is None:
assignee = "NOT ASSIGNED!!!"
else:
assignee = assignee.displayName
def show(self):
fields = self.issue.fields

if len(components) == 0:
components = 'NO COMPONENTS!!!'
else:
components = ', '.join((x.name for x in components))
assignee = fields.assignee
if assignee is None:
assignee = "NOT ASSIGNED!!!"
else:
assignee = assignee.displayName

components = fields.components
if len(components) == 0:
components = 'NO COMPONENTS!!!'
else:
components = ', '.join((x.name for x in components))

return """=== JIRA {} ===
Summary\t\t{}
Assignee\t{}
Components\t{}
Status\t\t{}
URL\t\t{}/{}""".format(jira_id, summary, assignee, components, status,
'/'.join((JIRA_API_BASE, 'browse')),
jira_id)
print("=== JIRA {} ===".format(self.jira_id))
print("Summary\t\t{}".format(fields.summary))
print("Assignee\t{}".format(assignee))
print("Components\t{}".format(components))
print("Status\t\t{}".format(fields.status.name))
print("URL\t\t{}/{}".format('/'.join((JIRA_API_BASE, 'browse')),
self.jira_id))


class GitHubAPI(object):
Expand Down Expand Up @@ -293,6 +291,7 @@ def show(self):
print("\n=== Pull Request #%s ===" % self.number)
print("title\t%s\nsource\t%s\ntarget\t%s\nurl\t%s"
% (self.title, self.description, self.target_ref, self.url))
self.jira_issue.show()

@property
def is_merged(self):
Expand Down

0 comments on commit 884ed65

Please sign in to comment.